2

I am working on some kind of Exitnode Scanner (Like SoaT from Mike Perry). I have downloaded the list of all running Exitnode-IPs and I want to use each IP to build a 3-hop-circuit (or connect directly to it, using 1-hop) with this specific IP. Fetch some data from a website and use the next IP in the list to do the same.

I am mostly using Python for this. I use the stem module to get a new identity:

def newc():
    with Controller.from_port(port = 9051) as controller:
        controller.authenticate(PASSWORD)
        controller.signal(Signal.NEWNYM)

Is there a way to make sure it connects through all exits (no duplicate) using stem? Adding all IPs to the torrc does not relay solve the problem, I guess.

Or (maybe easier) can I use e.g. proxychains to connect to this one node (IP) and fetch a webpage using bash? My start looks like this:

proxychains wget ARGS -O PATH URL

Thank you very much and have a nice day =)

Edit: So I found 2 possible ways, both not working at the moment. One is using the "ExcludeExitNode" option in the torrc. I tried starting tor with "launch_tor_with_config" but I will get an error stating that Tor is already running. If I kill Tor, I get no such response anymore. To workaround this problem, I edit the torrc file and add one line (adding one IP at the end for every iteration). Sending the HUP signal (to make tor reload its config) results in 'received empty socks content'. Any ideas to resolve this?

The 2nd option was going with the .exit (dotexit) address. It tells Tor to use this specific exit node for a chain. Problem here is that Tor needs to resolve it with its own DNS-Server (not the one that my system uses), which I couldn't configure. So I stepped away from this idea as well.

2

This already exists as ExitMap.

It's approach is to launch it's own copy of Tor which is configured not to automatically attach streams to existing circuits through use of the __LeaveStreamsUnattached option, then use stem to build custom circuits, one to each of the suitable exits and attach the streams to the circuits.

I'm not sure where you're getting your "list of all running Exitnode-IPs" but I think you're approaching the problem incorrectly. You wouldn't work with IPs, you would use their fingerprint.


Since you won't read the ExitMap source-code, I'll read the ExitMap source-code to you. Consultancy fees may apply*.

stem.control.Controller.new_circuit allows you to build a circuit consisting of custom set of "hops", where hops is an array/list (whatever python calls it) of fingerprints. This returns a Circuit ID. You then later use callbacks from catching new stream events from your setup stem.control.Controller.add_event_listener listening for stem.response.events.StreamEvent to call stem.control.Controller.attach_stream with the previously obtained Circuit ID and the newly obtained Stream ID from the stem.response.events.StreamEvent, resulting in attaching your stream (TCP connection) to the appropriate circuit.

Take great care when selecting exits, not all exits exit all traffic, not all exits have the exit flag. You will need to know what IP and port you intend to exit to before knowing which exits are suitable.


*Consultancy fees are imaginary. Property is theft, intellectual property is double theft, knowledge is power. Read the source-code next time. ;)

  • 1
    Thanks for the reply (sry i didnt reply earlier). Having an already programmed piece of software does not solve my problem. The part where you write "use stem to build custom circuits" would be the intereseting one for me. I can use the IP for some cases, allthough the fingerprint would be more unique, thats true. – Daniel H. Aug 22 '16 at 8:05
  • 1
    You can have two relays on a single IP, the fingerprint is the only correct way to do it. – cacahuatl Aug 22 '16 at 8:59
  • 1
    Is there a way to get the fingerprints of all realys automatically? – Daniel H. Aug 22 '16 at 9:04
  • 1
    See my updated answer. – cacahuatl Aug 22 '16 at 9:43
  • 1
    And yes, the consensus has the list of all relays fingerprints, thats how you build circuits. See the stem tutorial. – cacahuatl Aug 22 '16 at 9:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.