From a20dff82a7e2602738f847fa4f1428af3235aafc Mon Sep 17 00:00:00 2001 From: Minteck Date: Sun, 8 Aug 2021 18:27:46 +0200 Subject: Updating... the update... that updates --- admin/panes/audit.php | 226 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 226 insertions(+) create mode 100644 admin/panes/audit.php (limited to 'admin/panes/audit.php') diff --git a/admin/panes/audit.php b/admin/panes/audit.php new file mode 100644 index 0000000..c2a8609 --- /dev/null +++ b/admin/panes/audit.php @@ -0,0 +1,226 @@ + + + + +
+

Security Audit

+ + + + + + + + + + $info) { + if ($ip !== "port") { + echo(" + + + + + "); + + $index++; + } + } + + ?> +
IP addressConnectionsUsername(s)Actions
" . $ip . "
Please wait...");?> + + + You"); + } + 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("Never connected"); + } else { + echo($success . " succeeded, " . $failed . " failed, " . $invalid . " invalid"); + } + + echo("
Last: "); + + if ($info["connections"][0]["status"] === "ok") { + echo("Succeeded"); + } + + if ($info["connections"][0]["status"] === "error") { + echo("Failed"); + } + + if ($info["connections"][0]["status"] === "invalid") { + echo("Invalid"); + } + + echo("
Show full list
    "); + + $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("
  • Username was never sent to server
  • "); + } + + echo("
Details · Report
+
+ + \ No newline at end of file -- cgit