Skip to content

Commit

Permalink
Fix for an Issue sqlmapproject#132
Browse files Browse the repository at this point in the history
  • Loading branch information
stamparm committed Jul 30, 2012
1 parent 47073f4 commit bdbe8ff
Showing 1 changed file with 30 additions and 21 deletions.
51 changes: 30 additions & 21 deletions lib/core/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -3009,28 +3009,37 @@ def geturl(self):

if forms:
for form in forms:
for control in form.controls:
if hasattr(control, "items"):
# if control has selectable items select first non-disabled
for item in control.items:
if not item.disabled:
if not item.selected:
item.selected = True
break

request = form.click()
url = urldecode(request.get_full_url(), kb.pageEncoding)
method = request.get_method()
data = request.get_data() if request.has_data() else None
data = urldecode(data, kb.pageEncoding) if data and urlencode(DEFAULT_GET_POST_DELIMITER, None) not in data else data

if not data and method and method.upper() == HTTPMETHOD.POST:
debugMsg = "invalid POST form with blank data detected"
logger.debug(debugMsg)
continue
try:
for control in form.controls:
if hasattr(control, "items"):
# if control has selectable items select first non-disabled
for item in control.items:
if not item.disabled:
if not item.selected:
item.selected = True
break

request = form.click()
except (ValueError, TypeError), ex:
errMsg = "there has been a problem while "
errMsg += "processing page forms ('%s')" % ex
if raise_:
raise sqlmapGenericException, errMsg
else:
logger.debug(errMsg)
else:
url = urldecode(request.get_full_url(), kb.pageEncoding)
method = request.get_method()
data = request.get_data() if request.has_data() else None
data = urldecode(data, kb.pageEncoding) if data and urlencode(DEFAULT_GET_POST_DELIMITER, None) not in data else data

if not data and method and method.upper() == HTTPMETHOD.POST:
debugMsg = "invalid POST form with blank data detected"
logger.debug(debugMsg)
continue

target = (url, method, data, conf.cookie)
retVal.add(target)
target = (url, method, data, conf.cookie)
retVal.add(target)
else:
errMsg = "there were no forms found at the given target url"
if raise_:
Expand Down

0 comments on commit bdbe8ff

Please sign in to comment.