简体   繁体   中英

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?

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 (eg 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.

试试这个$ _SERVER ['HTTP_X_FORWARDED_FOR'],它将返回Web服务器收到的请求的实际物理地址。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM