AimBott
AimBott

Reputation: 1

How to get IP of current ExitNode using TOR?

I need a script in PHP that shows in my hidden service the IP of the current ExitNode, just like this page https://check.torproject.org/. If i try with $ip=$_SERVER['REMOTE_ADDR'] it returns 127.0.0.1. Please, can someone help me?

Upvotes: 0

Views: 839

Answers (2)

drew010
drew010

Reputation: 69937

For hidden services, there are no "ExitNode"s in the traditional sense. Since you aren't exiting from the Tor network, the exit relay is neither needed nor used.

When you configure your hidden service, the Tor instance on your relay hosting the hidden service acts as a proxy to your local web server. All traffic to your hidden service will have a remote address of 127.0.0.1*.

To protect the location of a hidden service, the final relay in the circuit has no idea the traffic it is relaying is destined for a hidden service hosted on your server/IP address.

See the Tor Hidden Service Protocol for specific details.

*127.0.0.1 isn't necessarily always the case of the remote IP to a hidden service. If Tor and the hidden service are running on different interfaces, the remote address will be the IP address of the interface Tor is listening on. You might also have cases where the Tor relay is connected via some kind of private tunnel (e.g. VPN) to the hidden service in which case you'd see the remote address of the Tor relay from the tunnel. But in pretty much all cases I can think of, the remote address will always be the address of your Tor relay and will never reveal anything about the last relay in the circuit used to connect the client to your hidden service.

Upvotes: 1

Atul Jindal
Atul Jindal

Reputation: 976

Try this $_SERVER['HTTP_X_FORWARDED_FOR'], it will return actual physical address of web server received request.

Upvotes: 0

Related Questions