|
@@ -42,4 +42,124 @@ class serverLog {
|
|
|
return preg_replace("/('email'\s*=>\s*)'[^']*'/", "$1'##EMAIL##'", $input);
|
|
return preg_replace("/('email'\s*=>\s*)'[^']*'/", "$1'##EMAIL##'", $input);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public static function consoleApache(){
|
|
|
|
|
+ if (!is_readable(SERVER_LOGS_APACHE)) {
|
|
|
|
|
+ echo "Le fichier n'est pas accessible en lecture.";
|
|
|
|
|
+ exit();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $lines = file(SERVER_LOGS_APACHE);
|
|
|
|
|
+ $search = strtolower($_GET['search'] ?? '');
|
|
|
|
|
+ $limit = strtolower($_GET['limit'] ?? 50); // A défaut les 50 derniers logs
|
|
|
|
|
+
|
|
|
|
|
+ if ($search) {
|
|
|
|
|
+ $lines = array_filter($lines, fn($line) => stripos($line, $search) !== false);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $lines = array_reverse($lines);
|
|
|
|
|
+
|
|
|
|
|
+ echo '<!DOCTYPE html>
|
|
|
|
|
+ <html lang="fr">
|
|
|
|
|
+ <head>
|
|
|
|
|
+ <meta charset="UTF-8">
|
|
|
|
|
+ <style>
|
|
|
|
|
+ body { font-family: monospace; background: black !important; padding: 20px; }
|
|
|
|
|
+ div { font-size: 0.8em; }
|
|
|
|
|
+ .error { color: salmon; }
|
|
|
|
|
+ .warning { color: orange; }
|
|
|
|
|
+ .notice { color: white; }
|
|
|
|
|
+ .grey { color: grey; }
|
|
|
|
|
+ pre { background: #fff; padding: 10px; border: 1px solid #ccc; overflow-x: auto; }
|
|
|
|
|
+ </style>
|
|
|
|
|
+ <link rel="stylesheet" href="' . cache::printFileWithTime("libs/bootstrap/assets/dist/css/bootstrap.min.css") . '">
|
|
|
|
|
+ <script src="' . cache::printFileWithTime("libs/bootstrap/js/bootstrap.min.js") . '"></script>
|
|
|
|
|
+ </head>
|
|
|
|
|
+ <body>';
|
|
|
|
|
+ foreach (array_slice($lines, 0, $limit) as $line) {
|
|
|
|
|
+ serverLog::filtreLog($line);
|
|
|
|
|
+ }
|
|
|
|
|
+ echo '</body>
|
|
|
|
|
+ </html>';
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public static function consoleAttempts(){ echo SERVER_LOGS_BLACKLIST . "/ip_attempts.log";
|
|
|
|
|
+ if (!is_readable(SERVER_LOGS_BLACKLIST . "/ip_attempts.log")) {
|
|
|
|
|
+ echo "Le fichier n'est pas accessible en lecture.";
|
|
|
|
|
+ exit();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $lines = file(SERVER_LOGS_BLACKLIST . "/ip_attempts.log");
|
|
|
|
|
+ $search = strtolower($_GET['search'] ?? '');
|
|
|
|
|
+ $limit = strtolower($_GET['limit'] ?? 50); // A défaut les 50 derniers logs
|
|
|
|
|
+
|
|
|
|
|
+ if ($search) {
|
|
|
|
|
+ $lines = array_filter($lines, fn($line) => stripos($line, $search) !== false);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $lines = array_reverse($lines);
|
|
|
|
|
+
|
|
|
|
|
+ echo '<!DOCTYPE html>
|
|
|
|
|
+ <html lang="fr">
|
|
|
|
|
+ <head>
|
|
|
|
|
+ <meta charset="UTF-8">
|
|
|
|
|
+ <style>
|
|
|
|
|
+ body { font-family: monospace; background: black !important; padding: 20px; }
|
|
|
|
|
+ div { font-size: 0.8em; }
|
|
|
|
|
+ .error { color: salmon; }
|
|
|
|
|
+ .warning { color: orange; }
|
|
|
|
|
+ .notice { color: white; }
|
|
|
|
|
+ .grey { color: grey; }
|
|
|
|
|
+ pre { background: #fff; padding: 10px; border: 1px solid #ccc; overflow-x: auto; }
|
|
|
|
|
+ </style>
|
|
|
|
|
+ <link rel="stylesheet" href="' . cache::printFileWithTime("libs/bootstrap/assets/dist/css/bootstrap.min.css") . '">
|
|
|
|
|
+ <script src="' . cache::printFileWithTime("libs/bootstrap/js/bootstrap.min.js") . '"></script>
|
|
|
|
|
+ </head>
|
|
|
|
|
+ <body>';
|
|
|
|
|
+ foreach (array_slice($lines, 0, $limit) as $line) {
|
|
|
|
|
+ serverLog::filtreLog($line);
|
|
|
|
|
+ }
|
|
|
|
|
+ echo '</body>
|
|
|
|
|
+ </html>';
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public static function consoleIpBlacklist(){
|
|
|
|
|
+ if (!is_readable(SERVER_LOGS_BLACKLIST . "/ip.txt")) {
|
|
|
|
|
+ echo "Le fichier n'est pas accessible en lecture.";
|
|
|
|
|
+ exit();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $lines = file(SERVER_LOGS_BLACKLIST . "/ip.txt");
|
|
|
|
|
+ $search = strtolower($_GET['search'] ?? '');
|
|
|
|
|
+ $limit = strtolower($_GET['limit'] ?? 50); // A défaut les 50 derniers logs
|
|
|
|
|
+
|
|
|
|
|
+ if ($search) {
|
|
|
|
|
+ $lines = array_filter($lines, fn($line) => stripos($line, $search) !== false);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $lines = array_reverse($lines);
|
|
|
|
|
+
|
|
|
|
|
+ echo '<!DOCTYPE html>
|
|
|
|
|
+ <html lang="fr">
|
|
|
|
|
+ <head>
|
|
|
|
|
+ <meta charset="UTF-8">
|
|
|
|
|
+ <style>
|
|
|
|
|
+ body { font-family: monospace; background: black !important; padding: 20px; }
|
|
|
|
|
+ div { font-size: 0.8em; }
|
|
|
|
|
+ .error { color: salmon; }
|
|
|
|
|
+ .warning { color: orange; }
|
|
|
|
|
+ .notice { color: white; }
|
|
|
|
|
+ .grey { color: grey; }
|
|
|
|
|
+ pre { background: #fff; padding: 10px; border: 1px solid #ccc; overflow-x: auto; }
|
|
|
|
|
+ </style>
|
|
|
|
|
+ <link rel="stylesheet" href="' . cache::printFileWithTime("libs/bootstrap/assets/dist/css/bootstrap.min.css") . '">
|
|
|
|
|
+ <script src="' . cache::printFileWithTime("libs/bootstrap/js/bootstrap.min.js") . '"></script>
|
|
|
|
|
+ </head>
|
|
|
|
|
+ <body>';
|
|
|
|
|
+ foreach (array_slice($lines, 0, $limit) as $line) {
|
|
|
|
|
+ serverLog::filtreLog($line);
|
|
|
|
|
+ }
|
|
|
|
|
+ echo '</body>
|
|
|
|
|
+ </html>';
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|