Skip to content

Commit 228cc68

Browse files
committed
fix for those ugly DEBUG messages in brute mode
1 parent 5b21352 commit 228cc68

File tree

5 files changed

+15
-9
lines changed

5 files changed

+15
-9
lines changed

lib/core/option.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,9 +1234,8 @@ def __setKnowledgeBaseAttributes(flushAll=True):
12341234
kb.authHeader = None
12351235
kb.bannerFp = advancedDict()
12361236

1237-
kb.brute = advancedDict()
1238-
kb.brute.tables = []
1239-
kb.brute.columns = []
1237+
kb.brute = advancedDict({'tables':[], 'columns':[]})
1238+
kb.bruteMode = False
12401239

12411240
kb.cache = advancedDict()
12421241
kb.cache.content = {}

lib/request/inject.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,9 @@ def __goInference(payload, expression, charsetType=None, firstChar=None, lastCha
6363

6464
count, value = bisection(payload, expression, length, charsetType, firstChar, lastChar, dump)
6565

66-
debugMsg = "performed %d queries in %d seconds" % (count, calculateDeltaSeconds(start))
67-
logger.debug(debugMsg)
66+
if not kb.bruteMode:
67+
debugMsg = "performed %d queries in %d seconds" % (count, calculateDeltaSeconds(start))
68+
logger.debug(debugMsg)
6869

6970
return value
7071

lib/techniques/brute/use.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ def tableExists(tableFile, regex=None):
5757
tbllock = threading.Lock()
5858
iolock = threading.Lock()
5959
kb.threadContinue = True
60+
kb.bruteMode = True
6061

6162
def tableExistsThread():
6263
while count[0] < length and kb.threadContinue:
@@ -140,6 +141,7 @@ def tableExistsThread():
140141
except KeyboardInterrupt:
141142
raise sqlmapThreadException, "user aborted"
142143
finally:
144+
kb.bruteMode = False
143145
kb.threadContinue = True
144146
kb.threadException = False
145147

@@ -182,6 +184,7 @@ def columnExists(columnFile, regex=None):
182184
collock = threading.Lock()
183185
iolock = threading.Lock()
184186
kb.threadContinue = True
187+
kb.bruteMode = True
185188

186189
def columnExistsThread():
187190
while count[0] < length and kb.threadContinue:
@@ -256,6 +259,7 @@ def columnExistsThread():
256259
except KeyboardInterrupt:
257260
raise sqlmapThreadException, "user aborted"
258261
finally:
262+
kb.bruteMode = False
259263
kb.threadContinue = True
260264
kb.threadException = False
261265

lib/techniques/error/use.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,8 @@ def errorUse(expression, expected=None, resumeValue=True, dump=False):
307307

308308
duration = calculateDeltaSeconds(start)
309309

310-
debugMsg = "performed %d queries in %d seconds" % (reqCount, duration)
311-
logger.debug(debugMsg)
310+
if not kb.bruteMode:
311+
debugMsg = "performed %d queries in %d seconds" % (reqCount, duration)
312+
logger.debug(debugMsg)
312313

313314
return outputs

lib/techniques/inband/union/use.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,8 @@ def unionUse(expression, unpack=True, dump=False):
269269

270270
duration = calculateDeltaSeconds(start)
271271

272-
debugMsg = "performed %d queries in %d seconds" % (reqCount, duration)
273-
logger.debug(debugMsg)
272+
if not kb.bruteMode:
273+
debugMsg = "performed %d queries in %d seconds" % (reqCount, duration)
274+
logger.debug(debugMsg)
274275

275276
return value

0 commit comments

Comments
 (0)