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

Skip to content

Commit 10bdd90

Browse files
committed
minor speed optimizations (as a result of profiling)
1 parent 36280b3 commit 10bdd90

5 files changed

Lines changed: 11 additions & 6 deletions

File tree

lib/core/defaults.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
_defaults = {
1313
"timeSec": 5,
1414
"googlePage": 1,
15-
"cpuThrottle": 10,
15+
"cpuThrottle": 5,
1616
"verbose": 1,
1717
"cDel": ";",
1818
"delay": 0,

lib/core/option.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1397,6 +1397,7 @@ def __setKnowledgeBaseAttributes(flushAll=True):
13971397
kb.delayCandidates = TIME_DELAY_CANDIDATES * [0]
13981398
kb.dep = None
13991399
kb.docRoot = None
1400+
kb.dumpMode = False
14001401
kb.dynamicMarkings = []
14011402
kb.dynamicParameters = False
14021403
kb.endDetection = False

lib/request/basic.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,12 +209,11 @@ def decodePage(page, contentEncoding, contentType):
209209
return page
210210

211211
def processResponse(page, responseHeaders):
212-
parseResponse(page, responseHeaders)
212+
if not kb.dumpMode:
213+
parseResponse(page, responseHeaders)
213214

214215
if conf.parseErrors:
215216
msg = extractErrorMessage(page)
216217

217218
if msg:
218219
logger.info("parsed error message: '%s'" % msg)
219-
220-
return page

lib/request/connect.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ def getPage(**kwargs):
419419
else:
420420
debugMsg = "got HTTP error code: %d (%s)" % (code, status)
421421
logger.debug(debugMsg)
422-
page = processResponse(page, responseHeaders)
422+
processResponse(page, responseHeaders)
423423
return page, responseHeaders
424424

425425
except (urllib2.URLError, socket.error, socket.timeout, httplib.BadStatusLine, httplib.IncompleteRead), e:
@@ -465,7 +465,7 @@ def getPage(**kwargs):
465465
finally:
466466
socket.setdefaulttimeout(conf.timeout)
467467

468-
page = processResponse(page, responseHeaders)
468+
processResponse(page, responseHeaders)
469469

470470
responseMsg += "[#%d] (%d %s):\n" % (threadData.lastRequestUID, code, status)
471471
if responseHeaders:

plugins/generic/enumeration.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1549,6 +1549,8 @@ def dumpTable(self, foundData=None):
15491549
kb.data.cachedColumns = foundData
15501550

15511551
try:
1552+
kb.dumpMode = True
1553+
15521554
if not safeSQLIdentificatorNaming(conf.db) in kb.data.cachedColumns \
15531555
or safeSQLIdentificatorNaming(tbl, True) not in \
15541556
kb.data.cachedColumns[safeSQLIdentificatorNaming(conf.db)] \
@@ -1768,6 +1770,9 @@ def dumpTable(self, foundData=None):
17681770
errMsg += "'%s'" % e
17691771
logger.critical(errMsg)
17701772

1773+
finally:
1774+
kb.dumpMode = False
1775+
17711776
def dumpAll(self):
17721777
if conf.db is not None and conf.tbl is None:
17731778
self.dumpTable()

0 commit comments

Comments
 (0)