From 29f7aa59851de73ad4bc6e08589448895ce11dba Mon Sep 17 00:00:00 2001 From: robiscool Date: Sat, 25 Jun 2011 08:41:45 -0700 Subject: snort-dev, update modal, begin update gui work --- config/snort-dev/css/style_snort2.css | 64 +++++-- config/snort-dev/images/close_9x9.gif | Bin 0 -> 836 bytes config/snort-dev/images/top_modal_bar_lil.jpg | Bin 0 -> 11071 bytes config/snort-dev/javascript/snort_globalsend.js | 21 +- config/snort-dev/snort_alerts.php | 14 +- config/snort-dev/snort_barnyard.php | 13 +- config/snort-dev/snort_blocked.php | 13 +- config/snort-dev/snort_build.inc | 18 +- config/snort-dev/snort_define_servers.php | 13 +- config/snort-dev/snort_download_updates.php | 63 +++--- config/snort-dev/snort_help_info.php | 2 +- config/snort-dev/snort_interfaces.php | 13 +- config/snort-dev/snort_interfaces_edit.php | 13 +- config/snort-dev/snort_interfaces_global.php | 19 +- config/snort-dev/snort_interfaces_rules.php | 13 +- config/snort-dev/snort_interfaces_rules_edit.php | 13 +- config/snort-dev/snort_interfaces_suppress.php | 13 +- .../snort-dev/snort_interfaces_suppress_edit.php | 15 +- config/snort-dev/snort_interfaces_whitelist.php | 13 +- .../snort-dev/snort_interfaces_whitelist_edit.php | 16 +- config/snort-dev/snort_json_post.php | 213 ++++++++++++--------- config/snort-dev/snort_new.inc | 50 +++-- config/snort-dev/snort_preprocessors.php | 13 +- config/snort-dev/snort_rules.php | 14 +- config/snort-dev/snort_rulesets.php | 14 +- 25 files changed, 446 insertions(+), 207 deletions(-) create mode 100644 config/snort-dev/images/close_9x9.gif create mode 100644 config/snort-dev/images/top_modal_bar_lil.jpg (limited to 'config') diff --git a/config/snort-dev/css/style_snort2.css b/config/snort-dev/css/style_snort2.css index 54ce4af6..0582f70d 100644 --- a/config/snort-dev/css/style_snort2.css +++ b/config/snort-dev/css/style_snort2.css @@ -101,24 +101,60 @@ a { .loadingWaitingMessage{ - position: absolute; - top: 25%; - left: 50%; - color: #ffffff; - z-index: 9999; - text-align: center; + text-align: center; + margin-top:40px; } -.loadingWaitingUpdateGUI{ +.snortModal { + width:500px; + height:300px; + position:absolute; + z-index:999; + background-color:#000; +} - position: absolute; - top: 25%; - left: 35%; - color: #ffffff; - z-index: 9999; - text-align: center; - +.snortModalUpdate { + width:900px; + height:500px; + position:absolute; + z-index:999; + background-color:#000; +} + +.snortModalTopUpdate { + width:900px; + height:25px; + background-image:url( '/snort/images/top_modal_bar_lil.jpg' ); + background-repeat:repeat-x; + margin-bottom:1px; +} + +.snortModalTop { + width:500px; + height:25px; + background-image:url( '/snort/images/top_modal_bar_lil.jpg' ); + background-repeat:repeat-x; + margin-bottom:1px; +} + +.snortModalTopClose { + width:9px; + height:9px; + float:right; + margin-right:10px; + margin-top:8px; +} + +.snortModalTitle { + text-align: center; +} + +.snortModalTitleUpdate { + position:absolute; + top: 125px; + left: 170px; + width: 600px; } .listhdrr2 { diff --git a/config/snort-dev/images/close_9x9.gif b/config/snort-dev/images/close_9x9.gif new file mode 100644 index 00000000..326f5fa5 Binary files /dev/null and b/config/snort-dev/images/close_9x9.gif differ diff --git a/config/snort-dev/images/top_modal_bar_lil.jpg b/config/snort-dev/images/top_modal_bar_lil.jpg new file mode 100644 index 00000000..f0049de8 Binary files /dev/null and b/config/snort-dev/images/top_modal_bar_lil.jpg differ diff --git a/config/snort-dev/javascript/snort_globalsend.js b/config/snort-dev/javascript/snort_globalsend.js index f62a8c16..a613dd46 100644 --- a/config/snort-dev/javascript/snort_globalsend.js +++ b/config/snort-dev/javascript/snort_globalsend.js @@ -136,6 +136,15 @@ jQuery(document).ready(function() { jQuery(thisLocation).show(); }; + // this was cp from stackoverflow dot com help question + // used to center snort modals + jQuery.fn.centerModal = function () { + this.css("position","absolute"); + this.css("top", 70 + "px"); + this.css("left", ((jQuery(window).width() - this.outerWidth()) / 2) + jQuery(window).scrollLeft() + "px"); + return this; + } + //--------------------------- START select all code --------------------------- @@ -314,8 +323,9 @@ jQuery(document).ready(function() { var queryString = jQuery.param(formData); - // call to please wait + // call to please wait showLoading('#loadingWaiting'); + jQuery('.snortModal').centerModal(); //alert('About to submit: \n\n' + queryString); @@ -336,9 +346,12 @@ jQuery(document).ready(function() { // After Save Calls display var appendElem = jQuery('
success...'); function finnish(){ - hideLoading('#loadingWaiting'); - appendElem.remove(); - updatestarted = 1; + // hold msg for a min + setTimeout(function(){ + hideLoading('#loadingWaiting'); + appendElem.remove(); + updatestarted = 1; + }, 1200 ); } function showResponse(data, responseText, statusText, xhr, $form){ diff --git a/config/snort-dev/snort_alerts.php b/config/snort-dev/snort_alerts.php index cd21f29b..1c3acd43 100644 --- a/config/snort-dev/snort_alerts.php +++ b/config/snort-dev/snort_alerts.php @@ -58,9 +58,19 @@ $arefresh_on = ($generalSettings['arefresh'] == 'on' ? 'checked' : ''); - +
-


Please Wait...

+
+
+ +
+
+



Please Wait...

+
+
+

+
+
diff --git a/config/snort-dev/snort_barnyard.php b/config/snort-dev/snort_barnyard.php index 868e9f17..711dd8bd 100644 --- a/config/snort-dev/snort_barnyard.php +++ b/config/snort-dev/snort_barnyard.php @@ -137,8 +137,19 @@ jQuery(document).ready(function() { +
-


Please Wait...

+
+
+ +
+
+



Please Wait...

+
+
+

+
+
diff --git a/config/snort-dev/snort_blocked.php b/config/snort-dev/snort_blocked.php index 01eb5fe4..b798462d 100644 --- a/config/snort-dev/snort_blocked.php +++ b/config/snort-dev/snort_blocked.php @@ -60,8 +60,19 @@ $brefresh_on = ($generalSettings['brefresh'] == 'on' ? 'checked' : ''); +
-


Please Wait...

+
+
+ +
+
+



Please Wait...

+
+
+

+
+
diff --git a/config/snort-dev/snort_build.inc b/config/snort-dev/snort_build.inc index 7ce92f2a..29695df4 100644 --- a/config/snort-dev/snort_build.inc +++ b/config/snort-dev/snort_build.inc @@ -43,7 +43,6 @@ if(isset($_POST['__csrf_magic'])) { unset($_POST['__csrf_magic']); } - // -------------------------- START snort.conf ------------------------- /* func builds custom whitelests */ @@ -133,7 +132,7 @@ function build_base_whitelist($lanip, $wanip, $wangw, $wandns, $vips, $vpns, $us $vpns_list = filter_get_vpns_list(); } - if ($vpns_list != '') { + if (!empty($vpns_list)) { $home_net .= "$vpns_list "; } } @@ -194,7 +193,7 @@ function create_snort_homenet($snortNet, $getSnortHomeNet) { $listName = $getSnortHomeNet['homelistname']; - if ($listName == 'default' || $listName == '') { + if ($listName == 'default' || empty($listName)) { return build_base_whitelist('on','on', 'on', 'on', 'on', 'on', 'off', ''); }else{ $getSnortWhitelist = snortSql_fetchAllSettings('snortDB', 'SnortWhitelist', 'filename', $listName); @@ -569,7 +568,9 @@ function generate_snort_conf($uuid) if(!empty($listEnabled_rulesets)) { foreach($listEnabled_rulesets as $enabled_item) { - $selected_rules_sections .= "include \$RULE_PATH/{$enabled_item['rulesetname']}\n"; + if ($enabled_item['enable'] !== 'off') { + $selected_rules_sections .= "include \$RULE_PATH/{$enabled_item['rulesetname']}\n"; + } } } @@ -1110,8 +1111,13 @@ function create_snort_conf($uuid) } -// -------------------------- END snort.conf ------------------------- - +function build_snort_settings($uuid) { + + // create snort.conf + create_snort_conf($uuid); + +} +// -------------------------- END snort.conf ------------------------- ?> diff --git a/config/snort-dev/snort_define_servers.php b/config/snort-dev/snort_define_servers.php index 78e033f6..948f769b 100644 --- a/config/snort-dev/snort_define_servers.php +++ b/config/snort-dev/snort_define_servers.php @@ -67,8 +67,19 @@ $a_list = snortSql_fetchAllSettings('snortDB', 'SnortIfaces', 'uuid', $uuid); +
-


Please Wait...

+
+
+ +
+
+



Please Wait...

+
+
+

+
+
diff --git a/config/snort-dev/snort_download_updates.php b/config/snort-dev/snort_download_updates.php index a5c3b030..6092ff2e 100644 --- a/config/snort-dev/snort_download_updates.php +++ b/config/snort-dev/snort_download_updates.php @@ -64,52 +64,41 @@ header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +
-


Please Wait...

+
+
+ +
+
+



Please Wait...

+
+
+

+
+
+
-
- - - - - - - +
+
+ +
+
+
Yellow Bar
- + -
Yellow Bar + /images/misc/progress_bar.gif' width='600' height='23' name='progressbar' id='progressbar' alt='' /> +
-
- - - - + +
+

CARS

+ diff --git a/config/snort-dev/snort_help_info.php b/config/snort-dev/snort_help_info.php index d12cfd11..5bc32a1d 100644 --- a/config/snort-dev/snort_help_info.php +++ b/config/snort-dev/snort_help_info.php @@ -241,7 +241,7 @@ jQuery(document).ready(function() {

Change Log

-

Changes to this package can be viewed by following pfSense packages repository

+

Changes to this package can be viewed by following pfSense packages repository

diff --git a/config/snort-dev/snort_interfaces.php b/config/snort-dev/snort_interfaces.php index 55161575..7ba282ab 100644 --- a/config/snort-dev/snort_interfaces.php +++ b/config/snort-dev/snort_interfaces.php @@ -59,8 +59,19 @@ $a_interfaces = snortSql_fetchAllInterfaceRules('SnortIfaces', 'snortDB'); +
-


Please Wait...

+
+
+ +
+
+



Please Wait...

+
+
+

+
+
diff --git a/config/snort-dev/snort_interfaces_edit.php b/config/snort-dev/snort_interfaces_edit.php index 4ac128cf..f85c6bb7 100644 --- a/config/snort-dev/snort_interfaces_edit.php +++ b/config/snort-dev/snort_interfaces_edit.php @@ -157,8 +157,19 @@ jQuery(document).ready(function() { +
-


Please Wait...

+
+
+ +
+
+



Please Wait...

+
+
+

+
+
diff --git a/config/snort-dev/snort_interfaces_global.php b/config/snort-dev/snort_interfaces_global.php index 1c1a6768..5891952b 100644 --- a/config/snort-dev/snort_interfaces_global.php +++ b/config/snort-dev/snort_interfaces_global.php @@ -82,15 +82,22 @@ $snortlogCurrentDSKsize = round(exec('df -k /var | grep -v "Filesystem" | awk \' - - - +
-


Please Wait...

+
+
+ +
+
+



Please Wait...

+
+
+

+
+
+
diff --git a/config/snort-dev/snort_interfaces_rules.php b/config/snort-dev/snort_interfaces_rules.php index 51b8cbb4..1d9da1cb 100644 --- a/config/snort-dev/snort_interfaces_rules.php +++ b/config/snort-dev/snort_interfaces_rules.php @@ -64,8 +64,19 @@ $a_rules = snortSql_fetchAllSettings('snortDBrules', 'Snortrules', 'All', ''); +
-


Please Wait...

+
+
+ +
+
+



Please Wait...

+
+
+

+
+
diff --git a/config/snort-dev/snort_interfaces_rules_edit.php b/config/snort-dev/snort_interfaces_rules_edit.php index 33b2f7e0..6fa1c60d 100644 --- a/config/snort-dev/snort_interfaces_rules_edit.php +++ b/config/snort-dev/snort_interfaces_rules_edit.php @@ -86,8 +86,19 @@ if ($a_list == '') +
-


Please Wait...

+
+
+ +
+
+



Please Wait...

+
+
+

+
+
diff --git a/config/snort-dev/snort_interfaces_suppress.php b/config/snort-dev/snort_interfaces_suppress.php index 4df94ec9..f53173a1 100644 --- a/config/snort-dev/snort_interfaces_suppress.php +++ b/config/snort-dev/snort_interfaces_suppress.php @@ -68,8 +68,19 @@ $a_suppress = snortSql_fetchAllWhitelistTypes('SnortSuppress', ''); +
-


Please Wait...

+
+
+ +
+
+



Please Wait...

+
+
+

+
+
diff --git a/config/snort-dev/snort_interfaces_suppress_edit.php b/config/snort-dev/snort_interfaces_suppress_edit.php index 7f6f178d..195cd178 100644 --- a/config/snort-dev/snort_interfaces_suppress_edit.php +++ b/config/snort-dev/snort_interfaces_suppress_edit.php @@ -78,7 +78,7 @@ if ($a_list == '') - $pgtitle = 'Services: Snort: Suppression: Edit: ' . $uuid; + $pgtitle = 'Services: Snort: Suppression: Edit'; include('/usr/local/pkg/snort/snort_head.inc'); ?> @@ -86,8 +86,19 @@ if ($a_list == '') +
-


Please Wait...

+
+
+ +
+
+



Please Wait...

+
+
+

+
+
diff --git a/config/snort-dev/snort_interfaces_whitelist.php b/config/snort-dev/snort_interfaces_whitelist.php index d13b380a..24b50165 100644 --- a/config/snort-dev/snort_interfaces_whitelist.php +++ b/config/snort-dev/snort_interfaces_whitelist.php @@ -67,8 +67,19 @@ $a_whitelist = snortSql_fetchAllWhitelistTypes('SnortWhitelist', 'SnortWhitelist +
-


Please Wait...

+
+
+ +
+
+



Please Wait...

+
+
+

+
+
diff --git a/config/snort-dev/snort_interfaces_whitelist_edit.php b/config/snort-dev/snort_interfaces_whitelist_edit.php index 44b1d0f2..bcde7847 100644 --- a/config/snort-dev/snort_interfaces_whitelist_edit.php +++ b/config/snort-dev/snort_interfaces_whitelist_edit.php @@ -99,7 +99,7 @@ $vpnips_on = ($vpnips_chk == 'on' ? 'checked' : ''); - $pgtitle = "Services: Snort: Whitelist"; + $pgtitle = "Services: Snort: Whitelist Edit"; include("/usr/local/pkg/snort/snort_head.inc"); ?> @@ -107,9 +107,19 @@ $vpnips_on = ($vpnips_chk == 'on' ? 'checked' : ''); - +
-


Please Wait...

+
+
+ +
+
+



Please Wait...

+
+
+

+
+
diff --git a/config/snort-dev/snort_json_post.php b/config/snort-dev/snort_json_post.php index 7ec85d4d..986493b5 100644 --- a/config/snort-dev/snort_json_post.php +++ b/config/snort-dev/snort_json_post.php @@ -43,6 +43,7 @@ require_once("guiconfig.inc"); require_once("/usr/local/pkg/snort/snort_new.inc"); +require_once("/usr/local/pkg/snort/snort_build.inc"); // unset crsf checks if(isset($_POST['__csrf_magic'])) { @@ -78,29 +79,32 @@ if ($_POST['snortSidRuleEdit'] == 1) { // row from db by uuid if ($_POST['snortSaveRuleSets'] == 1) { - - function snortSaveRuleSetsFunc() - { - if ($_POST['ifaceTab'] == 'snort_rulesets') { - // unset POSTs that are markers not in db - unset($_POST['snortSaveRuleSets']); - unset($_POST['ifaceTab']); + if ($_POST['ifaceTab'] == 'snort_rulesets') { - snortJsonReturnCode(snortSql_updateRuleSetList()); - } - + function snortSaveRuleSetsRulesetsFunc() + { + // unset POSTs that are markers not in db + unset($_POST['snortSaveRuleSets']); + unset($_POST['ifaceTab']); + + snortJsonReturnCode(snortSql_updateRuleSetList()); + build_snort_settings($_POST['uuid']); + } + snortSaveRuleSetsRulesetsFunc(); + } - if ($_POST['ifaceTab'] == 'snort_rules') { - // unset POSTs that are markers not in db - unset($_POST['snortSaveRuleSets']); - unset($_POST['ifaceTab']); - - snortJsonReturnCode(snortSql_updateRuleSigList()); - } - - } - snortSaveRuleSetsFunc(); + if ($_POST['ifaceTab'] == 'snort_rules') { + function snortSaveRuleSetsRulesFunc() + { + // unset POSTs that are markers not in db + unset($_POST['snortSaveRuleSets']); + unset($_POST['ifaceTab']); + + snortJsonReturnCode(snortSql_updateRuleSigList()); + } + snortSaveRuleSetsRulesFunc(); + } } // END of rulesSets @@ -203,6 +207,10 @@ if ($_POST['snortSaveSettings'] == 1) { } + //if (empty($_POST['oinkmastercode'])) { + // $_POST['oinkmastercode'] = 'empty'; + //} + // unset POSTs that are markers not in db unset($_POST['snortSaveSettings']); unset($_POST['ifaceTab']); @@ -217,92 +225,112 @@ if ($_POST['snortSaveSettings'] == 1) { // snort interface edit if ($_POST['ifaceTab'] == 'snort_interfaces_edit') { - - if (!isset($_POST['enable'])) - $_POST['enable'] = ($_POST['enable'] == '' ? off : $_POST['enable']); - - if (!isset($_POST['blockoffenders7'])) - $_POST['blockoffenders7'] = ($_POST['blockoffenders7'] == '' ? off : $_POST['blockoffenders7']); - - if (!isset($_POST['alertsystemlog'])) - $_POST['alertsystemlog'] = ($_POST['alertsystemlog'] == '' ? off : $_POST['alertsystemlog']); - - if (!isset($_POST['tcpdumplog'])) - $_POST['tcpdumplog'] = ($_POST['tcpdumplog'] == '' ? off : $_POST['tcpdumplog']); - - if (!isset($_POST['snortunifiedlog'])) - $_POST['snortunifiedlog'] = ($_POST['snortunifiedlog'] == '' ? off : $_POST['snortunifiedlog']); - - // convert textbox to base64 - $_POST['configpassthru'] = base64_encode($_POST['configpassthru']); - /* - * make dir for the new iface, if iface exists or rule dir has changed redo soft link - * may need to move this as a func to new_snort.inc - */ - - $newSnortDir = 'sn_' . $_POST['uuid']; - $pathToSnortDir = '/usr/local/etc/snort'; - - // creat iface dir and ifcae rules dir - if (!is_dir("{$pathToSnortDir}/{$newSnortDir}")) { - createNewIfaceDir($pathToSnortDir, $newSnortDir); - } //end of mkdir + function SnortIfaces_Snort_Interfaces_edit() + { + if (!isset($_POST['enable'])) + $_POST['enable'] = ($_POST['enable'] == '' ? off : $_POST['enable']); + + if (!isset($_POST['blockoffenders7'])) + $_POST['blockoffenders7'] = ($_POST['blockoffenders7'] == '' ? off : $_POST['blockoffenders7']); + + if (!isset($_POST['alertsystemlog'])) + $_POST['alertsystemlog'] = ($_POST['alertsystemlog'] == '' ? off : $_POST['alertsystemlog']); + + if (!isset($_POST['tcpdumplog'])) + $_POST['tcpdumplog'] = ($_POST['tcpdumplog'] == '' ? off : $_POST['tcpdumplog']); + + if (!isset($_POST['snortunifiedlog'])) + $_POST['snortunifiedlog'] = ($_POST['snortunifiedlog'] == '' ? off : $_POST['snortunifiedlog']); - // change the rule path - if (is_dir("{$pathToSnortDir}/{$newSnortDir}")) { + // convert textbox to base64 + $_POST['configpassthru'] = base64_encode($_POST['configpassthru']); + + /* + * make dir for the new iface, if iface exists or rule dir has changed redo soft link + * may need to move this as a func to new_snort.inc + */ + + $newSnortDir = 'sn_' . $_POST['uuid']; + $pathToSnortDir = '/usr/local/etc/snort'; - $snortCurrentRuleDbName = snortSql_fetchAllSettings('snortDB', 'snortIfaces', 'uuid', $_POST['uuid']); - - if ($_POST['ruledbname'] !== $snortCurrentRuleDbName['ruledbname'] || !file_exists("{$pathToSnortDir}/{$newSnortDir}/rules")) { + // creat iface dir and ifcae rules dir + if (!is_dir("{$pathToSnortDir}/{$newSnortDir}")) { + createNewIfaceDir($pathToSnortDir, $newSnortDir); + } //end of mkdir - // NOTE: use full paths or link rm will not work, Freebsd love - exec("/bin/rm {$pathToSnortDir}/{$newSnortDir}/rules"); - exec("/bin/ln -s /usr/local/etc/snort/snortDBrules/DB/{$_POST['ruledbname']}/rules {$pathToSnortDir}/{$newSnortDir}/rules"); + // change the rule path + if (is_dir("{$pathToSnortDir}/{$newSnortDir}")) { + + $snortCurrentRuleDbName = snortSql_fetchAllSettings('snortDB', 'snortIfaces', 'uuid', $_POST['uuid']); + + if ($_POST['ruledbname'] !== $snortCurrentRuleDbName['ruledbname'] || !file_exists("{$pathToSnortDir}/{$newSnortDir}/rules")) { + + // NOTE: use full paths or link rm will not work, Freebsd love + exec("/bin/rm {$pathToSnortDir}/{$newSnortDir}/rules"); + exec("/bin/ln -s /usr/local/etc/snort/snortDBrules/DB/{$_POST['ruledbname']}/rules {$pathToSnortDir}/{$newSnortDir}/rules"); + + } } - - } + } + SnortIfaces_Snort_Interfaces_edit(); } // end of snort_interfaces_edit // snort preprocessor edit if ($_POST['ifaceTab'] == 'snort_preprocessors') { - - if (!isset($_POST['dce_rpc_2'])) - $_POST['dce_rpc_2'] = ($_POST['dce_rpc_2'] == '' ? off : $_POST['dce_rpc_2']); - - if (!isset($_POST['dns_preprocessor'])) - $_POST['dns_preprocessor'] = ($_POST['dns_preprocessor'] == '' ? off : $_POST['dns_preprocessor']); - - if (!isset($_POST['ftp_preprocessor'])) - $_POST['ftp_preprocessor'] = ($_POST['ftp_preprocessor'] == '' ? off : $_POST['ftp_preprocessor']); - - if (!isset($_POST['http_inspect'])) - $_POST['http_inspect'] = ($_POST['http_inspect'] == '' ? off : $_POST['http_inspect']); - - if (!isset($_POST['other_preprocs'])) - $_POST['other_preprocs'] = ($_POST['other_preprocs'] == '' ? off : $_POST['other_preprocs']); - - if (!isset($_POST['perform_stat'])) - $_POST['perform_stat'] = ($_POST['perform_stat'] == '' ? off : $_POST['perform_stat']); - - if (!isset($_POST['sf_portscan'])) - $_POST['sf_portscan'] = ($_POST['sf_portscan'] == '' ? off : $_POST['sf_portscan']); - - if (!isset($_POST['smtp_preprocessor'])) - $_POST['smtp_preprocessor'] = ($_POST['smtp_preprocessor'] == '' ? off : $_POST['smtp_preprocessor']); + function SnortIfaces_Snort_PreprocessorsFunc() + { + if (!isset($_POST['dce_rpc_2'])) { + $_POST['dce_rpc_2'] = ($_POST['dce_rpc_2'] == '' ? off : $_POST['dce_rpc_2']); + } + + if (!isset($_POST['dns_preprocessor'])) { + $_POST['dns_preprocessor'] = ($_POST['dns_preprocessor'] == '' ? off : $_POST['dns_preprocessor']); + } + + if (!isset($_POST['ftp_preprocessor'])) { + $_POST['ftp_preprocessor'] = ($_POST['ftp_preprocessor'] == '' ? off : $_POST['ftp_preprocessor']); + } + + if (!isset($_POST['http_inspect'])) { + $_POST['http_inspect'] = ($_POST['http_inspect'] == '' ? off : $_POST['http_inspect']); + } + + if (!isset($_POST['other_preprocs'])) { + $_POST['other_preprocs'] = ($_POST['other_preprocs'] == '' ? off : $_POST['other_preprocs']); + } + + if (!isset($_POST['perform_stat'])) { + $_POST['perform_stat'] = ($_POST['perform_stat'] == '' ? off : $_POST['perform_stat']); + } + + if (!isset($_POST['sf_portscan'])) { + $_POST['sf_portscan'] = ($_POST['sf_portscan'] == '' ? off : $_POST['sf_portscan']); + } + + if (!isset($_POST['smtp_preprocessor'])) { + $_POST['smtp_preprocessor'] = ($_POST['smtp_preprocessor'] == '' ? off : $_POST['smtp_preprocessor']); + } + + } + SnortIfaces_Snort_PreprocessorsFunc(); } // snort barnyard edit - if ($_POST['ifaceTab'] == 'snort_barnyard') { - // make shure iface is lower case - $_POST['interface'] = strtolower($_POST['interface']); - - if (!isset($_POST['barnyard_enable'])) - $_POST['barnyard_enable'] = ($_POST['barnyard_enable'] == '' ? off : $_POST['barnyard_enable']); - + if ($_POST['ifaceTab'] == 'snort_barnyard') { + function SnortIfaces_Snort_Barnyard() + { + // make shure iface is lower case + $_POST['interface'] = strtolower($_POST['interface']); + + if (!isset($_POST['barnyard_enable'])) { + $_POST['barnyard_enable'] = ($_POST['barnyard_enable'] == '' ? off : $_POST['barnyard_enable']); + } + } + SnortIfaces_Snort_Barnyard(); } @@ -310,7 +338,8 @@ if ($_POST['snortSaveSettings'] == 1) { unset($_POST['snortSaveSettings']); unset($_POST['ifaceTab']); - snortJsonReturnCode(snortSql_updateSettings('uuid', $_POST['uuid'])); + snortJsonReturnCode(snortSql_updateSettings('uuid', $_POST['uuid'])); + build_snort_settings($_POST['uuid']); } // end of dbTable SnortIfaces diff --git a/config/snort-dev/snort_new.inc b/config/snort-dev/snort_new.inc index b2e48a2a..073319ca 100644 --- a/config/snort-dev/snort_new.inc +++ b/config/snort-dev/snort_new.inc @@ -91,7 +91,7 @@ function createNewIfaceDir($pathToSnortDir, $newSnortDir) { exec("/bin/mkdir -p {$pathToSnortDir}/{$newSnortDir}"); // create rules dir soft link if setting is default - if ($_POST['ruledbname'] === 'default' || $_POST['ruledbname'] === '') { + if ($_POST['ruledbname'] === 'default' || empty($_POST['ruledbname'])) { if (!file_exists("{$pathToSnortDir}/sn_{$_POST['uuid']}/rules") && file_exists('/usr/local/etc/snort/snortDBrules/DB/default/rules')) { exec("/bin/ln -s {$pathToSnortDir}/snortDBrules/DB/default/rules {$pathToSnortDir}/sn_{$_POST['uuid']}/rules"); } @@ -258,7 +258,7 @@ function snortSql_updateRuleSigList() $sidLine = preg_replace($replaceChars, '', $matches[0]); - if ($sidLine == '') { + if (empty($sidLine)) { $tempstring[] = $sigLine; }else{ @@ -470,7 +470,7 @@ function snortSql_fetchAllInterfaceRules($table, $dbname) function snortSql_fetchAllSettings($dbname, $table, $type, $id_uuid) { - if ($dbname == '' || $table == '' || $type == '') { + if (empty($dbname) || empty($table) || empty($type)) { return false; } @@ -541,8 +541,7 @@ function snortSql_updateSettings($type, $id_uuid) unset($settings['dbTable']); // START add new row if not set - if ($type == 'uuid') - { + if ($type == 'uuid') { $query_ck = sqlite_query($mydb, // @ supress warnings usonly in production "SELECT * FROM {$table} WHERE uuid = '{$id_uuid}'; @@ -550,15 +549,13 @@ function snortSql_updateSettings($type, $id_uuid) $query_ckFinal = sqlite_fetch_all($query_ck, SQLITE_ASSOC); - if (empty($query_ckFinal)) - { + if (empty($query_ckFinal)) { $query_ck = sqlite_query($mydb, // @ supress warnings usonly in production "INSERT INTO {$table} (date, uuid) VALUES ('{$settings['date']}', '{$settings['uuid']}'); "); - if (sqlite_changes($mydb) < 1) - { + if (sqlite_changes($mydb) < 1) { sqlite_close($mydb); return 'Error in query'; } @@ -583,7 +580,7 @@ function snortSql_updateSettings($type, $id_uuid) $i++; - if ($kv[$i] != '' && $val[$i] != '') + if (!empty($kv[$i])) { if ($type == 'id') @@ -620,8 +617,7 @@ function snortSql_updateSettings($type, $id_uuid) function snortSql_fetchAllWhitelistTypes($table, $table2) { - if ($table == '') - { + if (empty($table)) { return false; } @@ -634,8 +630,7 @@ function snortSql_fetchAllWhitelistTypes($table, $table2) $chktable = sqlite_fetch_all($result, SQLITE_ASSOC); - if ($chktable == '') - { + if (empty($chktable)) { return false; } @@ -680,7 +675,7 @@ function snortSql_fetchAllWhitelistTypes($table, $table2) function snortSql_updateWhitelistIps($newPostListips) { - if($newPostListips == '') + if(empty($newPostListips)) { return true; } @@ -912,7 +907,7 @@ function sendFileSnortLogDownload() { $file_name = "snort_blocked_{$file_name_date}.tar.gz"; } - if ($file_name == '') { + if (empty($file_name)) { echo 'Error no saved file.'; return false; } @@ -977,7 +972,7 @@ function post_delete_logs() foreach ($rule_array as $value) { - if ($id == '') { + if (empty($id)) { $id = 0; } @@ -1087,17 +1082,21 @@ function snortRemoveBlockedIPs() { /* returns true if $name is a valid name for a whitelist file name or ip */ function is_validFileName($name) { - if ($name == '') + if (empty($name)) { return false; + } - if (!is_string($name)) + if (!is_string($name)) { return false; + } - if (preg_match("/\s+/", $name)) + if (preg_match("/\s+/", $name)) { return false; + } - if (!preg_match("/[^a-zA-Z0-9\-_]/", $name)) + if (!preg_match("/[^a-zA-Z0-9\-_]/", $name)) { return true; + } return false; } @@ -1122,8 +1121,7 @@ function genAlphaNumMixFast($min = 14, $max = 28) $randAlpaNum = ''; - if (is_array($rand_keys)) - { + if (is_array($rand_keys)) { foreach ($rand_keys as $key) { $randAlpaNum .= $pool[$key]; @@ -1143,8 +1141,7 @@ function snortScanDirFilter($path, $filtername) $listDir = array(); $listDir = scandir("{$path}"); - if ($filtername == '') - { + if (empty($filtername)) { return $listDir; @@ -1153,8 +1150,7 @@ function snortScanDirFilter($path, $filtername) $pattern = "/{$filtername}/"; foreach ( $listDir as $val ) { - if (preg_match($pattern, $val)) - { + if (preg_match($pattern, $val)) { $filterDirList[] = $val; } } diff --git a/config/snort-dev/snort_preprocessors.php b/config/snort-dev/snort_preprocessors.php index dc788045..ad61afe0 100644 --- a/config/snort-dev/snort_preprocessors.php +++ b/config/snort-dev/snort_preprocessors.php @@ -66,8 +66,19 @@ $a_list = snortSql_fetchAllSettings('snortDB', 'SnortIfaces', 'uuid', $uuid); +
-


Please Wait...

+
+
+ +
+
+



Please Wait...

+
+
+

+
+
diff --git a/config/snort-dev/snort_rules.php b/config/snort-dev/snort_rules.php index 8285c9fa..31227319 100644 --- a/config/snort-dev/snort_rules.php +++ b/config/snort-dev/snort_rules.php @@ -153,9 +153,19 @@ function load_rule_file($incoming_file, $splitcontents) - +
-


Please Wait...

+
+
+ +
+
+



Please Wait...

+
+
+

+
+
diff --git a/config/snort-dev/snort_rulesets.php b/config/snort-dev/snort_rulesets.php index dac80023..d006c481 100644 --- a/config/snort-dev/snort_rulesets.php +++ b/config/snort-dev/snort_rulesets.php @@ -178,8 +178,19 @@ jQuery(document).ready(function() { +
-


Please Wait...

+
+
+ +
+
+



Please Wait...

+
+
+

+
+
@@ -268,6 +279,7 @@ jQuery(document).ready(function() { + -- cgit v1.2.3