]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blobdiff - html/cgi-bin/ids.cgi
ids.cgi: htmlcleanup, change html tags from uppercase to lowercase
[people/teissler/ipfire-2.x.git] / html / cgi-bin / ids.cgi
index c5fb4c6c762150e95f2c40feed454e7319fc4b78..984e795e72bf002446ee150166a174ef56c114e5 100644 (file)
@@ -2,7 +2,7 @@
 ###############################################################################
 #                                                                             #
 # IPFire.org - A linux based firewall                                         #
-# Copyright (C) 2005-2011  IPFire Team  <info@ipfire.org>                     #
+# Copyright (C) 2007-2013  IPFire Team  <info@ipfire.org>                     #
 #                                                                             #
 # This program is free software: you can redistribute it and/or modify        #
 # it under the terms of the GNU General Public License as published by        #
@@ -263,9 +263,11 @@ if (-e "/etc/snort/snort.conf") {
 #######################  End added for snort rules control  #################################
 
 if ($snortsettings{'RULES'} eq 'subscripted') {
-       $url=" http://www.snort.org/reg-rules/snortrules-snapshot-294_s.tar.gz/$snortsettings{'OINKCODE'}";
+       $url=" http://www.snort.org/sub-rules/snortrules-snapshot-2953.tar.gz/$snortsettings{'OINKCODE'}";
 } elsif ($snortsettings{'RULES'} eq 'registered') {
-       $url=" http://www.snort.org/reg-rules/snortrules-snapshot-294.tar.gz/$snortsettings{'OINKCODE'}";
+       $url=" http://www.snort.org/reg-rules/snortrules-snapshot-2950.tar.gz/$snortsettings{'OINKCODE'}";
+} elsif ($snortsettings{'RULES'} eq 'community') {
+       $url=" http://s3.amazonaws.com/snort-org/www/rules/community/community-rules.tar.gz";
 } else {
        $url="http://rules.emergingthreats.net/open/snort-2.9.0/emerging.rules.tar.gz";
 }
@@ -274,8 +276,9 @@ if ($snortsettings{'ACTION'} eq $Lang::tr{'save'} && $snortsettings{'ACTION2'} e
 {
        $errormessage = $Lang::tr{'invalid input for oink code'} unless (
            ($snortsettings{'OINKCODE'} =~ /^[a-z0-9]+$/)  ||
-           ($snortsettings{'RULESTYPE'} eq 'nothing' ) ||
-           ($snortsettings{'RULESTYPE'} eq 'community' ));
+           ($snortsettings{'RULES'} eq 'nothing' ) ||
+           ($snortsettings{'RULES'} eq 'emerging' ) ||
+           ($snortsettings{'RULES'} eq 'community' ));
 
        &General::writehash("${General::swroot}/snort/settings", \%snortsettings);
        if ($snortsettings{'ENABLE_SNORT'} eq 'on')
@@ -402,6 +405,7 @@ $checked{'ENABLE_GUARDIAN'}{'on'} = '';
 $checked{'ENABLE_GUARDIAN'}{$snortsettings{'ENABLE_GUARDIAN'}} = "checked='checked'";
 $selected{'RULES'}{'nothing'} = '';
 $selected{'RULES'}{'community'} = '';
+$selected{'RULES'}{'emerging'} = '';
 $selected{'RULES'}{'registered'} = '';
 $selected{'RULES'}{'subscripted'} = '';
 $selected{'RULES'}{$snortsettings{'RULES'}} = "selected='selected'";
@@ -409,9 +413,9 @@ $selected{'RULES'}{$snortsettings{'RULES'}} = "selected='selected'";
 &Header::openpage($Lang::tr{'intrusion detection system'}, 1, '');
 
 ####################### Added for snort rules control #################################
-print "<SCRIPT LANGUAGE='JavaScript' SRC='/include/snortupdateutility.js'></SCRIPT>";
+print "<script language='JavaScript' src='/include/snortupdateutility.js'></script>";
 print <<END
-<STYLE TYPE="text/css">
+<style type="text/css">
 <!--
 .section {
        border: groove;
@@ -429,7 +433,7 @@ print <<END
        background-color: #DCDCDC;
 }
 -->
-</STYLE>
+</style>
 END
 ;
 #######################  End added for snort rules control  #################################
@@ -487,7 +491,7 @@ END
        refreshpage();
 }
 
-&Header::openbox('100%', 'left', $Lang::tr{'intrusion detection system2'});
+&Header::openbox('100%', 'left', $Lang::tr{'intrusion detection system'});
 print <<END
 <form method='post' action='$ENV{'SCRIPT_NAME'}'><table width='100%'>
 <tr><td class='base'><input type='checkbox' name='ENABLE_SNORT_GREEN' $checked{'ENABLE_SNORT_GREEN'}{'on'} />GREEN Snort
@@ -507,7 +511,7 @@ if ( -e "/var/ipfire/guardian/guardian.conf" ) {
 print <<END
 </td></tr>
 <tr>
-       <td><hr /></td>
+       <td><br><br></td>
 </tr>
 <tr>
        <td><b>$Lang::tr{'ids rules update'}</b></td>
@@ -515,6 +519,7 @@ print <<END
 <tr>
        <td><select name='RULES'>
                                <option value='nothing' $selected{'RULES'}{'nothing'} >$Lang::tr{'no'}</option>
+                               <option value='emerging' $selected{'RULES'}{'emerging'} >$Lang::tr{'emerging rules'}</option>
                                <option value='community' $selected{'RULES'}{'community'} >$Lang::tr{'community rules'}</option>
                                <option value='registered' $selected{'RULES'}{'registered'} >$Lang::tr{'registered user rules'}</option>
                                <option value='subscripted' $selected{'RULES'}{'subscripted'} >$Lang::tr{'subscripted user rules'}</option>
@@ -531,7 +536,7 @@ print <<END
        <td nowrap='nowrap'>Oinkcode:&nbsp;<input type='text' size='40' name='OINKCODE' value='$snortsettings{'OINKCODE'}' /></td>
 </tr>
 <tr>
-       <td width='30%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'download new ruleset'}' />
+       <td width='30%' align='left'><br><input type='submit' name='ACTION' value='$Lang::tr{'download new ruleset'}' />
 END
 ;
 if ( -e "/var/tmp/snortrules.tar.gz"){
@@ -543,10 +548,10 @@ print "&nbsp;$Lang::tr{'updates installed'}: $snortsettings{'INSTALLDATE'}</td>"
 print <<END
 </tr>
 </table>
-<hr />
+<br><br>
 <table width='100%'>
 <tr>
-       <td align='center'><input type='hidden' name='ACTION2' value='snort' /><input type='submit' name='ACTION' value='$Lang::tr{'save'}' /></td>
+       <td align='right'><input type='hidden' name='ACTION2' value='snort' /><input type='submit' name='ACTION' value='$Lang::tr{'save'}' /></td>
 </tr>
 </table>
 </form>
@@ -574,7 +579,7 @@ END
        print `cat /var/ipfire/guardian/guardian.ignore`;
 print <<END
 </textarea></td></tr>
-<tr><td align='center' colspan='2'><input type='hidden' name='ACTION2' value='guardian' /><input type='submit' name='ACTION' value='$Lang::tr{'save'}' /></td></tr>
+<tr><td align='right' colspan='2'><input type='hidden' name='ACTION2' value='guardian' /><input type='submit' name='ACTION' value='$Lang::tr{'save'}' /></td></tr>
 </table>
 </form>
 END
@@ -589,7 +594,7 @@ END
 if ( -e "${General::swroot}/snort/enable" || -e "${General::swroot}/snort/enable_green" || -e "${General::swroot}/snort/enable_blue" || -e "${General::swroot}/snort/enable_orange" ) {
        &Header::openbox('100%', 'LEFT', $Lang::tr{'intrusion detection system rules'});
                # Output display table for rule files
-               print "<TABLE width='100%'><TR><TD VALIGN='TOP'><TABLE>";
+               print "<table width='100%'><tr><td valign='TOP'><table>";
 
                print "<form method='post'>";
 
@@ -610,7 +615,7 @@ if ( -e "${General::swroot}/snort/enable" || -e "${General::swroot}/snort/enable
 
                        # Check if reached half-way through rule file rules to start new column
                if ($ruledisplaycnt > $rulecnt) {
-                               print "</TABLE></TD><TD VALIGN='TOP'><TABLE>";
+                               print "</table></td><td valign='TOP'><table>";
                                $ruledisplaycnt = 0;
                        }
 
@@ -661,21 +666,21 @@ if ( -e "${General::swroot}/snort/enable" || -e "${General::swroot}/snort/enable
                        }
 
                        # Output rule file name and checkbox
-                       print "<TR><TD CLASS='base' VALIGN='TOP'><INPUT TYPE='checkbox' NAME='SNORT_RULE_$rulefile' $rulechecked> <A HREF='$rulefilelink'>$rulefile</A></TD></TR>";
-                       print "<TR><TD CLASS='base' VALIGN='TOP'>";
+                       print "<tr><td class='base' valign='TOP'><input type='checkbox' NAME='SNORT_RULE_$rulefile' $rulechecked> <a href='$rulefilelink'>$rulefile</a></td></tr>";
+                       print "<tr><td class='base' valign='TOP'>";
 
                        # Check for empty 'Description'
                        if ($snortrules{$rulefile}{'Description'} eq '') {
-                               print "<TABLE WIDTH='100%'><TR><TD CLASS='base'>No description available</TD></TR>";
+                               print "<table width='100%'><tr><td class='base'>No description available</td></tr>";
                        } else {
                                # Output rule file 'Description'
-                               print "<TABLE WIDTH='100%'><TR><TD CLASS='base'>$snortrules{$rulefile}{'Description'}</TD></TR>";
+                               print "<table width='100%'><tr><td class='base'>$snortrules{$rulefile}{'Description'}</td></tr>";
                        }
 
                        # Check for display flag
                        if ($displayrulefilerules) {
                                # Rule file definition rule display
-                               print "<TR><TD CLASS='base' VALIGN='TOP'><TABLE border=1><TR>";
+                               print "<tr><td class='base' valign='TOP'><table border='0'><tr>";
 
                                # Local vars
                                my $ruledefdisplaycnt = 0;
@@ -690,7 +695,7 @@ if ( -e "${General::swroot}/snort/enable" || -e "${General::swroot}/snort/enable
 
                                        # If have display 2 rules, start new row
                                        if (($ruledefdisplaycnt % 2) == 0) {
-                                               print "</TR><TR>";
+                                               print "</tr><tr>";
                                                $ruledefdisplaycnt = 0;
                                        }
 
@@ -702,7 +707,7 @@ if ( -e "${General::swroot}/snort/enable" || -e "${General::swroot}/snort/enable
                                        # Create rule file rule's checkbox
                                        $checkboxname = "SNORT_RULE_$rulefile";
                                        $checkboxname .= "_$ruledef";
-                                       print "<TD CLASS='base'><INPUT TYPE='checkbox' NAME='$checkboxname' $ruledefchecked> $snortrules{$rulefile}{'Definition'}{$ruledef}{'Description'}</TD>";
+                                       print "<td class='base'><input type='checkbox' NAME='$checkboxname' $ruledefchecked> $snortrules{$rulefile}{'Definition'}{$ruledef}{'Description'}</td>";
 
                                        # Increment count
                                        $ruledefdisplaycnt++;
@@ -710,26 +715,24 @@ if ( -e "${General::swroot}/snort/enable" || -e "${General::swroot}/snort/enable
 
                                # If do not have second rule for row, create empty cell
                                if (($ruledefdisplaycnt % 2) != 0) {
-                                       print "<TD CLASS='base'></TD>";
+                                       print "<td class='base'></td>";
                                }
 
                                # Close display table
-                               print "</TR></TABLE></TD></TR>";
+                               print "</tr></table></td></tr>";
                }
 
                        # Close display table
-                       print "</TABLE>";
+                       print "</table>";
 
                        # Increment ruledisplaycnt
                $ruledisplaycnt++;
                }
-       print "</TD></TR></TABLE></TD></TR></TABLE>";
+       print "</td></tr></table></td></tr></table>";
        print <<END
 <table width='100%'>
 <tr>
-       <td width='33%'>&nbsp;</td>
-       <td width='33%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'update'}' /></td>
-       <td width='33%'>
+       <td width='100%' align='right'><input type='submit' name='ACTION' value='$Lang::tr{'update'}' /></td>
                &nbsp; <!-- space for future online help link -->
        </td>
 </tr>