From fb9d497a232ec03a29053ba983fbc3d649fe3795 Mon Sep 17 00:00:00 2001 From: robiscool Date: Thu, 23 Jun 2011 12:41:33 -0700 Subject: snort-dev, update install.inc, update snort_rules --- config/snort-dev/javascript/snort_globalsend.js | 8 ++------ config/snort-dev/snort_install.inc | 6 ++++++ config/snort-dev/snort_rules.php | 27 +++++++++++++------------ 3 files changed, 22 insertions(+), 19 deletions(-) diff --git a/config/snort-dev/javascript/snort_globalsend.js b/config/snort-dev/javascript/snort_globalsend.js index de7ba57b..f62a8c16 100644 --- a/config/snort-dev/javascript/snort_globalsend.js +++ b/config/snort-dev/javascript/snort_globalsend.js @@ -263,8 +263,6 @@ jQuery(document).ready(function() { function showRequestRMlist(formData, jqForm, optionsWhitelist) { var queryString = jQuery.param(formData); - - //alert('About to submit: \n\n' + queryString); // call false to prevent form reload return true; @@ -273,8 +271,6 @@ jQuery(document).ready(function() { // post-submit callback if snort_json_post.php returns true or false function showResponseRMlist(data){ - //alert('test'); - } function getBaseElement(elem){ @@ -321,7 +317,7 @@ jQuery(document).ready(function() { // call to please wait showLoading('#loadingWaiting'); - alert('About to submit: \n\n' + queryString); + //alert('About to submit: \n\n' + queryString); // call false to prevent the form return true; @@ -374,7 +370,7 @@ jQuery(document).ready(function() { // END of fill call to user }else{ // On FAIL get some info back - alert('responseText: \n' + data.responseText + 'FAIL'); + //alert('responseText: \n' + data.responseText + 'FAIL'); } } // END iform code diff --git a/config/snort-dev/snort_install.inc b/config/snort-dev/snort_install.inc index fbfe5a3c..161b3097 100644 --- a/config/snort-dev/snort_install.inc +++ b/config/snort-dev/snort_install.inc @@ -136,6 +136,11 @@ function snort_postinstall() exec('/bin/mkdir -p /usr/local/etc/snort/snortDBrules/snort_rules'); } + if (!file_exists('/usr/local/etc/snort/snortDBrules/DB/default/rules')) { + exec('/bin/mkdir -p /usr/local/etc/snort/snortDBrules/DB/default/rules'); + exec('/usr/bin/touch /usr/local/etc/snort/snortDBrules/DB/default/rules/local.rules'); + } + if (!file_exists('/var/snort/')) { exec('/bin/mkdir -p /var/snort/'); } @@ -240,6 +245,7 @@ function snort_postinstall() exec('/usr/bin/fetch http://www.pfsense.com/packages/config/snort-dev/images/logo22.png'); exec('/usr/bin/fetch http://www.pfsense.com/packages/config/snort-dev/images/page_white_text.png'); exec('/usr/bin/fetch http://www.pfsense.com/packages/config/snort-dev/images/transparent.gif'); + exec('/usr/bin/fetch http://www.pfsense.com/packages/config/snort-dev/images/transparentbg.png'); exec('/usr/bin/fetch http://www.pfsense.com/packages/config/snort-dev/images/up.gif'); exec('/usr/bin/fetch http://www.pfsense.com/packages/config/snort-dev/images/up2.gif'); chdir ("/usr/local/www/snort/javascript/"); diff --git a/config/snort-dev/snort_rules.php b/config/snort-dev/snort_rules.php index 55cf47ac..8285c9fa 100644 --- a/config/snort-dev/snort_rules.php +++ b/config/snort-dev/snort_rules.php @@ -75,19 +75,15 @@ $snortRuleDir = '/usr/local/etc/snort/snortDBrules/DB/' . $rdbuuid; $filterDirList = snortScanDirFilter($snortRuleDir . '/rules', '\.rules'); // START read rule file - if ($_GET['openruleset']) - { + if ($_GET['openruleset']) { $rulefile = $_GET['openruleset']; }else{ $rulefile = $filterDirList[0]; } + // path of rule file $workingFile = $snortRuleDir . '/rules/' . $rulefile; - //split the contents of the string file into an array using the delimiter - // used by rule gui edit and table build code - $splitcontents = split_rule_file($workingFile); - function load_rule_file($incoming_file, $splitcontents) { @@ -119,15 +115,20 @@ function load_rule_file($incoming_file, $splitcontents) return $splitcontents2; } - - //Load the rule file - $splitcontents2 = load_rule_file($workingFile, $splitcontents); - $countSig = count($splitcontents2); + // Load the rule file + // split the contents of the string file into an array using the delimiter + // used by rule gui edit and table build code + if (filesize($workingFile) > 0) { + $splitcontents = split_rule_file($workingFile); - if ($countSig > 0) - { - $newFilterRuleSigArray = newFilterRuleSig($splitcontents2); + $splitcontents2 = load_rule_file($workingFile, $splitcontents); + + $countSig = count($splitcontents2); + + if ($countSig > 0) { + $newFilterRuleSigArray = newFilterRuleSig($splitcontents2); + } } /* -- cgit v1.2.3