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

Skip to content

Commit 03be419

Browse files
committed
Fix for an Issue #447
1 parent 427d88b commit 03be419

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

lib/techniques/blind/inference.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,19 +102,19 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
102102
firstChar = 0
103103
elif dump and conf.firstChar is not None and (isinstance(conf.firstChar, int) or (isinstance(conf.firstChar, basestring) and conf.firstChar.isdigit())):
104104
firstChar = int(conf.firstChar) - 1
105-
elif firstChar is None:
106-
firstChar = 0
107-
elif (isinstance(firstChar, basestring) and firstChar.isdigit()) or isinstance(firstChar, int):
105+
elif isinstance(firstChar, basestring) and firstChar.isdigit() or isinstance(firstChar, int):
108106
firstChar = int(firstChar) - 1
107+
else:
108+
firstChar = 0
109109

110110
if "LENGTH(" in expression.upper() or "LEN(" in expression.upper():
111111
lastChar = 0
112112
elif dump and conf.lastChar is not None and (isinstance(conf.lastChar, int) or (isinstance(conf.lastChar, basestring) and conf.lastChar.isdigit())):
113113
lastChar = int(conf.lastChar)
114-
elif lastChar in (None, "0"):
115-
lastChar = 0
116-
elif (isinstance(lastChar, basestring) and lastChar.isdigit()) or isinstance(lastChar, int):
114+
elif isinstance(lastChar, basestring) and lastChar.isdigit() or isinstance(lastChar, int):
117115
lastChar = int(lastChar)
116+
else:
117+
lastChar = 0
118118

119119
if Backend.getDbms():
120120
_, _, _, _, _, _, fieldToCastStr, _ = agent.getFields(expression)
@@ -124,8 +124,10 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
124124
else:
125125
expressionUnescaped = unescaper.escape(expression)
126126

127-
if length and isinstance(length, basestring) and length.isdigit():
127+
if isinstance(length, basestring) and length.isdigit() or isinstance(length, int):
128128
length = int(length)
129+
else:
130+
length = None
129131

130132
if length == 0:
131133
return 0, ""

0 commit comments

Comments
 (0)