EvilZone

Programming and Scripting => Scripting Languages => : frog February 21, 2014, 08:03:28 AM

: [Python] newid.py - change tor exit node
: frog 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.

: (Python)
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()
: Re: [Python] newid.py - change tor exit node
: proxx February 21, 2014, 10:37:02 AM
Loving it :)

Thanks mr frog.

: Re: [Python] newid.py - change tor exit node
: frog February 21, 2014, 12:19:37 PM
Loving it :)

Thanks mr frog.
You're very welcome