![]() |
|
Tutorial Mask your IP using Tor requests! - Printable Version +- Sinisterly (https://sinister.ly) +-- Forum: Coding (https://sinister.ly/Forum-Coding) +--- Forum: Python (https://sinister.ly/Forum-Python) +--- Thread: Tutorial Mask your IP using Tor requests! (/Thread-Tutorial-Mask-your-IP-using-Tor-requests) |
Mask your IP using Tor requests! - Oblivious - 10-25-2017 Code: import requests, stem, stem.control, time
'''
You need Tor open for this to work
Once you've downloaded tor head over to torrc and open it with your favorite text editor
Enter this: ControlPort 9051
'''
IPAddress = ""
def GetIP():
global IPAddress
# Changes IP
tor = stem.control.Controller.from_port(port = 9051)
tor.authenticate(password="password"); tor.signal(stem.Signal.NEWNYM)
# Checks IP
response = requests.get('http://httpbin.org/ip',
proxies= {'http': 'socks5://127.0.0.1:9150', 'https': 'socks5://127.0.0.1:9150'})
CurrentIP = response.json()["origin"]
if IPAddress != CurrentIP:
IPAddress = CurrentIP
print IPAddress
else:
time.sleep(5)
while True:
GetIP()RE: Mask your IP using Tor requests! - Bish0pQ - 10-26-2017 Thank you for this, I'll be trying out if this works but the code seems fine at first sight. RE: Mask your IP using Tor requests! - Oblivious - 10-26-2017 (10-26-2017, 07:54 AM)Bish0pQ Wrote: Thank you for this, I'll be trying out if this works but the code seems fine at first sight. No problem! Let me know if you run into any problems I'll be willing to help RE: Mask your IP using Tor requests! - adnankatman - 10-29-2017 Interesting! Is there a way to embed the tor browser / protocol completely within the python application? RE: Mask your IP using Tor requests! - Oblivious - 11-01-2017 (10-29-2017, 10:45 AM)adnankatman Wrote: Interesting! Is there a way to embed the tor browser / protocol completely within the python application? This could be possible but you would need to figure out how to run the tor node without launching tor browser itself. I'll look more into this when I get a chance and update the code if I find anything new enjoy !
RE: Mask your IP using Tor requests! - obnoxious - 07-18-2018 (11-01-2017, 01:41 AM)Oblivious Wrote:You could install privoxy and set that up with tor, then change the proxy settings inside the python script so it runs through privoxy. I've done this on my Linux box but not sure how it works on Windows.(10-29-2017, 10:45 AM)adnankatman Wrote: Interesting! Is there a way to embed the tor browser / protocol completely within the python application?This could be possible but you would need to figure out how to run the tor node without launching tor browser itself. RE: Mask your IP using Tor requests! - Motherboard - 08-22-2018 Clean Code, but I have a question. when authenticating the stem control via the tor variable; What are you exactly authenticating here using the password 'password'? I've read that the object gives you an unauthenticated controller, but I still don't understand what does authentication here stand for? Is it an actual authentication just like a handshake with the TOR node or a validation for the Controller you are using? Thanks
|