chore: remove useless stuff

Stray bits of config, MacOS dashboard widget...
This commit is contained in:
Emmanuel BENOîT 2024-12-31 17:41:29 +01:00
parent 46df0f2d61
commit 3922a78de9
Signed by: Emmanuel BENOîT
SSH key fingerprint: SHA256:l7PFUUF5TCDsvYeQC9OnTNz08dFY7Fvf4Hv3neIqYpg
60 changed files with 6 additions and 4929 deletions
scripts/game/main/ticks/deathofrats

View file

@ -150,14 +150,6 @@ class main_ticks_deathofrats_library {
l::debug("Analysing " . count($this->connections) . " new record(s)");
$this->makePerAccountRecords();
// Start with open proxies
l::debug("Checking for open proxies ...");
$this->checkOpenProxies();
if ($this->proxiedAccounts) {
l::info("Logging " . count($this->proxiedAccounts) . " account(s) using open proxies");
$this->db->safeTransaction(array($this, 'logOpenProxies'));
}
// Now examine per-account entries to find different types of rats
l::debug("Checking single player badness");
foreach ($this->perAccount as $records) {
@ -660,111 +652,6 @@ class main_ticks_deathofrats_library {
}
/***********************************************************************
* OPEN PROXIES *
***********************************************************************/
/** This method checks for open proxies in the latest log entries.
*/
private function checkOpenProxies() {
$IPs = array();
// Make lists of accounts for each IP
foreach ($this->connections as $record) {
if ($record['ip_addr'] == 'AUTO' || $record['action'] == 'OUT') {
continue;
}
$ip = $record['ip_addr'];
$account = $record['account'];
if (!is_array($IPs[$ip])) {
$IPs[$ip] = array($account);
} elseif (!in_array($account, $IPs[$ip])) {
array_push($IPs[$ip], $account);
}
}
// Check for proxies on the IPs
$requests = array();
$proxies = array();
foreach (array_keys($IPs) as $ip) {
if (count($requests) < 20) {
array_push($requests, $ip);
continue;
}
try {
$results = pcheck::check($requests);
} catch (Exception $e) {
l::error("Failed to check some addresses for open proxies");
l::info($e->getMessage());
return;
}
foreach ($results as $host => $status) {
if ($status == 1) {
array_push($proxies, $host);
}
}
$requests = array();
}
// If there are some requests we didn't execute, do it
if (count($requests)) {
try {
$results = pcheck::check($requests);
} catch (Exception $e) {
l::error("Failed to check some addresses for open proxies");
l::info($e->getMessage());
return;
}
foreach ($results as $host => $status) {
if ($status == 1) {
array_push($proxies, $host);
}
}
}
// Check for proxied accounts
$proxyAccounts = array();
foreach ($proxies as $ip) {
foreach ($IPs[$ip] as $account) {
if (in_array($account, $proxyAccounts)) {
continue;
}
array_push($proxyAccounts, $account);
}
}
$this->proxiedAccounts = $proxyAccounts;
}
/** This method logs access to accounts using open proxies. A log
* entry is only added every 24h.
*/
public function logOpenProxies() {
// Get all recent open proxy logs
$this->db->query(
"SELECT account FROM dor_single "
. "WHERE message = 'PROXY' AND {$this->now} - ts < 86400"
);
$recent = array();
while ($r = dbFetchArray($q)) {
$recent[] = $r[0];
}
// Insert proxy logs
foreach ($this->proxiedAccounts as $account) {
if (in_array($account, $recent)) {
continue;
}
$this->singlePlayerLog("PROXY", $account);
}
}
/***********************************************************************
* SINGLE PLAYER SUSPICIOUS BEHAVIOUR *
***********************************************************************/