adding --random-agent and removing -a

This commit is contained in:
Miroslav Stampar
2011-02-02 14:51:12 +00:00
parent 2dae57a56d
commit 5f49e20cc8
4 changed files with 14 additions and 16 deletions

View File

@@ -981,7 +981,7 @@ def __setHTTPUserAgent():
conf.httpHeaders.append(("User-Agent", conf.agent))
return
if not conf.userAgentsFile:
if not conf.randomAgent:
addDefaultUserAgent = True
for header, _ in conf.httpHeaders:
@@ -996,14 +996,14 @@ def __setHTTPUserAgent():
if not kb.userAgents:
debugMsg = "loading random HTTP User-Agent header(s) from "
debugMsg += "file '%s'" % conf.userAgentsFile
debugMsg += "file '%s'" % paths.USER_AGENTS
logger.debug(debugMsg)
try:
kb.userAgents = getFileItems(conf.userAgentsFile)
kb.userAgents = getFileItems(paths.USER_AGENTS)
except IOError:
warnMsg = "unable to read HTTP User-Agent header "
warnMsg += "file '%s'" % conf.userAgentsFile
warnMsg += "file '%s'" % paths.USER_AGENTS
logger.warn(warnMsg)
conf.httpHeaders.append(("User-Agent", __defaultHTTPUserAgent()))
@@ -1021,7 +1021,7 @@ def __setHTTPUserAgent():
conf.httpHeaders.append(("User-Agent", __userAgent))
logMsg = "fetched random HTTP User-Agent header from "
logMsg += "file '%s': %s" % (conf.userAgentsFile, __userAgent)
logMsg += "file '%s': %s" % (paths.USER_AGENTS, __userAgent)
logger.info(logMsg)
def __setHTTPReferer():
@@ -1129,9 +1129,6 @@ def __cleanupOptions():
conf.nullConnection = not conf.textOnly
conf.threads = 4 if conf.threads < 4 else conf.threads
if conf.realTest:
conf.userAgentsFile = paths.USER_AGENTS
def __setConfAttributes():
"""
This function set some needed attributes into the configuration