#  This software was derived from SATAN 1.1.1 by Dan Farmer and Wietse Venema
#  (http://www.porcupine.org/satan).
#
#
# List all hosts that run a specific operating system version.
#

&make_hosttype_info();

($_TYPE, $_sort_order) = split(/,/, $html_script_args);
($_type = $_TYPE) =~ tr/+!/ \//;

print CLIENT <<EOF;
<HTML>
<HEAD>
<title> Host Table - $_type Systems </title>
<LINK REV="made" HREF="mailto:satan\@fish.com">
<LINK REV="made" HREF="mailto:sara\@arc.com">
</HEAD>
<BODY>
EOF
if ($pi_menu) {
  $screen = &$pi_menu;
} else {
  $screen = print_menu();
}
$screen =~ s/\\n/\n/g;
print CLIENT $screen;
print CLIENT "</TD><TD valign=top>\n";
if ($pi_home) {
  $screen =&$pi_home;
  $screen =~ s/\\nn/\n/g;
  print CLIENT $screen;
  print CLIENT "</TD></TR></TABLE>\n";
}else {
print CLIENT <<EOF;
<TABLE BORDER="0" WIDTH="650">
<TR><TD BGCOLOR="#000000">
<FONT Color="#FFFFFF">
<H2><Center>
Host Table - $_type Systems </Center></H2>
</TD><TR></TABLE>
<UL>
<h3> 
$systype_severities{$_type} Vulnerable/$systype_counts{$_type} total.
Vulnerability counts in parentheses.
</h3>

<H4> Sort hosts by:
<a href="sara_info_OStype.pl,$_TYPE,name,">name</a> |
<a href="sara_info_OStype.pl,$_TYPE,domain,">domain</a> |
<a href="sara_info_OStype.pl,$_TYPE,subnet,">subnet</a> |
<a href="sara_info_OStype.pl,$_TYPE,severity,">problem count</a> |
<a href="sara_info_OStype.pl,$_TYPE,severity_type,">problem type</a>
</H4>

</FORM>
EOF

@_hosts = split(/\n/, $hosts_by_systype{$_type});
do "$html_root/reporting/sort_hosts.pl";
print CLIENT $@ if $@;

print CLIENT <<EOF;
<hr> <a href="/sara.html"> Back to the SARA start page </a> |
<a href="/reporting/analysis.pl"> Back to SARA Reporting and Analysis </a>
</UL></UL></TABLE>
</BODY>
</HTML>
EOF
}
