Hi, I am new here. Thanks in advance for your help. I have 2 questions. The first one is
1) When I want to change my identity, do I just need to create a new NetLayer? as in:
NetLayer lowerNetLayer = NetFactory.getInstance().getNetLayerById( NetLayerIDs.TOR);
2) Can I have multiple threads running with different identities? And if not, can I have multiple processes in the same machine running with different identities?
Thanks
Kiko
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
usually if you are connecting to the same site, the same Circuit will be used till it is not usable or safe to use anymore.
You can force to get a new identity by casting the NetLayer you get from NetFactory to TorNetLayer and then call method changeIdentity. This will close all open Circuits and build up new ones, usually you will get a new exit point. (It can be that you will get the same again)
hope this helps,
regards Tobi
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Were you able to run different IP using multithreading? I have a doubt about how to change the IP address for only that thread and not the entire network. From what I understand changeIdentity closes all the open circuits, however I just want to close the particular circuit that thread is connected to. Please let me know.
Thanks,
Vinit
Last edit: Vinit Parakh 2015-09-21
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
currently it is not possible to influence the public IP at this level.
As a workaround you could use the URL or IP you want to access + ".xxxxxx.exit" whereas x equals the digest of an exit node. This forces the underlying Tor implementation to only use this exit node. So in theory if this exit nodes is not busy with other requests you will be able to control your public IP.
You can get a valid List of Exitnodes by using the method getValidTorRouters from TorNetLayer with a check on the Router.isExitNode you can easily check if it is a working exitnode, but you cannot see its current usage or availability.
regards Tobi
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Also, I tried running TOR using multiple java processes (JVM). Whenever I called lowerNetLayer.clear() it only gave me a new IP address for the particular process. I do not understand why the behavior changes when I am using multiple threads from the same process. In this case when I call lowerNetLayer.clear() it closes all the circuits for all the threads and establishes new ones.
Basically my use case just needs a new IP address for that thread to retry the same server that I am trying to hit.
Thanks,
Vinit
Last edit: Vinit Parakh 2015-09-21
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
there is a "Tor-Connection-Manager" implemented as Singleton, this "Manager" is deciding which established route will be used for data. The NetLayer itself is just using the established Tor-Routes when needed. So if you execute clear this will be executed on the whole TorNetLayer and therefore also for the Tor-Connection-Manager.
Thats why you will see a different behaviour if you start a new JVM. (new JVM -> new "Tor-Manager" instance)
hope this clarifies it a bit.
In your other Post about using the exit hashes, option 1 would be what you need to use.
Only the parts between ":" and "/" will be treated as hostnames.
regards Tobi
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi, I am new here. Thanks in advance for your help. I have 2 questions. The first one is
1) When I want to change my identity, do I just need to create a new NetLayer? as in:
NetLayer lowerNetLayer = NetFactory.getInstance().getNetLayerById( NetLayerIDs.TOR);
2) Can I have multiple threads running with different identities? And if not, can I have multiple processes in the same machine running with different identities?
Thanks
Kiko
Hi Kiko,
usually if you are connecting to the same site, the same Circuit will be used till it is not usable or safe to use anymore.
You can force to get a new identity by casting the NetLayer you get from NetFactory to TorNetLayer and then call method changeIdentity. This will close all open Circuits and build up new ones, usually you will get a new exit point. (It can be that you will get the same again)
hope this helps,
regards Tobi
Thank you Tobias
Like this? (posting the code for the benefit of others)
NetLayer lowerNetLayer = NetFactory.getInstance().getNetLayerById( NetLayerIDs.TOR);
Can I run multiple threads with different circuits in each thread? And if not, can I run them with different circuits in multiple processes (JVMs)?
Thanks again and have a great weekend
Kiko
Hello Kaii,
Were you able to run different IP using multithreading? I have a doubt about how to change the IP address for only that thread and not the entire network. From what I understand changeIdentity closes all the open circuits, however I just want to close the particular circuit that thread is connected to. Please let me know.
Thanks,
Vinit
Last edit: Vinit Parakh 2015-09-21
Hi,
currently it is not possible to influence the public IP at this level.
As a workaround you could use the URL or IP you want to access + ".xxxxxx.exit" whereas x equals the digest of an exit node. This forces the underlying Tor implementation to only use this exit node. So in theory if this exit nodes is not busy with other requests you will be able to control your public IP.
You can check the following UnitTest for an example : TorExitHostnameRemoteTest.java
You can get a valid List of Exitnodes by using the method getValidTorRouters from TorNetLayer with a check on the Router.isExitNode you can easily check if it is a working exitnode, but you cannot see its current usage or availability.
regards Tobi
Hi Tobi,
I am using router.getFingerprint().getHex() to get the digest. Can you please tell me does it matter if I use it(the "/" after bestbuy.com) :
1. http://www.bestbuy.com.506763994792208999529D03C016774C814386A8.exit
2. http://www.bestbuy.com/.506763994792208999529D03C016774C814386A8.exit
Once I have the url I am using the execute_HTTP_GET_with_Adapter_URL() example. Is this the right way of doing it?
Thanks,
Vinit
Last edit: Vinit Parakh 2015-09-22
Last edit: Vinit Parakh 2015-09-22
Also, I tried running TOR using multiple java processes (JVM). Whenever I called lowerNetLayer.clear() it only gave me a new IP address for the particular process. I do not understand why the behavior changes when I am using multiple threads from the same process. In this case when I call lowerNetLayer.clear() it closes all the circuits for all the threads and establishes new ones.
Basically my use case just needs a new IP address for that thread to retry the same server that I am trying to hit.
Thanks,
Vinit
Last edit: Vinit Parakh 2015-09-21
Hi Vinit,
there is a "Tor-Connection-Manager" implemented as Singleton, this "Manager" is deciding which established route will be used for data. The NetLayer itself is just using the established Tor-Routes when needed. So if you execute clear this will be executed on the whole TorNetLayer and therefore also for the Tor-Connection-Manager.
Thats why you will see a different behaviour if you start a new JVM. (new JVM -> new "Tor-Manager" instance)
hope this clarifies it a bit.
In your other Post about using the exit hashes, option 1 would be what you need to use.
Only the parts between ":" and "/" will be treated as hostnames.
regards Tobi