diff --git a/html/network.php b/html/network.php index c419d31..b8de5fc 100755 --- a/html/network.php +++ b/html/network.php @@ -9,203 +9,92 @@ License text: https://github.com/shreebhattji/Urmi/blob/main/licence.md */ include 'header.php' ?> - '', - '443' => '', -]; - -$data = $defaults; - -if (is_file($jsonFile)) { - $stored = json_decode(file_get_contents($jsonFile), true); - if (is_array($stored)) { - $data = $stored; - } -} - -if ($_SERVER['REQUEST_METHOD'] === 'POST') { - - exec("echo y | sudo ufw reset"); - exec("sudo ufw default allow outgoing"); - exec("sudo ufw default deny incoming"); - exec("sudo ufw allow proto udp to 224.0.0.0/4"); - exec("sudo ufw route allow proto udp to 224.0.0.0/4"); - exec("sudo ufw deny out to 239.255.254.254 port 39000 proto udp"); - - foreach ($defaults as $port => $_) { - $data[$port] = trim($_POST["port_$port"] ?? ''); - } - - $tmp = $jsonFile . '.tmp'; - file_put_contents( - $tmp, - json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) - ); - rename($tmp, $jsonFile); - - foreach ($data as $port => $value) { - $tmp = array_filter( - array_map('trim', explode(',', (string)$value)), - 'strlen' - ); - if (count($tmp) > 0) { - foreach ($tmp as $ip) { - exec("sudo ufw allow from " . $ip . " to any port " . $port . " proto tcp"); +
| Interface Name | +IP Address | +MAC Address | +Status | +
|---|