Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e826c14

Browse files
committed
Merge branch 'master' of github.com:sqlmapproject/sqlmap
2 parents d066fa6 + 0eff977 commit e826c14

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

lib/core/option.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -876,13 +876,13 @@ def __setHTTPProxy():
876876

877877
return
878878

879-
debugMsg = "setting the %s proxy to pass by all HTTP requests" % ("SOCKS" if "socks" in conf.proxy else "HTTP")
879+
debugMsg = "setting the HTTP/SOCKS proxy to pass by all HTTP requests"
880880
logger.debug(debugMsg)
881881

882882
proxySplit = urlparse.urlsplit(conf.proxy)
883883
hostnamePort = proxySplit[1].split(":")
884884

885-
scheme = proxySplit[0].lower()
885+
scheme = proxySplit[0].upper()
886886
hostname = hostnamePort[0]
887887
port = None
888888
username = None
@@ -894,8 +894,8 @@ def __setHTTPProxy():
894894
except:
895895
pass #drops into the next check block
896896

897-
if not all((scheme, hostname, port)):
898-
errMsg = "proxy value must be in format '(http|socks|socks4|socks5)://url:port'"
897+
if not all((scheme, hasattr(PROXYTYPE, scheme), hostname, port)):
898+
errMsg = "proxy value must be in format '(%s)://url:port'" % "|".join(_[0].lower() for _ in getPublicTypeMembers(PROXYTYPE))
899899
raise sqlmapSyntaxException, errMsg
900900

901901
if conf.pCred:
@@ -908,8 +908,8 @@ def __setHTTPProxy():
908908
username = _.group(1)
909909
password = _.group(2)
910910

911-
if "socks" in scheme:
912-
socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5 if "4" not in scheme else socks.PROXY_TYPE_SOCKS4, hostname, port, username=username, password=password)
911+
if scheme in (PROXYTYPE.SOCKS4, PROXYTYPE.SOCKS5):
912+
socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5 if scheme == PROXYTYPE.SOCKS5 else socks.PROXY_TYPE_SOCKS4, hostname, port, username=username, password=password)
913913
socks.wrapmodule(urllib2)
914914
else:
915915
if conf.pCred:

0 commit comments

Comments
 (0)