aboutsummaryrefslogtreecommitdiffstats
path: root/config/snort/snort_rules_edit.php
diff options
context:
space:
mode:
Diffstat (limited to 'config/snort/snort_rules_edit.php')
-rw-r--r--config/snort/snort_rules_edit.php186
1 files changed, 93 insertions, 93 deletions
diff --git a/config/snort/snort_rules_edit.php b/config/snort/snort_rules_edit.php
index f111536f..09e39e7a 100644
--- a/config/snort/snort_rules_edit.php
+++ b/config/snort/snort_rules_edit.php
@@ -1,40 +1,40 @@
<?php
/*
- system_edit.php
- Copyright (C) 2004, 2005 Scott Ullrich
- All rights reserved.
-
- Adapted for FreeNAS by Volker Theile (votdev@gmx.de)
- Copyright (C) 2006-2009 Volker Theile
-
- Adapted for Pfsense Snort package by Robert Zelaya
- Copyright (C) 2008-2009 Robert Zelaya
-
- Using dp.SyntaxHighlighter for syntax highlighting
- http://www.dreamprojections.com/SyntaxHighlighter
- Copyright (C) 2004-2006 Alex Gorbatchev. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- 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
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- 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.
-*/
+ system_edit.php
+ Copyright (C) 2004, 2005 Scott Ullrich
+ All rights reserved.
+
+ Adapted for FreeNAS by Volker Theile (votdev@gmx.de)
+ Copyright (C) 2006-2009 Volker Theile
+
+ Adapted for Pfsense Snort package by Robert Zelaya
+ Copyright (C) 2008-2009 Robert Zelaya
+
+ Using dp.SyntaxHighlighter for syntax highlighting
+ http://www.dreamprojections.com/SyntaxHighlighter
+ Copyright (C) 2004-2006 Alex Gorbatchev. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ 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
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ 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.inc");
@@ -49,12 +49,12 @@ $a_nat = &$config['installedpackages']['snortglobal']['rule'];
$id = $_GET['id'];
if (isset($_POST['id']))
- $id = $_POST['id'];
-
+$id = $_POST['id'];
+
$ids = $_GET['ids'];
if (isset($_POST['ids']))
- $ids = $_POST['ids'];
-
+$ids = $_POST['ids'];
+
if (isset($id) && $a_nat[$id]) {
@@ -96,20 +96,20 @@ $tempstring = $splitcontents[$lineid];
function write_rule_file($content_changed, $received_file)
{
- //read snort file with writing enabled
- $filehandle = fopen($received_file, "w");
+ //read snort file with writing enabled
+ $filehandle = fopen($received_file, "w");
- //delimiter for each new rule is a new line
- $delimiter = "\n";
+ //delimiter for each new rule is a new line
+ $delimiter = "\n";
- //implode the array back into a string for writing purposes
- $fullfile = implode($delimiter, $content_changed);
+ //implode the array back into a string for writing purposes
+ $fullfile = implode($delimiter, $content_changed);
- //write data to file
- fwrite($filehandle, $fullfile);
+ //write data to file
+ fwrite($filehandle, $fullfile);
- //close file handle
- fclose($filehandle);
+ //close file handle
+ fclose($filehandle);
}
@@ -117,7 +117,7 @@ function write_rule_file($content_changed, $received_file)
if($_POST['highlight'] <> "") {
if($_POST['highlight'] == "yes" or
- $_POST['highlight'] == "enabled") {
+ $_POST['highlight'] == "enabled") {
$highlight = "yes";
} else {
$highlight = "no";
@@ -127,30 +127,30 @@ if($_POST['highlight'] <> "") {
}
if($_POST['rows'] <> "")
- $rows = $_POST['rows'];
+$rows = $_POST['rows'];
else
- $rows = 1;
+$rows = 1;
if($_POST['cols'] <> "")
- $cols = $_POST['cols'];
+$cols = $_POST['cols'];
else
- $cols = 66;
+$cols = 66;
if ($_POST)
{
if ($_POST['save']) {
-
+
/* get the changes */
- $rule_content2 = $_POST['code'];
-
+ $rule_content2 = $_POST['code'];
+
//copy string into file array for writing
- $splitcontents[$lineid] = $rule_content2;
-
- //write the new .rules file
- write_rule_file($splitcontents, $file);
-
- header("Location: /snort/snort_view_edit.php?id=$id&openruleset=$file&ids=$ids");
-
+ $splitcontents[$lineid] = $rule_content2;
+
+ //write the new .rules file
+ write_rule_file($splitcontents, $file);
+
+ header("Location: /snort/snort_view_edit.php?id=$id&openruleset=$file&ids=$ids");
+
}
}
@@ -165,13 +165,12 @@ $pgtitle = array(gettext("Advanced"), gettext("File Editor"));
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="tabcont">
- <form action="snort_view_edit.php?id=<?=$id; ?>&openruleset=<?=$file; ?>&ids=<?=$ids; ?>" method="post">
- <?php if ($savemsg) print_info_box($savemsg);?>
-
- <?php
- if ($file != '/usr/local/etc/snort/snort_update.log')
- {
-
+ <form
+ action="snort_view_edit.php?id=<?=$id; ?>&openruleset=<?=$file; ?>&ids=<?=$ids; ?>"
+ method="post"><?php if ($savemsg) print_info_box($savemsg);?> <?php
+ if ($file != '/usr/local/etc/snort/snort_update.log')
+ {
+
echo '
<table width="100%" cellpadding="9" cellspacing="9" bgcolor="#eeeeee">
<tr>
@@ -179,9 +178,9 @@ $pgtitle = array(gettext("Advanced"), gettext("File Editor"));
<input name="save" type="submit" class="formbtn" id="save" value="save" /> <input type="button" class="formbtn" value="Cancel" onclick="history.back()">
<hr noshade="noshade" />
' . "\n";
-
- echo 'Disable original rule :';
-
+
+ echo 'Disable original rule :';
+
echo ' <input id="highlighting_enabled" name="highlight2" type="radio" value="yes"'; if($highlight == "yes") echo " checked=\"checked\""; echo '/>
<label for="highlighting_enabled">'; gettext("Enabled"); echo '</label>
@@ -201,28 +200,29 @@ $pgtitle = array(gettext("Advanced"), gettext("File Editor"));
</td>
</tr>
</table>';
-
- }
- ?>
-
- <table width='100%'>
- <tr>
- <td valign="top" class="label">
- <div style="background: #eeeeee;" id="textareaitem">
- <!-- NOTE: The opening *and* the closing textarea tag must be on the same line. -->
- <textarea <? if ($file != '/usr/local/etc/snort/snort_update.log') { echo 'disabled'; } ?> wrap="off" style="width: 98%; margin: 7px;" class="<?php echo $language; ?>:showcolumns" rows="33" cols="<?php echo $cols; ?>" name="code2"><?php echo $contents2;?></textarea>
- </div>
- </td>
- </tr>
- </table>
- <?php // include("formend.inc");?>
- </form>
- <? echo "$file\n"; ?>
- </td>
+
+ }
+ ?>
+
+ <table width='100%'>
+ <tr>
+ <td valign="top" class="label">
+ <div style="background: #eeeeee;" id="textareaitem"><!-- NOTE: The opening *and* the closing textarea tag must be on the same line. -->
+ <textarea
+ <? if ($file != '/usr/local/etc/snort/snort_update.log') { echo 'disabled'; } ?>
+ wrap="off" style="width: 98%; margin: 7px;"
+ class="<?php echo $language; ?>:showcolumns" rows="33"
+ cols="<?php echo $cols; ?>" name="code2"><?php echo $contents2;?></textarea>
+ </div>
+ </td>
+ </tr>
+ </table>
+ <?php // include("formend.inc");?></form>
+ <? echo "$file\n"; ?></td>
</tr>
</table>
-<?php //include("fend.inc");?>
+ <?php //include("fend.inc");?>
</body>
</html>