MCPcopy Index your code
hub / github.com/sqlmapproject/sqlmap / fetchRandomAgent

Function fetchRandomAgent

lib/core/common.py:3931–3951  ·  view source on GitHub ↗

Returns random HTTP User-Agent header value >>> '(' in fetchRandomAgent() True

()

Source from the content-addressed store, hash-verified

3929 return retVal
3930
3931def fetchRandomAgent():
3932 """
3933 Returns random HTTP User-Agent header value
3934
3935 >>> '(' in fetchRandomAgent()
3936 True
3937 """
3938
3939 if not kb.userAgents:
3940 debugMsg = "loading random HTTP User-Agent header(s) from "
3941 debugMsg += "file '%s'" % paths.USER_AGENTS
3942 logger.debug(debugMsg)
3943
3944 try:
3945 kb.userAgents = getFileItems(paths.USER_AGENTS)
3946 except IOError:
3947 errMsg = "unable to read HTTP User-Agent header "
3948 errMsg += "file '%s'" % paths.USER_AGENTS
3949 raise SqlmapSystemException(errMsg)
3950
3951 return random.sample(kb.userAgents, 1)[0]
3952
3953def createGithubIssue(errMsg, excMsg):
3954 """

Callers 3

_setHTTPUserAgentFunction · 0.90
getLatestRevisionFunction · 0.85
createGithubIssueFunction · 0.85

Calls 3

getFileItemsFunction · 0.85
debugMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…