mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-25 11:03:47 +03:00
minor code refactoring
This commit is contained in:
parent
12d32f58f2
commit
6367f59b98
|
@ -59,7 +59,7 @@ class Agent:
|
||||||
if conf.direct:
|
if conf.direct:
|
||||||
return self.payloadDirect(newValue)
|
return self.payloadDirect(newValue)
|
||||||
|
|
||||||
retValue = ""
|
retVal = ""
|
||||||
|
|
||||||
if where is None and isTechniqueAvailable(kb.technique):
|
if where is None and isTechniqueAvailable(kb.technique):
|
||||||
where = kb.injection.data[kb.technique].where
|
where = kb.injection.data[kb.technique].where
|
||||||
|
@ -115,16 +115,16 @@ class Agent:
|
||||||
for child in iterator:
|
for child in iterator:
|
||||||
child.text = self.addPayloadDelimiters(newValue)
|
child.text = self.addPayloadDelimiters(newValue)
|
||||||
|
|
||||||
retValue = ET.tostring(root)
|
retVal = ET.tostring(root)
|
||||||
elif place in (PLACE.URI, PLACE.CUSTOM_POST):
|
elif place in (PLACE.URI, PLACE.CUSTOM_POST):
|
||||||
retValue = paramString.replace("%s%s" % (origValue, CUSTOM_INJECTION_MARK_CHAR), self.addPayloadDelimiters(newValue))
|
retVal = paramString.replace("%s%s" % (origValue, CUSTOM_INJECTION_MARK_CHAR), self.addPayloadDelimiters(newValue))
|
||||||
elif place in (PLACE.UA, PLACE.REFERER, PLACE.HOST):
|
elif place in (PLACE.UA, PLACE.REFERER, PLACE.HOST):
|
||||||
retValue = paramString.replace(origValue, self.addPayloadDelimiters(newValue))
|
retVal = paramString.replace(origValue, self.addPayloadDelimiters(newValue))
|
||||||
else:
|
else:
|
||||||
retValue = paramString.replace("%s=%s" % (parameter, origValue),
|
retVal = paramString.replace("%s=%s" % (parameter, origValue),
|
||||||
"%s=%s" % (parameter, self.addPayloadDelimiters(newValue)))
|
"%s=%s" % (parameter, self.addPayloadDelimiters(newValue)))
|
||||||
|
|
||||||
return retValue
|
return retVal
|
||||||
|
|
||||||
def fullPayload(self, query):
|
def fullPayload(self, query):
|
||||||
if conf.direct:
|
if conf.direct:
|
||||||
|
@ -792,48 +792,29 @@ class Agent:
|
||||||
"""
|
"""
|
||||||
Adds payload delimiters around the input string
|
Adds payload delimiters around the input string
|
||||||
"""
|
"""
|
||||||
retVal = inpStr
|
|
||||||
|
|
||||||
if inpStr:
|
return "%s%s%s" % (PAYLOAD_DELIMITER, inpStr, PAYLOAD_DELIMITER) if inpStr else inpStr
|
||||||
retVal = "%s%s%s" % (PAYLOAD_DELIMITER, inpStr, PAYLOAD_DELIMITER)
|
|
||||||
|
|
||||||
return retVal
|
|
||||||
|
|
||||||
def removePayloadDelimiters(self, inpStr):
|
def removePayloadDelimiters(self, inpStr):
|
||||||
"""
|
"""
|
||||||
Removes payload delimiters from inside the input string
|
Removes payload delimiters from inside the input string
|
||||||
"""
|
"""
|
||||||
retVal = inpStr
|
|
||||||
|
|
||||||
if inpStr:
|
return inpStr.replace(PAYLOAD_DELIMITER, '') if inpStr else inpStr
|
||||||
retVal = retVal.replace(PAYLOAD_DELIMITER, '')
|
|
||||||
|
|
||||||
return retVal
|
|
||||||
|
|
||||||
def extractPayload(self, inpStr):
|
def extractPayload(self, inpStr):
|
||||||
"""
|
"""
|
||||||
Extracts payload from inside of the input string
|
Extracts payload from inside of the input string
|
||||||
"""
|
"""
|
||||||
retVal = None
|
|
||||||
|
|
||||||
if inpStr:
|
return extractRegexResult("(?s)%s(?P<result>.*?)%s" % (PAYLOAD_DELIMITER, PAYLOAD_DELIMITER), inpStr)
|
||||||
match = re.search("%s(?P<result>.*?)%s" % (PAYLOAD_DELIMITER, PAYLOAD_DELIMITER), inpStr, re.S)
|
|
||||||
|
|
||||||
if match:
|
|
||||||
retVal = match.group("result")
|
|
||||||
|
|
||||||
return retVal
|
|
||||||
|
|
||||||
def replacePayload(self, inpStr, payload):
|
def replacePayload(self, inpStr, payload):
|
||||||
"""
|
"""
|
||||||
Replaces payload inside the input string with a given payload
|
Replaces payload inside the input string with a given payload
|
||||||
"""
|
"""
|
||||||
retVal = inpStr
|
|
||||||
|
|
||||||
if inpStr:
|
return re.sub("(%s.*?%s)" % (PAYLOAD_DELIMITER, PAYLOAD_DELIMITER), "%s%s%s" % (PAYLOAD_DELIMITER, payload, PAYLOAD_DELIMITER), inpStr) if inpStr else inpStr
|
||||||
retVal = re.sub("(%s.*?%s)" % (PAYLOAD_DELIMITER, PAYLOAD_DELIMITER), "%s%s%s" % (PAYLOAD_DELIMITER, payload, PAYLOAD_DELIMITER), inpStr)
|
|
||||||
|
|
||||||
return retVal
|
|
||||||
|
|
||||||
# SQL agent
|
# SQL agent
|
||||||
agent = Agent()
|
agent = Agent()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user