Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pycurl
- import stem.process
- import io
- SOCKS_PORT = 9150
- print("Starting Tor:\n")
- def print_bootstrap_lines(line):
- if "Bootstrapped " in line:
- print(line)
- tor_process = stem.process.launch_tor_with_config(
- config = {
- 'SocksPort': str(SOCKS_PORT),
- #'ExitNodes': '{ru}',
- },
- init_msg_handler = print_bootstrap_lines,
- )
- output = io.BytesIO()
- curl = pycurl.Curl()
- curl.setopt( pycurl.URL, 'http://www.priler.com/ip.php' )
- curl.setopt( pycurl.PROXY, 'localhost' )
- curl.setopt( pycurl.PROXYPORT, SOCKS_PORT )
- curl.setopt( pycurl.PROXYTYPE, pycurl.PROXYTYPE_SOCKS5 )
- curl.setopt( pycurl.WRITEFUNCTION, output.write)
- curl.perform()
- print("RESULT : " + output.getvalue().decode('ascii'))
- #print("RESULT : " + output.getvalue())
- tor_process.kill() # stops tor
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement