Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a9d4b37

Browse files
committed
Code cleanup and minor refactoring
1 parent 22de826 commit a9d4b37

3 files changed

Lines changed: 24 additions & 18 deletions

File tree

lib/core/session.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ def resumeConfKb(expression, url, value):
361361
injection = base64unpickle(value[:-1])
362362
kb.injections.append(injection)
363363

364-
logMsg = "resuming injection data"
364+
logMsg = "resuming injection data from session file"
365365
logger.info(logMsg)
366366

367367
elif expression == "Boolean-based blind injection" and url == conf.url:

lib/parse/payloads.py

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,33 +13,40 @@
1313
from lib.core.data import paths
1414
from lib.core.datatype import advancedDict
1515

16-
def cleanupVals(values, tag):
17-
if isinstance(values, basestring):
18-
return values
16+
def cleanupVals(text, tag):
17+
if tag in ("clause", "where"):
18+
text = text.split(',')
1919

20-
count = 0
21-
22-
for value in values:
23-
if value.isdigit():
24-
value = int(value)
20+
if isinstance(text, basestring):
21+
if text.isdigit():
22+
text = int(text)
2523
else:
26-
value = str(value)
24+
text = str(text)
25+
26+
elif isinstance(text, list):
27+
count = 0
28+
29+
for t in text:
30+
if t.isdigit():
31+
t = int(t)
32+
else:
33+
t = str(t)
2734

28-
values[count] = value
29-
count += 1
35+
text[count] = t
36+
count += 1
3037

31-
if len(values) == 1 and tag not in ("clause", "where"):
32-
values = values[0]
38+
if len(text) == 1 and tag not in ("clause", "where"):
39+
text = text[0]
3340

34-
return values
41+
return text
3542

3643
def parseXmlNode(node):
3744
for element in node.getiterator('boundary'):
3845
boundary = advancedDict()
3946

4047
for child in element.getchildren():
4148
if child.text:
42-
values = cleanupVals(child.text.split(','), child.tag)
49+
values = cleanupVals(child.text, child.tag)
4350
boundary[child.tag] = values
4451
else:
4552
boundary[child.tag] = None
@@ -51,7 +58,7 @@ def parseXmlNode(node):
5158

5259
for child in element.getchildren():
5360
if child.text and child.text.strip():
54-
values = cleanupVals(child.text.split(',') if child.tag != "epayload" else child.text, child.tag)
61+
values = cleanupVals(child.text, child.tag)
5562
test[child.tag] = values
5663
else:
5764
if len(child.getchildren()) == 0:

lib/techniques/error/use.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
from lib.core.session import setError
2424
from lib.core.unescaper import unescaper
2525
from lib.request.connect import Connect as Request
26-
from lib.utils.resume import resume
2726

2827
from lib.core.settings import ERROR_SPACE
2928
from lib.core.settings import ERROR_EMPTY_CHAR

0 commit comments

Comments
 (0)