Skip to content

Commit d351d14

Browse files
author
Cotonne
committed
Add support for App Web POST request
1 parent 7a0d452 commit d351d14

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

nsmweb.py

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def getApps(webPort,victim,uri,https,verb,requestHeaders, args = None):
113113
if appUp == True:
114114

115115
if args == None:
116-
sizeSelect = not injectSize.isdigit()
116+
sizeSelect = True
117117

118118
while sizeSelect:
119119
injectSize = raw_input("Baseline test-Enter random string size: ")
@@ -389,7 +389,7 @@ def getResponseBodyHandlingErrors(req):
389389
return responseBody
390390

391391

392-
def postApps(victim,webPort,uri,https,verb,postData,requestHeaders):
392+
def postApps(victim,webPort,uri,https,verb,postData,requestHeaders, args = None):
393393
print "Web App Attacks (POST)"
394394
print "==============="
395395
paramName = []
@@ -468,17 +468,22 @@ def postApps(victim,webPort,uri,https,verb,postData,requestHeaders):
468468
raw_input("Something went wrong. Press enter to return to the main menu...")
469469
return
470470

471+
if args == None:
472+
sizeSelect = True
471473

472-
sizeSelect = (args == None)
473-
injectSize = 1000
474+
while sizeSelect:
475+
injectSize = raw_input("Baseline test-Enter random string size: ")
476+
sizeSelect = not injectSize.isdigit()
477+
if sizeSelect:
478+
print "Invalid! The size should be an integer."
474479

475-
while sizeSelect:
476-
injectSize = raw_input("Baseline test-Enter random string size: ")
477-
sizeSelect = not injectSize.isdigit()
478-
if sizeSelect:
479-
print "Invalid! The size should be an integer."
480+
format = randInjString(int(injectSize))
481+
else:
482+
injectSize = int(args.injectSize)
483+
format = args.injectFormat
484+
485+
injectString = build_random_string(format, injectSize)
480486

481-
injectString = randInjString(int(injectSize))
482487
print "Using " + injectString + " for injection testing.\n"
483488

484489
# Build a random string and insert; if the app handles input correctly, a random string and injected code should be treated the same.
@@ -747,8 +752,8 @@ def postApps(victim,webPort,uri,https,verb,postData,requestHeaders):
747752
else:
748753
savePath = args.savePath
749754
save_to(savePath, vulnAddrs, possAddrs, strTbAttack,intTbAttack)
750-
751-
raw_input("Press enter to continue...")
755+
if args == None:
756+
raw_input("Press enter to continue...")
752757
return()
753758

754759

0 commit comments

Comments
 (0)