Advertisement
Guest User

Untitled

a guest
Jul 3rd, 2015
326
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.62 KB | None | 0 0
  1. import pycurl
  2. import stem.process
  3.  
  4. SOCKS_PORT = 9150
  5.  
  6. print("Starting Tor:\n")
  7.  
  8. def print_bootstrap_lines(line):
  9.   if "Bootstrapped " in line:
  10.     print(line)
  11.  
  12. tor_process = stem.process.launch_tor_with_config(
  13.   config = {
  14.     'SocksPort': str(SOCKS_PORT),
  15.     #'ExitNodes': '{ru}',
  16.   },
  17.   init_msg_handler = print_bootstrap_lines,
  18. )
  19.  
  20. curl = pycurl.Curl()
  21. curl.setopt( pycurl.URL, 'http://www.priler.com/ip.php' )
  22. curl.setopt( pycurl.PROXY, 'localhost' )
  23. curl.setopt( pycurl.PROXYPORT, SOCKS_PORT )
  24. curl.setopt( pycurl.PROXYTYPE, pycurl.PROXYTYPE_SOCKS5 )
  25.  
  26. curl.perform()
  27.  
  28. tor_process.kill()  # stops tor
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement