mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-25 19:13:48 +03:00
minor update (optimization) regarding -a switch
This commit is contained in:
parent
857a2a4521
commit
8d93bdfa4b
|
@ -31,6 +31,7 @@ from lib.core.common import parseTargetDirect
|
||||||
from lib.core.common import parseTargetUrl
|
from lib.core.common import parseTargetUrl
|
||||||
from lib.core.common import paths
|
from lib.core.common import paths
|
||||||
from lib.core.common import randomRange
|
from lib.core.common import randomRange
|
||||||
|
from lib.core.common import readCachedFileContent
|
||||||
from lib.core.common import readInput
|
from lib.core.common import readInput
|
||||||
from lib.core.common import runningAsAdmin
|
from lib.core.common import runningAsAdmin
|
||||||
from lib.core.common import sanitizeStr
|
from lib.core.common import sanitizeStr
|
||||||
|
@ -835,7 +836,6 @@ def __setHTTPUserAgent():
|
||||||
* A random value read from a list of User-Agent headers from a
|
* A random value read from a list of User-Agent headers from a
|
||||||
file choosed as user option
|
file choosed as user option
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if conf.agent:
|
if conf.agent:
|
||||||
debugMsg = "setting the HTTP User-Agent header"
|
debugMsg = "setting the HTTP User-Agent header"
|
||||||
logger.debug(debugMsg)
|
logger.debug(debugMsg)
|
||||||
|
@ -856,12 +856,13 @@ def __setHTTPUserAgent():
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
debugMsg = "fetching random HTTP User-Agent header from "
|
if not kb.userAgents:
|
||||||
|
debugMsg = "loading random HTTP User-Agent header(s) from "
|
||||||
debugMsg += "file '%s'" % conf.userAgentsFile
|
debugMsg += "file '%s'" % conf.userAgentsFile
|
||||||
logger.debug(debugMsg)
|
logger.debug(debugMsg)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
fd = codecs.open(conf.userAgentsFile, "r", conf.dataEncoding)
|
kb.userAgents = getFileItems(conf.userAgentsFile)
|
||||||
except IOError:
|
except IOError:
|
||||||
warnMsg = "unable to read HTTP User-Agent header "
|
warnMsg = "unable to read HTTP User-Agent header "
|
||||||
warnMsg += "file '%s'" % conf.userAgentsFile
|
warnMsg += "file '%s'" % conf.userAgentsFile
|
||||||
|
@ -871,24 +872,12 @@ def __setHTTPUserAgent():
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
__count = 0
|
__count = len(kb.userAgents)
|
||||||
__userAgents = []
|
|
||||||
|
|
||||||
while True:
|
|
||||||
line = fd.readline()
|
|
||||||
|
|
||||||
if not line:
|
|
||||||
break
|
|
||||||
|
|
||||||
__userAgents.append(line)
|
|
||||||
__count += 1
|
|
||||||
|
|
||||||
fd.close()
|
|
||||||
|
|
||||||
if __count == 1:
|
if __count == 1:
|
||||||
__userAgent = __userAgents[0]
|
__userAgent = kb.userAgents[0]
|
||||||
else:
|
else:
|
||||||
__userAgent = __userAgents[randomRange(stop=__count)]
|
__userAgent = kb.userAgents[randomRange(stop=__count)]
|
||||||
|
|
||||||
__userAgent = sanitizeStr(__userAgent)
|
__userAgent = sanitizeStr(__userAgent)
|
||||||
conf.httpHeaders.append(("User-Agent", __userAgent))
|
conf.httpHeaders.append(("User-Agent", __userAgent))
|
||||||
|
@ -1114,6 +1103,7 @@ def __setKnowledgeBaseAttributes():
|
||||||
kb.unionPosition = None
|
kb.unionPosition = None
|
||||||
kb.unionNegative = False
|
kb.unionNegative = False
|
||||||
kb.unionFalseCond = False
|
kb.unionFalseCond = False
|
||||||
|
kb.userAgents = None
|
||||||
kb.valueStack = []
|
kb.valueStack = []
|
||||||
|
|
||||||
def __saveCmdline():
|
def __saveCmdline():
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
# Copyright (c) 2006-2010 sqlmap developers (http://sqlmap.sourceforge.net/)
|
||||||
|
# See the file 'doc/COPYING' for copying permission
|
||||||
|
|
||||||
Accoona-AI-Agent/1.1.2 (aicrawler at accoonabot dot com)
|
Accoona-AI-Agent/1.1.2 (aicrawler at accoonabot dot com)
|
||||||
Baiduspider ( http://www.baidu.com/search/spider.htm)
|
Baiduspider ( http://www.baidu.com/search/spider.htm)
|
||||||
curl/7.13.1 (powerpc-apple-darwin8.0) libcurl/7.13.1 OpenSSL/0.9.7b zlib/1.2.2
|
curl/7.13.1 (powerpc-apple-darwin8.0) libcurl/7.13.1 OpenSSL/0.9.7b zlib/1.2.2
|
||||||
|
|
Loading…
Reference in New Issue
Block a user