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

Skip to content

Commit 1755475

Browse files
committed
implemented feature request from Ole Rasmussen regarding table name retrieval speedup
1 parent 1ab78ce commit 1755475

3 files changed

Lines changed: 26 additions & 0 deletions

File tree

lib/core/option.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -920,6 +920,7 @@ def __setKnowledgeBaseAttributes():
920920
kb.injParameter = None
921921
kb.injPlace = None
922922
kb.injType = None
923+
kb.hintValue = None
923924

924925
# Back-end DBMS underlying operating system fingerprint via banner (-b)
925926
# parsing

lib/techniques/blind/inference.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,31 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
114114

115115
queriesCount = [0] # As list to deal with nested scoping rules
116116

117+
hintlock = threading.Lock()
118+
def tryHint(idx):
119+
hintlock.acquire()
120+
hintValue = kb.hintValue
121+
hintlock.release()
122+
if hintValue and len(hintValue) >= idx:
123+
if kb.dbms == "SQLite":
124+
posValue = hintValue[idx-1]
125+
else:
126+
posValue = ord(hintValue[idx-1])
127+
128+
forgedPayload = safeStringFormat(payload.replace('%3E', '%3D'), (expressionUnescaped, idx, posValue))
129+
result = Request.queryPage(urlencode(forgedPayload))
130+
if result:
131+
return hintValue[idx-1]
132+
hintlock.acquire()
133+
kb.hintValue = None
134+
hintlock.release()
135+
return None
136+
117137
def getChar(idx, asciiTbl=asciiTbl):
138+
result = tryHint(idx)
139+
if result:
140+
return result
141+
118142
maxValue = asciiTbl[len(asciiTbl)-1]
119143
minValue = 0
120144

plugins/generic/enumeration.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,7 @@ def getTables(self):
783783
query = rootQuery["blind"]["query"] % (db, index)
784784
table = inject.getValue(query, inband=False)
785785
tables.append(table)
786+
kb.hintValue = table
786787

787788
if tables:
788789
kb.data.cachedTables[db] = tables

0 commit comments

Comments
 (0)