|
|
@@ -91,13 +91,13 @@ class serverLog {
|
|
|
return preg_replace("/('email'\s*=>\s*)'[^']*'/", "$1'##EMAIL##'", $input);
|
|
|
}
|
|
|
|
|
|
- public static function consoleApache(){
|
|
|
- if (!is_readable(SERVER_LOGS_APACHE)) {
|
|
|
+ public static function consoleLog(string $_logFile){
|
|
|
+ if (!is_readable($_logFile)) {
|
|
|
echo "Le fichier n'est pas accessible en lecture.";
|
|
|
exit();
|
|
|
}
|
|
|
|
|
|
- $lines = file(SERVER_LOGS_APACHE);
|
|
|
+ $lines = file($_logFile);
|
|
|
$search = strtolower($_GET['search'] ?? '');
|
|
|
$limit = strtolower($_GET['limit'] ?? 50); // A défaut les 50 derniers logs
|
|
|
|
|
|
@@ -107,96 +107,8 @@ class serverLog {
|
|
|
|
|
|
$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; }
|
|
|
- pre { background: #fff; padding: 10px; border: 1px solid #ccc; overflow-x: auto; }
|
|
|
- </style>
|
|
|
- <link rel="stylesheet" href="' . cache::getFileWithTime("libs/bootstrap/assets/dist/css/bootstrap.min.css") . '">
|
|
|
- <script src="' . cache::getFileWithTime("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(){
|
|
|
- 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; }
|
|
|
- pre { background: #fff; padding: 10px; border: 1px solid #ccc; overflow-x: auto; }
|
|
|
- </style>
|
|
|
- <link rel="stylesheet" href="' . cache::getFileWithTime("libs/bootstrap/assets/dist/css/bootstrap.min.css") . '">
|
|
|
- <script src="' . cache::getFileWithTime("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; }
|
|
|
- pre { background: #fff; padding: 10px; border: 1px solid #ccc; overflow-x: auto; }
|
|
|
- </style>
|
|
|
- <link rel="stylesheet" href="' . cache::getFileWithTime("libs/bootstrap/assets/dist/css/bootstrap.min.css") . '">
|
|
|
- <script src="' . cache::getFileWithTime("libs/bootstrap/js/bootstrap.min.js") . '"></script>
|
|
|
- </head>
|
|
|
- <body>';
|
|
|
- foreach (array_slice($lines, 0, $limit) as $line) {
|
|
|
- serverLog::filtreLog($line);
|
|
|
- }
|
|
|
- echo '</body>
|
|
|
- </html>';
|
|
|
- }
|
|
|
-
|
|
|
}
|