Author Topic: [Python] newid.py - change tor exit node  (Read 1645 times)

0 Members and 1 Guest are viewing this topic.

Offline frog

  • Knight
  • **
  • Posts: 232
  • Cookies: 16
    • View Profile
[Python] newid.py - change tor exit node
« on: February 21, 2014, 08:03:28 am »
If you haven't read my last post about using the tor control port to change your exit node, you probably should. http://evilzone.org/anonymity/tor-control-port-self-renewing-proxy/msg76590/#msg76590

Here is a script that will automate 'exit node renewal'. There is a limit regarding how often you can renew your node. It is about 5 seconds, because the tor daemon is hard coded that way. I want to grab domain info such as location, organization so you know a little bit more about who you are connecting to. For now, I have the renewal function and an IP check.

Side note: I did a few whois lookups on some tor nodes and the results were interesting..
Kaspersky Romania, MIT, a university in Berlin; it's safe to assume that they are looking at their packet dumps.

Code: (Python) [Select]
import telnetlib, pycurl, cStringIO

torHost = "localhost"
torControlPort = 9051
torPort = 9050

def main():
    print """
        newid.py - change tor exit node
            by frog       (ribit)
                             /   
                    o  o       
                   ( -- )       
                /\( ,   ,)/\   
              ^^   ^^  ^^   ^^ 
    """

    telnet = telnetlib.Telnet(torHost, torControlPort)
    telnet.set_debuglevel(0)
    telnet.write('authenticate ""' + "\n")
    telnet.read_until("250 OK")
    telnet.write("signal newnym" + "\n")
    telnet.read_until("250 OK")
    telnet.write("quit")
   
    print "[+] Changed exit node"
    print "[-] Retrieving exit node information.."
   
    response = cStringIO.StringIO()   
   
    http = pycurl.Curl()
    http.setopt(pycurl.URL, "http://ipchicken.com")
    http.setopt(pycurl.WRITEFUNCTION, response.write)
    http.setopt(pycurl.PROXY, torHost)
    http.setopt(pycurl.PROXYPORT, torPort)
    http.setopt(pycurl.PROXYTYPE, pycurl.PROXYTYPE_SOCKS5)
    http.perform()

    output = response.getvalue()
    output = output[output.find('<font face="Verdana, Arial, Helvetica, sans-serif" size="5" color="#0000FF"><b>'):
    output.find('<A HREF="javascript:makeLink()"><font size="2">')]
    output = output.strip('font face="Verdana, Arial, Helvetica, sans-serif" size="5" color="#0000FF"><b>')
    output = output.strip()
    output = output.strip('<br>')
   
    print "[!] Exit node address: " + output

if __name__ == "__main__":
    main()
« Last Edit: February 21, 2014, 08:18:56 am by frog »

Offline proxx

  • Avatarception
  • Global Moderator
  • Titan
  • *
  • Posts: 2803
  • Cookies: 256
  • ФФФ
    • View Profile
Re: [Python] newid.py - change tor exit node
« Reply #1 on: February 21, 2014, 10:37:02 am »
Loving it :)

Thanks mr frog.

Wtf where you thinking with that signature? - Phage.
This was another little experiment *evillaughter - Proxx.
Evilception... - Phage

Offline frog

  • Knight
  • **
  • Posts: 232
  • Cookies: 16
    • View Profile
Re: [Python] newid.py - change tor exit node
« Reply #2 on: February 21, 2014, 12:19:37 pm »
Loving it :)

Thanks mr frog.
You're very welcome