More generic implementation for --proxy-file (accepting public lists format)

This commit is contained in:
Miroslav Stampar 2014-04-06 17:23:13 +02:00
parent 36a590e085
commit 1c92d8d51f

View File

@ -47,6 +47,7 @@ from lib.core.common import parseTargetUrl
from lib.core.common import paths from lib.core.common import paths
from lib.core.common import randomRange from lib.core.common import randomRange
from lib.core.common import randomStr from lib.core.common import randomStr
from lib.core.common import readCachedFileContent
from lib.core.common import readInput from lib.core.common import readInput
from lib.core.common import resetCookieJar from lib.core.common import resetCookieJar
from lib.core.common import runningAsAdmin from lib.core.common import runningAsAdmin
@ -1947,7 +1948,10 @@ def _setProxyList():
if not conf.proxyFile: if not conf.proxyFile:
return return
conf.proxyList = getFileItems(conf.proxyFile) conf.proxyList = []
for match in re.finditer(r"(?i)((http[^:]*|socks[^:]*)://)?([\w.]+):(\d+)", readCachedFileContent(conf.proxyFile)):
_, type_, address, port = match.groups()
conf.proxyList.append("%s://%s:%s" % (type_ or "http", address, port))
def _setTorProxySettings(): def _setTorProxySettings():
if not conf.tor: if not conf.tor: