From ef055e79855cf3be1ad5e1aa5f9ebad480062384 Mon Sep 17 00:00:00 2001 From: Minteck Date: Sat, 1 Jan 2022 10:37:28 +0100 Subject: Bye furries --- admin/panes/audit.php | 252 -------------------------------------------------- 1 file changed, 252 deletions(-) delete mode 100644 admin/panes/audit.php (limited to 'admin/panes/audit.php') diff --git a/admin/panes/audit.php b/admin/panes/audit.php deleted file mode 100644 index 3292ec8..0000000 --- a/admin/panes/audit.php +++ /dev/null @@ -1,252 +0,0 @@ - - - - -
-

- - - - - - - - - - $uperms) { - if ($user === $_DATA['id']) { - if (in_array("addresses", $uperms)) { - $viewFullIps = true; - } - } - } - - foreach ($dir as $file) { - if ($file !== "." && $file !== "..") { - if (substr($file, 0, 5) === "auth.") { - if (substr($file, -3) === ".gz") { - exec("gzip --decompress /var/log/" . $file); - $raw = file_get_contents("/var/log/" . substr($file, 0, -3)); - } else { - $raw = file_get_contents("/var/log/" . $file); - } - - $data .= "\n" . $raw; - } - } - } - - $lines = explode("\n", strip_tags($data)); - $lines = array_reverse($lines); - - foreach ($lines as $line) { - if (trim($line) !== "" && strpos($line, "sshd") !== false && strpos($line, "error: kex_exchange_identification: Connection closed by remote host") === false && (strpos($line, "]: Connection closed by invalid user ") !== false || strpos($line, "]: Unable to negotiate with ") !== false || strpos($line, "]: Accepted publickey for ") !== false)) { - $data = []; - - $parts = explode(": ", $line); - - $data["date"] = $parts[0]; - array_shift($parts); - $data["message"] = implode(": ", $parts); - - - if (substr($data["message"], 0, 23) === "Accepted publickey for ") { // Successful connection - $data["status"] = "ok"; - $data["ip"] = explode(" ", $data["message"])[5]; - $data["user"] = explode(" ", $data["message"])[3]; - } - - if (substr($data["message"], 0, 25) === "Unable to negotiate with ") { // Errored connection - $data["status"] = "error"; - $data["ip"] = explode(" ", $data["message"])[4]; - $data["user"] = null; - } - - if (substr($data["message"], 0, 34) === "Connection closed by invalid user ") { // Invalid connection - $data["status"] = "invalid"; - $data["ip"] = explode(" ", $data["message"])[count(explode(" ", $data["message"])) - 4]; - $data["user"] = explode(" ", $data["message"])[5]; - } - - if (!isset($ips[$data["ip"]])) { - $ips[$data["ip"]] = []; - } - if (!isset($ips[$data["ip"]]["connections"])) { - $ips[$data["ip"]]["connections"] = []; - } - $ips[$data["ip"]]["connections"][] = $data; - } - } - - $index = 1; - foreach ($ips as $ip => $info) { - if ($ip !== "port") { - $pip = explode(".", $ip); - - if ($viewFullIps) { - $rip = $ip; - } else { - if (strlen($pip[3]) === 3) $pip[3] = "xxx"; - if (strlen($pip[3]) === 2) $pip[3] = "xx"; - if (strlen($pip[3]) === 1) $pip[3] = "x"; - - if (strlen($pip[2]) === 3) $pip[2] = "xxx"; - if (strlen($pip[2]) === 2) $pip[2] = "xx"; - if (strlen($pip[2]) === 1) $pip[2] = "x"; - - $rip = implode(".", $pip); - } - - echo(" - - - - - "); - - $index++; - } - } - - ?> -
Actions
" . $rip . "
" . l("Please wait", "Patientez") . "...");?> - - - " . l("You", "Vous") . ""); - } - echo("
"); - - $success = 0; - $invalid = 0; - $failed = 0; - - foreach ($info["connections"] as $connection) { - if ($connection["status"] === "invalid") { - $invalid++; - } - if ($connection["status"] === "error") { - $failed++; - } - if ($connection["status"] === "ok") { - $success++; - } - } - if (count($info["connections"]) === 0) { - echo("" . l("Never connected", "Jamais connecté") . ""); - } else { - echo($success . " " . l("succeeded", "réussi") . ", " . $failed . " " . l("failed", "échoué") . ", " . $invalid . " " . l("invalid", "invalide")); - } - - echo("
" . l("Last", "Dernier ") . ": "); - - if ($info["connections"][0]["status"] === "ok") { - echo("" . l("Succeeded", "Réussi") . ""); - } - - if ($info["connections"][0]["status"] === "error") { - echo("" . l("Failed", "Échoué") . ""); - } - - if ($info["connections"][0]["status"] === "invalid") { - echo("" . l("Invalid", "Invalide") . ""); - } - - echo("
" . l("Show full list", "Afficher la liste") . "
    "); - - $uniqueUsers = []; - $connectionsWithUsers = 0; - - foreach ($info["connections"] as $connection) { - if (!in_array($connection["user"], $uniqueUsers) && $connection["user"] !== null) { - if (isset($uniqueUsers[$connection["user"]])) { - $uniqueUsers[$connection["user"]]++; - $connectionsWithUsers++; - } else { - $uniqueUsers[$connection["user"]] = 1; - $connectionsWithUsers++; - } - } - } - - foreach ($uniqueUsers as $user => $occurrences) { - echo("
  • " . $user . " (" . $occurrences . "×, " . round(($occurrences/$connectionsWithUsers)*100, 2) . "%)
  • "); - } - - if (count($uniqueUsers) === 0) { - echo("
  • " . l("Username was never sent to server", "Le nom d'utilisateur n'a jamais été transmis au service") . "
  • "); - } - - echo("
" . l("Report as fraudulent", "Signaler comme fraude") . "
-
- - \ No newline at end of file -- cgit