#  This software was derived from SATAN 1.1.1 by Dan Farmer and Wietse Venema
#  (http://www.porcupine.org/satan).
#
#
#
#
$_fp_text = "";
&make_severity_info();

if (sizeof(*severity_levels) > 0) {
	for $_severity_type (sort keys %severity_levels) {

		# how serious is it?
		if ($_severity_type eq "rs") {
			print CLIENT <<EOF;
			<P>
			<PRE>   </PRE><B><FONT COLOR=RED>
                        Root shell Problems (RED)</B></A></FONT>
			<HL>
			<UL>
EOF
			}
		elsif ($_severity_type eq "us") {
			print CLIENT <<EOF;
			<P>
			<PRE>   </PRE><B><FONT COLOR=RED>
                        User shell Problems (RED)</B></A></FONT>
			<HL>
			<UL>
EOF
			}
		elsif ($_severity_type eq "ns") {
			print CLIENT <<EOF;
			<P>
			<PRE>   </PRE><B><FONT COLOR=RED>
                        "nobody" shell Problems (RED)</B></A></FONT>
			<HL>
			<UL>
EOF
			}
		elsif ($_severity_type eq "ur") {
			print CLIENT <<EOF;
			<P>
			<PRE>   </PRE><B><FONT COLOR=RED>
                        User reading file problems (RED)</B></A></FONT>
			<HL>
			<UL>
EOF
			}
		elsif ($_severity_type eq "uw") {
			print CLIENT <<EOF;
			<P>
			<PRE>   </PRE><B><FONT COLOR=RED>
                        User writing file problems (RED)</B></A></FONT>
			<HL>
			<UL>
EOF
			}
		elsif ($_severity_type eq "nr") {
			print CLIENT <<EOF;
			<P>
			<PRE>   </PRE><B><FONT COLOR=RED>
                        "nobody" reading file problems (RED)</B></A></FONT>
			<HL>
			<UL>
EOF
			}
		elsif ($_severity_type eq "nw") {
			print CLIENT <<EOF;
			<P>
			<PRE>   </PRE><B><FONT COLOR=RED>
                        "nobody" writing file problems (RED)</B></A></FONT>
			<HL>
			<UL>
EOF
			}
		elsif ($_severity_type eq "x") {
			print CLIENT <<EOF;
			<P>
			<PRE>   </PRE><B><FONT COLOR=RED>
                        NFS Problems (RED)</B></A></FONT>
			<HL>
			<UL>
EOF
			}
			elsif ($_severity_type eq "bo") {
                        print CLIENT <<EOF;
                        <P>
                        <PRE>   </PRE><B><FONT COLOR=RED>
                        Root Access via Buffer Overflow (RED)</FONT></B></A>
                        <HL>
                        <UL>
EOF
                        }

	 	elsif ($_severity_type eq "ht") {
                        print CLIENT <<EOF;
                        <P>
                        <PRE>   </PRE><B><FONT COLOR=RED>
                        Evidence of Penetration (RED)</FONT></B></A>
                        <HL>
                        <UL>
EOF
                        }
                elsif ($_severity_type eq "rcio") {
                        print CLIENT <<EOF;
                        <HR>
                        <A NAME="red_checkit"><B><FONT COLOR=RED>Confirm Vulnerability by Version or Patch</FONT></B></A>
                        <HL>
                        <UL>
EOF
                        }

                elsif ($_severity_type eq "yus") {
                        print CLIENT <<EOF;
                        <P>
                        <PRE>   </PRE><B><FONT>
                        Probable Access (YELLOW)</FONT></B></A>
                        <HL>
                        <UL>
EOF
                        }

                 elsif ($_severity_type eq "ycio") {
                        print CLIENT <<EOF;
                        <P>
                        <PRE>   </PRE><B>
                        Target for Abuse(YELLOW)</B></A>
                        <HL>
                        <UL>
EOF
                        }

                if ($_severity_type eq "zcio") {
                        print CLIENT <<EOF;
                        <P>
                        <PRE>   </PRE><B><FONT COLOR=BROWN>
                        Possible Vulnerabilities (BROWN)</FONT></B></A>
                        <HL>
                        <UL>
EOF
			}
                if ($_severity_type eq "zwoi") {
                        print CLIENT <<EOF;
                        <P>
                        <PRE>   </PRE><B><FONT COLOR=BROWN>
                        Limit Internet Access ? (BROWN)</FONT> </B></A>
                        <HL>
                        <UL>
EOF
			}

		$_last_tmp = "";
		$_last_txt = "";
		# split all the targets into separate lines
		for $_tmp_host (sort keys %{$severity_levels{$_severity_type}}) {
		  for (sort split(/\n/, $severity_levels{$_severity_type}{$_tmp_host})) {
			&sara_split($_);
                        next if(sans10($service_output) == 0);
			($_tutorial = $service_output) =~ tr / /_/;
			# just weed out the dups
			next if ($_last_tmp eq $_tmp_host && $text eq $_last_txt);
			$_last_tmp = $_tmp_host;
			$_last_txt = $text;
                        $_service = $service_output;
                        $_service =~ s/ /_/g;
                        if ($_service =~ /\[VU/ || $_service =~ /\[CA/ || $_service =~ /\[IN/) {
                          ($dum,$_service) = split(/\[/,$_service);
                          ($_service,$dum) = split(/\]/,$_service);
                        }
                        $_html = $_tmp_host;
                        $_html =~ s/\./_/g;
                        $_html =~ s/\-/_/g;
                        $linkname = substr($_html,0,30);
                        $host_found = "FALSE";
                        $_sev_text = "<li>";
                        $_sev_text .= "<a href='#BM$linkname'> $_tmp_host</a>:"; 
                        $_sev_text .= "<a href='#$_service'>($text)</a>\n";
                        $html_script_args = $_tmp_host;
                        $_text = $text;
                        do "html/reporting/reportwriter/sara_report_host_check.pl";
                        if ( $host_found eq "TRUE" ) {
                         if(correction("$_tmp_host|$_text") == 0) { 
 			    print CLIENT "$_sev_text";
                         } else {
                            $_fp_text .= $_sev_text;
                         }
                          }
                      }
                    }
		print CLIENT <<EOF;
			</UL>
EOF
		}
         if ($_fp_text) {
          print CLIENT <<EOF;
          <PRE>   </PRE><B><FONT COLOR=GRAY>
                        Reported False Positives</B></A></FONT>
          <UL>
          $_fp_text
          </UL>
EOF
        }
	}
else {
	print CLIENT <<EOF;
	<P> No vulnerability information found.
EOF
	}

        print CLIENT <<EOF;
</UL></UL>
EOF
1
