#  This software was derived from SATAN 1.1.1 by Dan Farmer and Wietse Venema
#  (http://www.porcupine.org/satan).
#
#
# Select SARA data base
#
$_sara_search = "";
@_results = `ls results`;
for (@_results) { chop; }

print CLIENT <<EOF;
<HTML>
<HEAD>
<META HTTP-EQUIV="Expires" CONTENT="Tue, 04 Dec 1993 21:29:02 GMT">
<title> SARA Search</title>
<LINK REV="made" HREF="mailto:sara\@arc.com">
</HEAD>
EOF
if ($pi_menu) {
  $screen = &$pi_menu;
} else {
  $screen = print_menu();
}
$screen =~ s/\\n/\n/g;
print CLIENT $screen;
print CLIENT <<EOF;
<TD valign=top>
<TABLE BORDER="0" WIDTH="650"
<TR><TD BGCOLOR="#000000">
<Font Color="#FFFFFF">
<Center> <H2> SARA Search </H2></Center>
</FONT>
</TD></TR></TABLE>
<UL>
<FORM METHOD=POST ACTION="sara_search_action.pl">
<input Type=hidden Name=sequence Value="$seq">
<h3>Search the SARA databases for:</h3>

<h3>
<INPUT SIZE="28" NAME="_sara_search" Value="$sara_search_data">
</h3>
<INPUT TYPE="radio" NAME="mode" VALUE="host" checked>
          <strong>hosts</strong>
         <INPUT TYPE="radio" NAME="mode" VALUE="any">
          <strong>vulnerabilities</strong><BR>
<HR>
EOF

if (@_results) {
	print CLIENT <<EOF;
	<h3>Existing data bases (click to enable search)</h3>
EOF
}

print CLIENT <<EOF;
<ul>
EOF
for (@_results) {
	if (-d "results/$_") {
         if ($_ ne "SEARCH" ) {
          $name     = "XxX";
          $name    .= "$_";
          $namechk  = "XXX";
          $namechk .= "$_";
          $$namechk  = "checked" if ($$name  eq "on"); $$name  = "off";
          print CLIENT <<EOF;
          <INPUT TYPE="checkbox" NAME="$name" VALUE="on" $namechk>
          <strong>$_</strong><BR>
EOF
	}
}
}

print CLIENT <<EOF;
<INPUT TYPE="submit" VALUE=" Generate 'Search' List">
</FORM>
<UL>
</ul>
</ul>
<hr>
</UL></UL>
</TD></TR></TABLE>
</BODY>
</HTML>
EOF
