onlinesid / tor-detector
Tor Detector - 一个用于检测网站访客是否使用TOR的库
v0.0.2
2016-10-08 10:49 UTC
This package is auto-updated.
Last update: 2024-09-20 11:46:13 UTC
README
一个用于检测网站访客是否来自TOR网络或非TOR网络的库。
目前这是通过使用DNS查询方法实现的,具体方法请参考https://trac.torproject.org/projects/tor/wiki/doc/TorDNSExitList
Composer
https://packagist.org.cn/packages/onlinesid/tor-detector
使用方法
$tor_detector = new OnlineSid\Tor\TorDetector(); $your_server_ip = '1.2.3.4'; // the IP address of your server (web server) $user_ip = '62.102.148.67'; // is this IP from TOR exit node? if ($tor_detector->check($user_ip, 80, $your_server_ip)) { echo "Tor!\n"; } else { echo "Not TOR!\n"; }
致谢
原始代码取自https://jrnv.nl/detecting-the-use-of-proxies-and-tor-network-6c240d6cc5f(虽然未工作,但非常接近)