Skip to content

joangq/torpy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Torpy is a custom library for anonymizing HTTP requests using Tor as a proxy. It provides methods similar to the ones found in the requests package. The Onion class is actually a wrapper for the requests.Session object.

Requirements:

  • Linux based OS
  • Tor installed as service: It can be installed by running the following command in Linux
sudo apt-get install tor
  • requests package with Sockets installed too. You can get it by:
pip install requests[socks]
  • All the libraries in src/tor.py
  • Tested in Python 3.8

Example usage

import tor

# Initialize Onion service
onion = tor.Onion()

# Get TOR session IP
print(onion.get_ip())
# >>> 123.456.78.12 [Example IP, returns actual TOR session IP]

# Make a HTTP GET request to a custom URL
request = onion.get('https://www.wikipedia.org')
print(request.text)
# >>> [The webpage as text]

# Get new identity
onion.renew_identity()
print(onion.get_ip())
# >>> 255.123.45.67 [Example IP, should return a different valid TOR session IP]

About

Anonymize HTTP requests using Tor & Python.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published