#  This software was derived from SATAN 1.1.1 by Dan Farmer and Wietse Venema
#  (http://www.porcupine.org/satan).
#
#  Determine which tutorials should go into report
#
#
$BASE="html/tutorials/vulnerability/no_cve";
$CERT="html/tutorials/vulnerability/cert";
sub sort_numeric {
	$severity_type_count{$b} <=> $severity_type_count{$a};
}
@tutorials ="";
$cnt = 0;
&make_severity_info();
if (sizeof(*severity_type_host_info) > 0) {
for (sort sort_numeric keys %severity_type_host_info) {
$service_output = $_;
($_type = $_) =~ tr / \//+!/;
$tutorial=$_;
$tutorial=~ s/\s/_/g;
$tutorial=~ s/$/.html/;
if(sans10($service_output) == 1) {
  @tutorials[$cnt] = $tutorial;
  $cnt++;
}
}
}
if ("@tutorials") {
  for $tutorial (sort {uc($a) cmp uc($b)} @tutorials) {
    print "<UL>\n";
    if ($tutorial =~ /\[VU/ || $tutorial =~ /\[CA/ || $tutorial =~ /\[IN/) {
     ($dum, $tutorial) = split(/\[/,$tutorial);
     ($tutorial,$dum) =split(/\]/,$tutorial);
      open(OUT, "$CERT/$tutorial.html");
      print "<A NAME=$tutorial>\n";
    } else {
      open (OUT, "$BASE/$tutorial");
    }
    print "</Font><Font size=2>\n";
    while (<OUT>) {
        chomp;
        if (!/TITLE/i) {
          $_ =~ s/Vulnerability Note/<A HREF="http:\/\/www.cert.org">CERT<\/A> Vulnerability Note/g;
          $_ =~ s/\FONT/noFONT/g;
          $_ =~ s/\/H1\>/\/B><P>/g;
          $_ =~ s/\/H2\>/\/B><P>/g;
          $_ =~ s/\/H3\>/\/B><P>/g;
          $_ =~ s/\<H1/<P><B/g;
          $_ =~ s/\<H2/<P><B/g;
          $_ =~ s/\<H3/<P><B/g;
          $_ =~ s/\/h1\>/\/B><P>/g;
          $_ =~ s/\/h2\>/\/B><P>/g;
          $_ =~ s/\/h3\>/\/B><P>/g;
          $_ =~ s/\<h1/<P><B/g;
          $_ =~ s/\<h2/<P><B/g;
          $_ =~ s/\<h3/<P><B/g;

          $_ =~ s/\<HR\>//g;
          print "$_\n";
        }
    } 
    print "</Font>\n";
    close(OUT);
    print "</UL></UL><HR>"
  }
}
