From 84f9461274f2d25c1e0a4da0557158a6bb36d817 Mon Sep 17 00:00:00 2001 From: robiscool Date: Mon, 30 Nov 2009 20:42:34 -0800 Subject: snort-dev, add interface gui options, add check if interface is in use --- config/snort-dev/snort_interfaces.php | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'config/snort-dev/snort_interfaces.php') diff --git a/config/snort-dev/snort_interfaces.php b/config/snort-dev/snort_interfaces.php index 6a275ca7..877d6e6c 100644 --- a/config/snort-dev/snort_interfaces.php +++ b/config/snort-dev/snort_interfaces.php @@ -32,6 +32,10 @@ require("guiconfig.inc"); require("/usr/local/pkg/snort/snort_gui.inc"); +$id = $_GET['id']; +if (isset($_POST['id'])) + $id = $_POST['id']; + if (!is_array($config['installedpackages']['snortglobal']['rule'])) $config['installedpackages']['snortglobal']['rule'] = array(); @@ -77,7 +81,7 @@ if (isset($_POST['del_x'])) { /* convert fake interfaces to real */ $if_real = convert_friendly_interface_to_real_interface_name($a_nat[$rulei]['interface']); - $snort_pid = exec("/bin/ps -auwx | grep -v grep | grep \"ng0 -c\" | awk '{print $2;}'"); + $snort_pid = exec("/bin/ps -auwx | grep -v grep | grep \"$if_real -c\" | awk '{print $2;}'"); if ($snort_pid != "") { exec("/bin/sh /usr/local/etc/rc.d/snort_{$rulei}{$if_real}.sh stop"); @@ -142,6 +146,18 @@ if (isset($_POST['del_x'])) { } } + +/* start/stop snort */ +if ($_GET['act'] == "toggle" && $_GET['id'] != "") { + $if_real2 = convert_friendly_interface_to_real_interface_name($a_nat[$id]['interface']); + $snort_pid2 = exec("/bin/ps -auwx | grep -v grep | grep \"$if_real2 -c\" | awk '{print $2;}'"); + if ($snort_pid2 != "") { + exec("/bin/sh /usr/local/etc/rc.d/snort_{$id}{$if_real2}.sh stop"); + }else{ + exec("/bin/sh /usr/local/etc/rc.d/snort_{$id}{$if_real2}.sh start"); + } +} + $pgtitle = "Services: Snort 2.8.4.1_5 pkg v. 1.8 alpha"; include("head.inc"); @@ -205,7 +221,7 @@ padding: 15px 10px 50% 50px;
- + @@ -217,25 +233,27 @@ padding: 15px 10px 50% 50px;
     If Snort
- +
- - + +