&1", $output, $retcode); if (intval($retcode) != 0) { $error = ""; $start = count($output); $end = $start - 4; for($i = $start; $i > $end; $i--) $error .= $output[$i]; $input_errors[] = "Custom rules have errors:\n {$error}"; } else { header("Location: /snort/snort_rules.php?id={$id}&openruleset={$currentruleset}"); exit; } } else if ($_POST) { unset($a_rule[$id]['customrules']); write_config(); header("Location: /snort/snort_rules.php?id={$id}&openruleset={$currentruleset}"); exit; } require_once("guiconfig.inc"); include_once("head.inc"); $if_friendly = snort_get_friendly_interface($pconfig['interface']); $pgtitle = "Snort: {$if_friendly} Category: $currentruleset"; ?> ' . $pgtitle . '

';} /* Display message */ if ($input_errors) { print_input_errors($input_errors); // TODO: add checks } if ($savemsg) { print_info_box($savemsg); } ?>
$value ) { $disabled = "False"; $comments = "False"; $findme = "# alert"; //find string for disabled alerts $disabled_pos = strstr($value, $findme); $counter2 = 1; $sid = snort_get_rule_part($value, 'sid:', ';', 0); //check to see if the sid is numberical if (!is_numeric($sid)) continue; //if find alert is false, then rule is disabled if ($disabled_pos !== false){ $counter2 = $counter2+1; $textss = ""; $textse = ""; $iconb = "icon_block_d.gif"; $ischecked = ""; } else { $textss = $textse = ""; $iconb = "icon_block.gif"; $ischecked = "checked"; } $rule_content = explode(' ', $value); $protocol = $rule_content[$counter2];//protocol location $counter2++; $source = substr($rule_content[$counter2], 0, 20) . "...";//source location $counter2++; $source_port = $rule_content[$counter2];//source port location $counter2 = $counter2+2; $destination = substr($rule_content[$counter2], 0, 20) . "...";//destination location $counter2++; $destination_port = $rule_content[$counter2];//destination port location if (strstr($value, 'msg: "')) $message = snort_get_rule_part($value, 'msg: "', '";', 0); else if (strstr($value, 'msg:"')) $message = snort_get_rule_part($value, 'msg:"', '";', 0); echo ""; ?>
 
Category:
 
 
 
     
  SID Proto Source Port Destination Port Message  
$textss $textse $textss $sid $textse $textss $protocol $textse $textss $source $textse $textss $source_port $textse $textss $destination $textse $textss $destination_port $textse $textss $message $textse
Rule Enabled
Rule Disabled