File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -578,7 +578,18 @@ def __setHTTPProxy():
578578 errMsg = "proxy value must be in format 'http://url:port'"
579579 raise sqlmapSyntaxException , errMsg
580580
581- __proxyString = "%s:%d" % (__hostname , __port )
581+ if conf .pCred :
582+ pCredRegExp = re .search ("^(.*?):(.*?)$" , conf .pCred )
583+
584+ if not pCredRegExp :
585+ errMsg = "Proxy authentication credentials "
586+ errMsg += "value must be in format username:password"
587+ raise sqlmapSyntaxException , errMsg
588+
589+ # Reference: http://stackoverflow.com/questions/34079/how-to-specify-an-authenticated-proxy-for-a-python-http-connection
590+ __proxyString = "%s@%s:%d" % (conf .pCred , __hostname , __port )
591+ else :
592+ __proxyString = "%s:%d" % (__hostname , __port )
582593
583594 # Workaround for http://bugs.python.org/issue1424152 (urllib/urllib2:
584595 # HTTPS over (Squid) Proxy fails) as long as HTTP over SSL requests
Original file line number Diff line number Diff line change 5151 "aCert" : "string" ,
5252 "keepAlive" : "boolean" ,
5353 "proxy" : "string" ,
54+ "pCred" : "string" ,
5455 "ignoreProxy" : "boolean" ,
5556 "threads" : "integer" ,
5657 "delay" : "float" ,
Original file line number Diff line number Diff line change @@ -119,6 +119,10 @@ def cmdLineParser():
119119 request .add_option ("--proxy" , dest = "proxy" ,
120120 help = "Use a HTTP proxy to connect to the target url" )
121121
122+ request .add_option ("--proxy-cred" , dest = "pCred" ,
123+ help = "Proxy authentication credentials "
124+ "(name:password)" )
125+
122126 request .add_option ("--ignore-proxy" , dest = "ignoreProxy" ,
123127 action = "store_true" ,
124128 help = "Ignore system default HTTP proxy" )
You can’t perform that action at this time.
0 commit comments