mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-29 13:03:50 +03:00
Code cleanup and minor refactoring
This commit is contained in:
parent
22de82634a
commit
a9d4b37987
|
@ -361,7 +361,7 @@ def resumeConfKb(expression, url, value):
|
||||||
injection = base64unpickle(value[:-1])
|
injection = base64unpickle(value[:-1])
|
||||||
kb.injections.append(injection)
|
kb.injections.append(injection)
|
||||||
|
|
||||||
logMsg = "resuming injection data"
|
logMsg = "resuming injection data from session file"
|
||||||
logger.info(logMsg)
|
logger.info(logMsg)
|
||||||
|
|
||||||
elif expression == "Boolean-based blind injection" and url == conf.url:
|
elif expression == "Boolean-based blind injection" and url == conf.url:
|
||||||
|
|
|
@ -13,25 +13,32 @@ from lib.core.data import conf
|
||||||
from lib.core.data import paths
|
from lib.core.data import paths
|
||||||
from lib.core.datatype import advancedDict
|
from lib.core.datatype import advancedDict
|
||||||
|
|
||||||
def cleanupVals(values, tag):
|
def cleanupVals(text, tag):
|
||||||
if isinstance(values, basestring):
|
if tag in ("clause", "where"):
|
||||||
return values
|
text = text.split(',')
|
||||||
|
|
||||||
count = 0
|
if isinstance(text, basestring):
|
||||||
|
if text.isdigit():
|
||||||
for value in values:
|
text = int(text)
|
||||||
if value.isdigit():
|
|
||||||
value = int(value)
|
|
||||||
else:
|
else:
|
||||||
value = str(value)
|
text = str(text)
|
||||||
|
|
||||||
values[count] = value
|
elif isinstance(text, list):
|
||||||
count += 1
|
count = 0
|
||||||
|
|
||||||
if len(values) == 1 and tag not in ("clause", "where"):
|
for t in text:
|
||||||
values = values[0]
|
if t.isdigit():
|
||||||
|
t = int(t)
|
||||||
|
else:
|
||||||
|
t = str(t)
|
||||||
|
|
||||||
return values
|
text[count] = t
|
||||||
|
count += 1
|
||||||
|
|
||||||
|
if len(text) == 1 and tag not in ("clause", "where"):
|
||||||
|
text = text[0]
|
||||||
|
|
||||||
|
return text
|
||||||
|
|
||||||
def parseXmlNode(node):
|
def parseXmlNode(node):
|
||||||
for element in node.getiterator('boundary'):
|
for element in node.getiterator('boundary'):
|
||||||
|
@ -39,7 +46,7 @@ def parseXmlNode(node):
|
||||||
|
|
||||||
for child in element.getchildren():
|
for child in element.getchildren():
|
||||||
if child.text:
|
if child.text:
|
||||||
values = cleanupVals(child.text.split(','), child.tag)
|
values = cleanupVals(child.text, child.tag)
|
||||||
boundary[child.tag] = values
|
boundary[child.tag] = values
|
||||||
else:
|
else:
|
||||||
boundary[child.tag] = None
|
boundary[child.tag] = None
|
||||||
|
@ -51,7 +58,7 @@ def parseXmlNode(node):
|
||||||
|
|
||||||
for child in element.getchildren():
|
for child in element.getchildren():
|
||||||
if child.text and child.text.strip():
|
if child.text and child.text.strip():
|
||||||
values = cleanupVals(child.text.split(',') if child.tag != "epayload" else child.text, child.tag)
|
values = cleanupVals(child.text, child.tag)
|
||||||
test[child.tag] = values
|
test[child.tag] = values
|
||||||
else:
|
else:
|
||||||
if len(child.getchildren()) == 0:
|
if len(child.getchildren()) == 0:
|
||||||
|
|
|
@ -23,7 +23,6 @@ from lib.core.enums import DBMS
|
||||||
from lib.core.session import setError
|
from lib.core.session import setError
|
||||||
from lib.core.unescaper import unescaper
|
from lib.core.unescaper import unescaper
|
||||||
from lib.request.connect import Connect as Request
|
from lib.request.connect import Connect as Request
|
||||||
from lib.utils.resume import resume
|
|
||||||
|
|
||||||
from lib.core.settings import ERROR_SPACE
|
from lib.core.settings import ERROR_SPACE
|
||||||
from lib.core.settings import ERROR_EMPTY_CHAR
|
from lib.core.settings import ERROR_EMPTY_CHAR
|
||||||
|
|
Loading…
Reference in New Issue
Block a user