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/.htpasswd | 1 - admin/api/getIpLocation.php | 38 ++++++++ admin/index.php | 11 +++ admin/panes/audit.php | 226 ++++++++++++++++++++++++++++++++++++++++++++ admin/panes/shortens.php | 41 ++++++++ admin/private/ipcache.json | 1 + 6 files changed, 317 insertions(+), 1 deletion(-) delete mode 100644 admin/.htpasswd create mode 100644 admin/api/getIpLocation.php create mode 100644 admin/panes/audit.php create mode 100644 admin/panes/shortens.php create mode 100644 admin/private/ipcache.json (limited to 'admin') diff --git a/admin/.htpasswd b/admin/.htpasswd deleted file mode 100644 index b678dd2..0000000 --- a/admin/.htpasswd +++ /dev/null @@ -1 +0,0 @@ -test:$apr1$aD1qs9Kn$f1A2MaHyqhBNODYMQC7l91 diff --git a/admin/api/getIpLocation.php b/admin/api/getIpLocation.php new file mode 100644 index 0000000..fe34438 --- /dev/null +++ b/admin/api/getIpLocation.php @@ -0,0 +1,38 @@ + $item) { + if ($ip === $_GET['_']) { + $data = $item; + } +} + +if ($data === null) { + $data = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip=' . $arg)); + $ipCache[$_GET['_']] = $data; + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/admin/private/ipcache.json", json_encode($ipCache)); +} + +if ($data["geoplugin_status"] === 404) { + die("Local IP address"); +} else { + if ($data["geoplugin_inEU"]) { + die($data["geoplugin_countryName"] . " EU"); + } else { + die($data["geoplugin_countryName"]); + } +} \ No newline at end of file diff --git a/admin/index.php b/admin/index.php index a7b4ced..0473560 100644 --- a/admin/index.php +++ b/admin/index.php @@ -155,6 +155,11 @@ Files +
+ + Security Audit + +
Hardware @@ -189,6 +194,10 @@ Telemetry +
+ + Shortened URLs +
@@ -237,7 +246,9 @@ document.getElementById("activity-hardware").addEventListener("click", (event) => { activity(event.target.id, "/admin/panes/hardware.php", event.target); }, true) document.getElementById("activity-disk").addEventListener("click", (event) => { activity(event.target.id, "/admin/panes/disk.php", event.target); }, true) document.getElementById("activity-uptime").addEventListener("click", (event) => { activity(event.target.id, "/admin/panes/uptime.php", event.target); }, true) + document.getElementById("activity-audit").addEventListener("click", (event) => { activity(event.target.id, "/admin/panes/audit.php", event.target); }, true) document.getElementById("activity-version").addEventListener("click", (event) => { activity(event.target.id, "/admin/panes/version.php", event.target); }, true) + document.getElementById("activity-shortens").addEventListener("click", (event) => { activity(event.target.id, "/admin/panes/shortens.php", event.target); }, true) document.getElementById("activity-kartik").addEventListener("click", (event) => { activity(event.target.id, "/admin/panes/kartik.php", event.target); }, true) document.getElementById("activity-code").addEventListener("click", (event) => { activity(event.target.id, "/admin/panes/code.php", event.target); }, true) document.getElementById("activity-quotas").addEventListener("click", (event) => { activity(event.target.id, "/admin/panes/quotas.php", event.target); }, true) 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 diff --git a/admin/panes/shortens.php b/admin/panes/shortens.php new file mode 100644 index 0000000..51afcbb --- /dev/null +++ b/admin/panes/shortens.php @@ -0,0 +1,41 @@ + + + + +
+

Shortened URLs

+ + +
+ + \ No newline at end of file diff --git a/admin/private/ipcache.json b/admin/private/ipcache.json new file mode 100644 index 0000000..028bb8d --- /dev/null +++ b/admin/private/ipcache.json @@ -0,0 +1 @@ +{"127.0.0.1":{"geoplugin_request":"127.0.0.1","geoplugin_status":404,"geoplugin_delay":"1ms","geoplugin_credit":"Some of the returned data includes GeoLite data created by MaxMind, available from http:\/\/www.maxmind.com<\/a>.","geoplugin_city":null,"geoplugin_region":null,"geoplugin_regionCode":null,"geoplugin_regionName":null,"geoplugin_areaCode":null,"geoplugin_dmaCode":null,"geoplugin_countryCode":null,"geoplugin_countryName":null,"geoplugin_inEU":0,"geoplugin_euVATrate":false,"geoplugin_continentCode":null,"geoplugin_continentName":null,"geoplugin_latitude":null,"geoplugin_longitude":null,"geoplugin_locationAccuracyRadius":null,"geoplugin_timezone":null,"geoplugin_currencyCode":null,"geoplugin_currencySymbol":null,"geoplugin_currencySymbol_UTF8":"","geoplugin_currencyConverter":"0"},"92.152.77.195":{"geoplugin_request":"92.152.77.195","geoplugin_status":200,"geoplugin_delay":"1ms","geoplugin_credit":"Some of the returned data includes GeoLite data created by MaxMind, available from http:\/\/www.maxmind.com<\/a>.","geoplugin_city":"Orl\u00e9ans","geoplugin_region":"Centre-Val de Loire","geoplugin_regionCode":"45","geoplugin_regionName":"Loiret","geoplugin_areaCode":"","geoplugin_dmaCode":"","geoplugin_countryCode":"FR","geoplugin_countryName":"France","geoplugin_inEU":1,"geoplugin_euVATrate":20,"geoplugin_continentCode":"EU","geoplugin_continentName":"Europe","geoplugin_latitude":"47.9047","geoplugin_longitude":"1.9076","geoplugin_locationAccuracyRadius":"5","geoplugin_timezone":"Europe\/Paris","geoplugin_currencyCode":"EUR","geoplugin_currencySymbol":"€","geoplugin_currencySymbol_UTF8":"\u20ac","geoplugin_currencyConverter":"0.8501"},"190.2.132.224":{"geoplugin_request":"190.2.132.224","geoplugin_status":200,"geoplugin_delay":"1ms","geoplugin_credit":"Some of the returned data includes GeoLite data created by MaxMind, available from http:\/\/www.maxmind.com<\/a>.","geoplugin_city":"Naaldwijk","geoplugin_region":"South Holland","geoplugin_regionCode":"ZH","geoplugin_regionName":"South Holland","geoplugin_areaCode":"","geoplugin_dmaCode":"","geoplugin_countryCode":"NL","geoplugin_countryName":"Netherlands","geoplugin_inEU":1,"geoplugin_euVATrate":21,"geoplugin_continentCode":"EU","geoplugin_continentName":"Europe","geoplugin_latitude":"51.9934","geoplugin_longitude":"4.2158","geoplugin_locationAccuracyRadius":"1000","geoplugin_timezone":"Europe\/Amsterdam","geoplugin_currencyCode":"EUR","geoplugin_currencySymbol":"€","geoplugin_currencySymbol_UTF8":"\u20ac","geoplugin_currencyConverter":"0.8501"},"86.196.89.109":{"geoplugin_request":"86.196.89.109","geoplugin_status":200,"geoplugin_delay":"2ms","geoplugin_credit":"Some of the returned data includes GeoLite data created by MaxMind, available from http:\/\/www.maxmind.com<\/a>.","geoplugin_city":"Orl\u00e9ans","geoplugin_region":"Centre-Val de Loire","geoplugin_regionCode":"45","geoplugin_regionName":"Loiret","geoplugin_areaCode":"","geoplugin_dmaCode":"","geoplugin_countryCode":"FR","geoplugin_countryName":"France","geoplugin_inEU":1,"geoplugin_euVATrate":20,"geoplugin_continentCode":"EU","geoplugin_continentName":"Europe","geoplugin_latitude":"47.9047","geoplugin_longitude":"1.9076","geoplugin_locationAccuracyRadius":"10","geoplugin_timezone":"Europe\/Paris","geoplugin_currencyCode":"EUR","geoplugin_currencySymbol":"€","geoplugin_currencySymbol_UTF8":"\u20ac","geoplugin_currencyConverter":"0.8501"},"141.98.10.27":{"geoplugin_request":"141.98.10.27","geoplugin_status":206,"geoplugin_delay":"0ms","geoplugin_credit":"Some of the returned data includes GeoLite data created by MaxMind, available from http:\/\/www.maxmind.com<\/a>.","geoplugin_city":"","geoplugin_region":"","geoplugin_regionCode":"","geoplugin_regionName":"","geoplugin_areaCode":"","geoplugin_dmaCode":"","geoplugin_countryCode":"LT","geoplugin_countryName":"Lithuania","geoplugin_inEU":1,"geoplugin_euVATrate":21,"geoplugin_continentCode":"EU","geoplugin_continentName":"Europe","geoplugin_latitude":"56","geoplugin_longitude":"24","geoplugin_locationAccuracyRadius":"200","geoplugin_timezone":"Europe\/Vilnius","geoplugin_currencyCode":"EUR","geoplugin_currencySymbol":"€","geoplugin_currencySymbol_UTF8":"\u20ac","geoplugin_currencyConverter":"0.8501"},"82.65.121.132":{"geoplugin_request":"82.65.121.132","geoplugin_status":200,"geoplugin_delay":"2ms","geoplugin_credit":"Some of the returned data includes GeoLite data created by MaxMind, available from http:\/\/www.maxmind.com<\/a>.","geoplugin_city":"Paris","geoplugin_region":"\u00cele-de-France","geoplugin_regionCode":"75","geoplugin_regionName":"Paris","geoplugin_areaCode":"","geoplugin_dmaCode":"","geoplugin_countryCode":"FR","geoplugin_countryName":"France","geoplugin_inEU":1,"geoplugin_euVATrate":20,"geoplugin_continentCode":"EU","geoplugin_continentName":"Europe","geoplugin_latitude":"48.8579","geoplugin_longitude":"2.3491","geoplugin_locationAccuracyRadius":"200","geoplugin_timezone":"Europe\/Paris","geoplugin_currencyCode":"EUR","geoplugin_currencySymbol":"€","geoplugin_currencySymbol_UTF8":"\u20ac","geoplugin_currencyConverter":"0.8501"},"209.141.47.35":{"geoplugin_request":"209.141.47.35","geoplugin_status":200,"geoplugin_delay":"1ms","geoplugin_credit":"Some of the returned data includes GeoLite data created by MaxMind, available from http:\/\/www.maxmind.com<\/a>.","geoplugin_city":"Las Vegas","geoplugin_region":"Nevada","geoplugin_regionCode":"NV","geoplugin_regionName":"Nevada","geoplugin_areaCode":"","geoplugin_dmaCode":"839","geoplugin_countryCode":"US","geoplugin_countryName":"United States","geoplugin_inEU":0,"geoplugin_euVATrate":false,"geoplugin_continentCode":"NA","geoplugin_continentName":"North America","geoplugin_latitude":"36.1685","geoplugin_longitude":"-115.1164","geoplugin_locationAccuracyRadius":"1000","geoplugin_timezone":"America\/Los_Angeles","geoplugin_currencyCode":"USD","geoplugin_currencySymbol":"$","geoplugin_currencySymbol_UTF8":"$","geoplugin_currencyConverter":"1"},"125.160.65.57":{"geoplugin_request":"125.160.65.57","geoplugin_status":200,"geoplugin_delay":"2ms","geoplugin_credit":"Some of the returned data includes GeoLite data created by MaxMind, available from http:\/\/www.maxmind.com<\/a>.","geoplugin_city":"Balikpapan","geoplugin_region":"East Kalimantan","geoplugin_regionCode":"KI","geoplugin_regionName":"East Kalimantan","geoplugin_areaCode":"","geoplugin_dmaCode":"","geoplugin_countryCode":"ID","geoplugin_countryName":"Indonesia","geoplugin_inEU":0,"geoplugin_euVATrate":false,"geoplugin_continentCode":"AS","geoplugin_continentName":"Asia","geoplugin_latitude":"-1.2551","geoplugin_longitude":"116.8428","geoplugin_locationAccuracyRadius":"100","geoplugin_timezone":"Asia\/Makassar","geoplugin_currencyCode":"IDR","geoplugin_currencySymbol":"Rp","geoplugin_currencySymbol_UTF8":"Rp","geoplugin_currencyConverter":"14444.5"},"37.239.53.5":{"geoplugin_request":"37.239.53.5","geoplugin_status":206,"geoplugin_delay":"1ms","geoplugin_credit":"Some of the returned data includes GeoLite data created by MaxMind, available from http:\/\/www.maxmind.com<\/a>.","geoplugin_city":"","geoplugin_region":"","geoplugin_regionCode":"","geoplugin_regionName":"","geoplugin_areaCode":"","geoplugin_dmaCode":"","geoplugin_countryCode":"IQ","geoplugin_countryName":"Iraq","geoplugin_inEU":0,"geoplugin_euVATrate":false,"geoplugin_continentCode":"AS","geoplugin_continentName":"Asia","geoplugin_latitude":"33","geoplugin_longitude":"44","geoplugin_locationAccuracyRadius":"50","geoplugin_timezone":"Asia\/Baghdad","geoplugin_currencyCode":"IQD","geoplugin_currencySymbol":"ID","geoplugin_currencySymbol_UTF8":"ID","geoplugin_currencyConverter":"1464.2007"},"188.157.253.48":{"geoplugin_request":"188.157.253.48","geoplugin_status":200,"geoplugin_delay":"2ms","geoplugin_credit":"Some of the returned data includes GeoLite data created by MaxMind, available from http:\/\/www.maxmind.com<\/a>.","geoplugin_city":"Szigetszentmiklos","geoplugin_region":"Pest megye","geoplugin_regionCode":"PE","geoplugin_regionName":"Pest megye","geoplugin_areaCode":"","geoplugin_dmaCode":"","geoplugin_countryCode":"HU","geoplugin_countryName":"Hungary","geoplugin_inEU":1,"geoplugin_euVATrate":27,"geoplugin_continentCode":"EU","geoplugin_continentName":"Europe","geoplugin_latitude":"47.3485","geoplugin_longitude":"19.0476","geoplugin_locationAccuracyRadius":"5","geoplugin_timezone":"Europe\/Budapest","geoplugin_currencyCode":"HUF","geoplugin_currencySymbol":"Ft","geoplugin_currencySymbol_UTF8":"Ft","geoplugin_currencyConverter":"300.8604"}} \ No newline at end of file -- cgit