$rule_content = explode(' ', $tempstring); $protocol = $rule_content[$counter2]; //protocol location $counter2++; $source = $rule_content[$counter2]; //source location $counter2++; $source_port = $rule_content[$counter2]; //source port location $counter2 = $counter2 + 2; $destination = $rule_content[$counter2]; //destination location $counter2++; $destination_port = $rule_content[$counter2]; //destination port location $message = get_middle($tempstring, 'msg:"', '";', 0); echo "<tr>"; echo "<td class=\"listt\">"; echo $textss; ?> <a href="?&openruleset=<?php echo $file; ?> &act=toggle&id=<?php echo $counter; ?> "><img src="./themes/<?php echo $g['theme']; ?> /images/icons/<?php echo $iconb;
if ($key % 2) { echo ' class="shading_light"'; } echo '> <td>' . $resource[1] . '</td> <td style="width: 150px"><a href="http://' . $resource[0] . '">' . $resource[0] . '</a></td> </tr> '; } echo ' </tbody> </table> '; } ?> <div class="clear spacer_ver_medium"></div> </div> <?php get_middle(); ?> <div class="main main_home"> <?php get_assides(); ?> </div> <?php get_footer();
//source location $counter2++; $source_port = $rule_content[$counter2]; //source port location $counter2++; $direction = $rule_content[$counter2]; $counter2++; $destination = $rule_content[$counter2]; //destination location $counter2++; $destination_port = $rule_content[$counter2]; //destination port location $message = get_middle($tempstring, 'msg:"', '";', 0); $content = get_middle($tempstring, 'content:"', '";', 0); $classtype = get_middle($tempstring, 'classtype:', ';', 0); $revision = get_middle($tempstring, 'rev:', ';', 0); $pgtitle = "Snort: Edit Rule"; require "guiconfig.inc"; include "head.inc"; ?> <body link="#0000CC" vlink="#0000CC" alink="#0000CC"> <?php include "fbegin.inc"; if (!$pgtitle_output) { echo "<p class=\"pgtitle\"><?={$pgtitle}?></p>"; } ?> <table width="99%" border="0" cellpadding="0" cellspacing="0"> <tr>
$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 = get_middle($value, 'msg: "', '";', 0); } else { if (strstr($value, 'msg:"')) { $message = get_middle($value, 'msg:"', '";', 0); } } echo "<tr><td class=\"listt\"> {$textss}\n"; ?> <a href="?id=<?php echo $id; ?> &openruleset=<?php echo $rulefile; ?> &act=toggle&ids=<?php echo $counter; ?> "><img src="../themes/<?php
$middle_pos = $beginning_pos + strlen($beginning); $ending_pos = strpos($source, $ending, $beginning_pos); $middle = substr($source, $middle_pos, $ending_pos - $middle_pos); return $middle; } } if ($_POST) { if ($_POST['save']) { //copy string into file array for writing if ($_POST['highlight'] == "yes") { $splitcontents[$lineid] = $_POST['code']; } else { $splitcontents[$lineid] = "# " . $_POST['code']; } //write disable/enable sid to config.xml $sid = get_middle($splitcontents[$lineid], 'sid:', ';', 0); if (is_numeric($sid)) { // rule_sid_on registers if (!empty($a_nat[$id]['rule_sid_on'])) { $a_nat[$id]['rule_sid_on'] = str_replace("||enablesid {$sid}", "", $a_nat[$id]['rule_sid_on']); } if (!empty($a_nat[$id]['rule_sid_on'])) { $a_nat[$id]['rule_sid_off'] = str_replace("||disablesid {$sid}", "", $a_nat[$id]['rule_sid_off']); } if ($_POST['highlight'] == "yes") { $a_nat[$id]['rule_sid_on'] = "||enablesid {$sid}" . $a_nat[$id]['rule_sid_on']; } else { $a_nat[$id]['rule_sid_off'] = "||disablesid {$sid}" . $a_nat[$id]['rule_sid_off']; } } //write the new .rules file