From 556474c5b9db2afff94d288870b203bed3ff2cfb Mon Sep 17 00:00:00 2001 From: robiscool Date: Fri, 5 Aug 2011 18:19:02 -0700 Subject: orionids-dev, fix db save changes, fix foward slash error on chrom and ie9, add no cache php code --- config/orionids-dev/snort_rules_ips.php | 177 +++++++++++++++++++++++--------- 1 file changed, 131 insertions(+), 46 deletions(-) (limited to 'config/orionids-dev/snort_rules_ips.php') diff --git a/config/orionids-dev/snort_rules_ips.php b/config/orionids-dev/snort_rules_ips.php index b1bd8b08..618a684a 100644 --- a/config/orionids-dev/snort_rules_ips.php +++ b/config/orionids-dev/snort_rules_ips.php @@ -1,13 +1,19 @@ . - Copyright (C) 2008-2009 Robert Zelaya. All rights reserved. + Pfsense Old snort GUI + Copyright (C) 2006 Scott Ullrich. + + Pfsense snort GUI + Copyright (C) 2008-2012 Robert Zelaya. + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -18,6 +24,10 @@ notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + 3. Neither the name of the pfSense nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE @@ -28,12 +38,20 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ + +*/ require_once("guiconfig.inc"); require_once("/usr/local/pkg/snort/snort_new.inc"); require_once("/usr/local/pkg/snort/snort_gui.inc"); +//Set no caching +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + // set page vars if (isset($_GET['uuid']) && isset($_GET['rdbuuid'])) { @@ -65,6 +83,34 @@ if (isset($_GET['rulefilename'])) { exit; } + +function snortSearchArray($array, $key, $value) +{ + $results = array(); + + if (is_array($array)) + { + foreach ($array as $subarray) + { + if ($subarray[$key] == $value) { + $results = $subarray; + } + + } + + } + + return $results; +} + +// get default settings +$listGenRules = array(); +$listGenRules = snortSql_fetchAllSettings('snortDBrules', 'SnortruleGenIps', 'rdbuuid', $rdbuuid); + +// get sigs in db +$listSigRules = array(); +$listSigRules = snortSql_fetchAllSettings('snortDBrules', 'SnortruleSigsIps', 'rdbuuid', $rdbuuid); + $pgtitle = "Services: Snort: Ruleset Ips:"; include("/usr/local/pkg/snort/snort_head.inc"); @@ -87,8 +133,6 @@ if (isset($_GET['rulefilename'])) {
-
-
- - -
- - - - - - - - - - - - - - - - - - - - -
   On   Sid   Source   Amount   DurationMessage
-
- - - - -
- - -
- + + + + + + + +
+ + + +
+ +
+ + + + + + + + + + + + + +
Rule File Ips Settings
+ + + + + + + + + + + +
   On   Sid   Source   Amount   DurationMessage
+
+ + + + +
+ + +
+
+ +
@@ -226,6 +288,7 @@ jQuery(document).ready(function() { function getSidBlockJsonArray($getEnableSid) { + global $listGenRules, $listSigRules; if (!empty($getEnableSid)) { @@ -235,16 +298,38 @@ jQuery(document).ready(function() { foreach ($getEnableSid as $val3) { + //$listGenRules $listSigRules + $snortSigIpsExists = snortSearchArray($listSigRules, 'siguuid', trim($val3['0'])); + + // if sig is in db use its settings else use default settings + if(!empty($snortSigIpsExists['siguuid'])) { + + $getSid = $snortSigIpsExists['siguuid']; + $getEnable = $snortSigIpsExists['enable']; + $getWho = $snortSigIpsExists['who']; + $getTimeamount = $snortSigIpsExists['timeamount']; + $getTimetype = $snortSigIpsExists['timetype']; + + }else{ + + $getSid = escapeJsonString(trim($val3['0'])); + $getEnable = $listGenRules[0]['enable']; + $getWho = $listGenRules[0]['who']; + $getTimeamount = $listGenRules[0]['timeamount']; + $getTimetype = $listGenRules[0]['timetype']; + + } + $i++; - + if ($i == 1) { $main .= '['; } if ( $i == $countSigList ) { - $main .= '{"sid":"' . escapeJsonString($val3['0']) . '","enable":"' . 'on' . '","who":"' . 'src' . '","timeamount":"' . '15' . '","timetype":"' . 'minutes' . '","msg":"' . escapeJsonString($val3['1']) . '"}'; + $main .= '{"sid":"' . $getSid . '","enable":"' . $getEnable . '","who":"' . $getWho . '","timeamount":"' . $getTimeamount . '","timetype":"' . $getTimetype . '","msg":"' . escapeJsonString($val3['1']) . '"}'; }else{ - $main .= '{"sid":"' . escapeJsonString($val3['0']) . '","enable":"' . 'on' . '","who":"' . 'src' . '","timeamount":"' . '15' . '","timetype":"' . 'minutes' . '","msg":"' . escapeJsonString($val3['1']) . '"},'; + $main .= '{"sid":"' . $getSid . '","enable":"' . $getEnable . '","who":"' . $getWho . '","timeamount":"' . $getTimeamount . '","timetype":"' . $getTimetype . '","msg":"' . escapeJsonString($val3['1']) . '"},'; } if ($i == $countSigList) { @@ -321,8 +406,8 @@ function makeLargeSidTables(snortObjlist) { var rowIsEvenOdd = 'even_ruleset2'; } - if (snortObjlist[i].enable === 'on'){ - var rulesetChecked = 'checked'; + if (snortObjlist[i].enable == 'on'){ + var rulesetChecked = 'checked="checked"'; }else{ var rulesetChecked = ''; } @@ -330,7 +415,7 @@ function makeLargeSidTables(snortObjlist) { jQuery('.rulesetloopblock').append( "\n" + '' + "\n" + '' + "\n" + - '' + "\n" + + '' + "\n" + '' + "\n" + '' + snortObjlist[i].sid + '' + "\n" + '' + "\n" + -- cgit v1.2.3