Open JonhSilver opened 7 years ago
proxychains4 does a decent job at this too.
So please to show how use Sublist3r throught tor
I'm using tor for search with google.
This is old code:
class enumratorBase(object):
def send_req(self, query, page_no=1):
headers = {
'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:38.0) Gecko/20100101 Firefox/38.0',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Language': 'en-GB,en;q=0.5',
'Accept-Encoding': 'gzip, deflate',
'Connection': 'keep-alive',
}
url = self.base_url.format(query=query, page_no=page_no)
try:
resp = self.session.get(url, headers=headers, timeout=self.timeout)
except Exception:
resp = None
return self.get_response(resp)
This is new code
def send_req(self, query, page_no=1):
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 5.1; rv:39.0) Gecko/20100101 Firefox/39.0',
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Accept-Language": "en-US,en;q=0.5",
"Accept-Encoding": "gzip, deflate",
'Connection': 'keep-alive'
}
local_proxy = "socks5://127.0.0.1:9050"
proxies = {
"http": local_proxy,
"https": local_proxy,
"ftp": local_proxy
}
url = self.base_url.format(query=query, page_no=page_no)
# print url
try:
if self.engine_name == "Google":
set_new_ip()
time.sleep(10)
# Get my ip
url = "http://icanhazip.com/"
s = requests.Session()
headers = {'content-type': 'application/json'}
req = requests.Request('GET', url, headers=headers)
prepped = s.prepare_request(req)
resp = s.send(prepped, verify=False, proxies=proxies, timeout=25)
if resp.status_code == 200:
print "Search google with ip {0}".format(resp.text)
s = requests.Session()
headers = {'content-type': 'application/json'}
req = requests.Request('GET', url, headers=headers)
prepped = s.prepare_request(req)
resp = s.send(prepped, verify=True, proxies=proxies, timeout=25)
else:
resp = self.session.get(url, headers=headers, timeout=self.timeout)
except Exception, ex:
resp = None
return self.get_response(resp)
With set_new_ip function in http://stackoverflow.com/questions/9887505/how-to-change-tor-identity-in-python
Can your program use Tor or Proxy? Can you make it working? take allready working script from sqlmap )))