Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/onlinesid/tor-detector
Tor Detector - a library to detect if your website visitor is using TOR.
https://github.com/onlinesid/tor-detector
Last synced: 3 months ago
JSON representation
Tor Detector - a library to detect if your website visitor is using TOR.
- Host: GitHub
- URL: https://github.com/onlinesid/tor-detector
- Owner: onlinesid
- Created: 2016-10-08T08:09:57.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2016-11-21T11:51:13.000Z (almost 8 years ago)
- Last Synced: 2024-07-29T10:34:29.701Z (3 months ago)
- Language: PHP
- Homepage:
- Size: 2.93 KB
- Stars: 12
- Watchers: 3
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- web-stuff - Tor Detector - Detect if user comes via Tor (PHP)
README
# Tor Detector PHP library
A library to detect if your website visitor is from a TOR network or not.At the moment this is achieved by using a DNS lookup method as described in https://trac.torproject.org/projects/tor/wiki/doc/TorDNSExitList
## Composer
https://packagist.org/packages/onlinesid/tor-detector
## Usage
```php
$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";
}
```## Credit
Original code is taken from https://jrnv.nl/detecting-the-use-of-proxies-and-tor-network-6c240d6cc5f (it wasn't working but very close)