mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-06-25 07:23:08 +03:00
some refactoring and one less request for aspx maintanance during --os-shell
This commit is contained in:
parent
253eafb643
commit
6712f4da55
|
@ -1424,7 +1424,7 @@ def goGoodSamaritan(prevValue, originalCharset):
|
||||||
else:
|
else:
|
||||||
return None, None, None, originalCharset
|
return None, None, None, originalCharset
|
||||||
|
|
||||||
def getCompiledRegex(regex, *args):
|
def getCompiledRegex(regex, flags=0):
|
||||||
"""
|
"""
|
||||||
Returns compiled regular expression and stores it in cache for further
|
Returns compiled regular expression and stores it in cache for further
|
||||||
usage
|
usage
|
||||||
|
@ -1432,11 +1432,11 @@ def getCompiledRegex(regex, *args):
|
||||||
<_sre.SRE_Pattern object at...
|
<_sre.SRE_Pattern object at...
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if (regex, args) in kb.cache.regex:
|
if (regex, flags) in kb.cache.regex:
|
||||||
return kb.cache.regex[(regex, args)]
|
return kb.cache.regex[(regex, flags)]
|
||||||
else:
|
else:
|
||||||
retVal = re.compile(regex, *args)
|
retVal = re.compile(regex, flags)
|
||||||
kb.cache.regex[(regex, args)] = retVal
|
kb.cache.regex[(regex, flags)] = retVal
|
||||||
return retVal
|
return retVal
|
||||||
|
|
||||||
def getPartRun():
|
def getPartRun():
|
||||||
|
@ -1628,11 +1628,11 @@ def getPublicTypeMembers(type_):
|
||||||
|
|
||||||
return retVal
|
return retVal
|
||||||
|
|
||||||
def extractRegexResult(regex, content):
|
def extractRegexResult(regex, content, flags=0):
|
||||||
retVal = None
|
retVal = None
|
||||||
|
|
||||||
if regex and content and '?P<result>' in regex:
|
if regex and content and '?P<result>' in regex:
|
||||||
match = re.search(regex, content)
|
match = re.search(regex, content, flags)
|
||||||
if match:
|
if match:
|
||||||
retVal = match.group("result")
|
retVal = match.group("result")
|
||||||
|
|
||||||
|
|
|
@ -85,9 +85,8 @@ class Web:
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.webApi == "aspx":
|
if self.webApi == "aspx":
|
||||||
page = Request.getPage(url=self.webStagerUrl, content=True, raise404=False)
|
multipartParams['__EVENTVALIDATION'] = kb.data.__EVENTVALIDATION
|
||||||
multipartParams['__EVENTVALIDATION'] = extractRegexResult(r"__EVENTVALIDATION[^>]+value=\"(?P<result>[^\"]+)\"", page[0])
|
multipartParams['__VIEWSTATE'] = kb.data.__VIEWSTATE
|
||||||
multipartParams['__VIEWSTATE'] = extractRegexResult(r"__VIEWSTATE[^>]+value=\"(?P<result>[^\"]+)\"", page[0])
|
|
||||||
|
|
||||||
page = Request.getPage(url=self.webStagerUrl, multipart=multipartParams, raise404=False)
|
page = Request.getPage(url=self.webStagerUrl, multipart=multipartParams, raise404=False)
|
||||||
|
|
||||||
|
@ -212,6 +211,10 @@ class Web:
|
||||||
logger.warn(warnMsg)
|
logger.warn(warnMsg)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
elif self.webApi == "aspx":
|
||||||
|
kb.data.__EVENTVALIDATION = extractRegexResult(r"__EVENTVALIDATION[^>]+value=\"(?P<result>[^\"]+)\"", uplPage, re.I)
|
||||||
|
kb.data.__VIEWSTATE = extractRegexResult(r"__VIEWSTATE[^>]+value=\"(?P<result>[^\"]+)\"", uplPage, re.I)
|
||||||
|
|
||||||
infoMsg = "the file stager has been successfully uploaded "
|
infoMsg = "the file stager has been successfully uploaded "
|
||||||
infoMsg += "on '%s' ('%s')" % (directory, self.webStagerUrl)
|
infoMsg += "on '%s' ('%s')" % (directory, self.webStagerUrl)
|
||||||
logger.info(infoMsg)
|
logger.info(infoMsg)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user