reasonableframework/helper/hiddentool.php

25 lines
620 B
PHP
Raw Normal View History

2021-05-24 13:18:48 +00:00
<?php
/**
* @file hiddentool.php
* @created_on 2021-05-24
2022-09-13 11:42:35 +00:00
* @updated_on 2022-09-13
2022-11-25 14:15:20 +00:00
* @author Go Namhyeon <abuse@catswords.net>
2021-05-24 13:18:48 +00:00
* @brief Tools for Hidden Services (e.g. Tor, I2P, etc...)
*/
if (!is_fn("detect_hidden_service")) {
function detect_hidden_service() {
2022-09-13 11:42:35 +00:00
$score = 0;
2021-05-24 13:18:48 +00:00
2022-09-13 11:42:35 +00:00
$suffixes = array("onion", "i2p", "crypto");
2021-05-24 13:18:48 +00:00
$forwarded_host = get_header_value("X-Forwarded-Host");
if (!empty($forwarded_host)) {
if (in_array(end(explode('.', $forwarded_host)), $suffixes)) {
$score += 1;
}
}
return $score;
};
}