Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- setup:
- pip install requests
- pip install requests[socks]
- super helpful:
- - http://packetforger.wordpress.com/2013/08/27/pythons-requests-module-with-socks-support-requesocks/
- - http://docs.python-requests.org/en/master/user/advanced/#proxies
- *** For Termux ***
- 1- Tor Should be Installed
- apt install tor
- 2- Tor Service must be opened
- tor
- 3- install requirements
- pip install requests
- pip install requests[socks]
- 4 - change the port in the tool from 9150 to 9050
- 5 - RUN :)
- """
- import requests
- # Define proxies for tor
- proxies = {
- 'http': 'socks5://127.0.0.1:9050',
- 'https': 'socks5://127.0.0.1:9050'
- }
- # Define User-Agent
- headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36'}
- def main():
- url = 'http://ifconfig.me/ip'
- response = requests.get(url)
- print('ip: {}'.format(response.text.strip()))
- response = requests.get(url, headers=headers, proxies=proxies)
- print('tor ip: {}'.format(response.text.strip()))
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment