mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-29 04:53:48 +03:00
added option --proxy-cred for setting proxy credentials (Feature #195)
This commit is contained in:
parent
526aebc84c
commit
8aa12db425
|
@ -578,6 +578,17 @@ def __setHTTPProxy():
|
|||
errMsg = "proxy value must be in format 'http://url:port'"
|
||||
raise sqlmapSyntaxException, errMsg
|
||||
|
||||
if conf.pCred:
|
||||
pCredRegExp = re.search("^(.*?):(.*?)$", conf.pCred)
|
||||
|
||||
if not pCredRegExp:
|
||||
errMsg = "Proxy authentication credentials "
|
||||
errMsg += "value must be in format username:password"
|
||||
raise sqlmapSyntaxException, errMsg
|
||||
|
||||
# Reference: http://stackoverflow.com/questions/34079/how-to-specify-an-authenticated-proxy-for-a-python-http-connection
|
||||
__proxyString = "%s@%s:%d" % (conf.pCred, __hostname, __port)
|
||||
else:
|
||||
__proxyString = "%s:%d" % (__hostname, __port)
|
||||
|
||||
# Workaround for http://bugs.python.org/issue1424152 (urllib/urllib2:
|
||||
|
|
|
@ -51,6 +51,7 @@ optDict = {
|
|||
"aCert": "string",
|
||||
"keepAlive": "boolean",
|
||||
"proxy": "string",
|
||||
"pCred": "string",
|
||||
"ignoreProxy": "boolean",
|
||||
"threads": "integer",
|
||||
"delay": "float",
|
||||
|
|
|
@ -119,6 +119,10 @@ def cmdLineParser():
|
|||
request.add_option("--proxy", dest="proxy",
|
||||
help="Use a HTTP proxy to connect to the target url")
|
||||
|
||||
request.add_option("--proxy-cred", dest="pCred",
|
||||
help="Proxy authentication credentials "
|
||||
"(name:password)")
|
||||
|
||||
request.add_option("--ignore-proxy", dest="ignoreProxy",
|
||||
action="store_true",
|
||||
help="Ignore system default HTTP proxy")
|
||||
|
|
Loading…
Reference in New Issue
Block a user