. 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("guiconfig.inc"); require_once("functions.inc"); require_once("/usr/local/pkg/snort/snort.inc"); // Set who called us so we can return to the correct page with // the RETURN button. We will just trust this User-Agent supplied // string for now. Check and make sure we don't store this page // as the referrer so we don't stick the user in a loop. session_start(); if(!isset($_SESSION['org_referer']) && strpos($_SERVER['HTTP_REFERER'], $SERVER['PHP_SELF']) === false) $_SESSION['org_referer'] = substr($_SERVER['HTTP_REFERER'], 0, strpos($_SERVER['HTTP_REFERER'], "?")); $referrer = $_SESSION['org_referer']; // Get the QUERY_STRING from our referrer so we can return it. if(!isset($_SESSION['org_querystr'])) $_SESSION['org_querystr'] = $_SERVER['QUERY_STRING']; $querystr = $_SESSION['org_querystr']; // Retrieve any passed QUERY STRING or POST variables $type = $_GET['type']; $varname = $_GET['varname']; $multi_ip = $_GET['multi_ip']; if (isset($_POST['type'])) $type = $_POST['type']; if (isset($_POST['varname'])) $varname = $_POST['varname']; if (isset($_POST['multi_ip'])) $multi_ip = $_POST['multi_ip']; // Make sure we have a valid VARIABLE name // and ALIAS TYPE, or else bail out. if (is_null($type) || is_null($varname)) { session_start(); unset($_SESSION['org_referer']); unset($_SESSION['org_querystr']); session_write_close(); header("Location: http://{$referrer}?{$querystr}"); exit; } // Used to track if any selectable Aliases are found $selectablealias = false; // Initialize required array variables as necessary if (!is_array($config['aliases']['alias'])) $config['aliases']['alias'] = array(); $a_aliases = $config['aliases']['alias']; // Create an array consisting of the Alias types the // caller wants to select from. $a_types = array(); $a_types = explode('|', strtolower($type)); // Create a proper title based on the Alias types $title = "a"; switch (count($a_types)) { case 1: $title .= " " . ucfirst($a_types[0]); break; case 2: $title .= " " . ucfirst($a_types[0]) . " or " . ucfirst($a_types[1]); break; case 3: $title .= " " . ucfirst($a_types[0]) . ", " . ucfirst($a_types[1]) . " or " . ucfirst($a_types[2]); default: $title = "n"; } if ($_POST['cancel']) { session_start(); unset($_SESSION['org_referer']); unset($_SESSION['org_querystr']); session_write_close(); header("Location: {$referrer}?{$querystr}"); exit; } if ($_POST['save']) { if(empty($_POST['alias'])) $input_errors[] = gettext("No alias is selected. Please select an alias before saving."); // if no errors, write new entry to conf if (!$input_errors) { $selection = $_POST['alias']; session_start(); unset($_SESSION['org_referer']); unset($_SESSION['org_querystr']); session_write_close(); header("Location: {$referrer}?{$querystr}&varvalue={$selection}"); exit; } } $pgtitle = gettext("Snort: Select {$title} Alias"); include("head.inc"); ?>

"; $textse = ""; $disable = true; $tooltip = gettext("Aliases resolving to multiple address entries cannot be used with the destination target."); } elseif (($alias['type'] == "network" || $alias['type'] == "host") && trim(filter_expand_alias($alias['name'])) == "") { $textss = ""; $textse = ""; $disable = true; $tooltip = gettext("Aliases representing a FQDN host cannot be used in Snort preprocessor configurations."); } else { $textss = ""; $textse = ""; $disable = ""; $selectablealias = true; $tooltip = gettext("Selected entry will be imported. Click to toggle selection."); } ?>
10) { echo "..."; } ?>  
"/>
"/>    "/>