mirror of
https://github.com/DeNNiiInc/UltyScan.git
synced 2026-04-17 20:35:59 +00:00
Add Web Interface for UltyScan
This commit is contained in:
45
webui/status.php
Normal file
45
webui/status.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* UltyScan Web Interface - Scan Status
|
||||
* Returns current scan status as JSON
|
||||
*/
|
||||
|
||||
header('Content-Type: application/json');
|
||||
|
||||
// Check if any sniper process is running
|
||||
$output = shell_exec('pgrep -f "sniper" 2>/dev/null');
|
||||
$running = !empty(trim($output));
|
||||
|
||||
// Get list of running scans
|
||||
$processes = [];
|
||||
if ($running) {
|
||||
$psOutput = shell_exec('ps aux | grep "sniper" | grep -v grep 2>/dev/null');
|
||||
if (!empty($psOutput)) {
|
||||
$lines = explode("\n", trim($psOutput));
|
||||
foreach ($lines as $line) {
|
||||
if (!empty($line)) {
|
||||
$processes[] = $line;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get recent log files
|
||||
$logs = [];
|
||||
$logDir = '/var/log/ultyscan';
|
||||
if (is_dir($logDir)) {
|
||||
$files = glob($logDir . '/scan_*.log');
|
||||
usort($files, function ($a, $b) {
|
||||
return filemtime($b) - filemtime($a);
|
||||
});
|
||||
$logs = array_slice($files, 0, 5); // Last 5 logs
|
||||
}
|
||||
|
||||
echo json_encode([
|
||||
'running' => $running,
|
||||
'processCount' => count($processes),
|
||||
'processes' => $processes,
|
||||
'recentLogs' => $logs,
|
||||
'timestamp' => date('Y-m-d H:i:s')
|
||||
]);
|
||||
Reference in New Issue
Block a user