#
# Display a FORM to select the primary target and to give the user a chance to
# override some defaults.
#
($_host) = split(/,/, $html_script_args);
my($rnd) = time();

#
# First figure out what radio buttons etc. should be "on". Note: the
# variables below are global. Perhaps we should hide in our own package
# name space.
#
@check_target_file =(); $check_target_file[$use_target_file] = "checked";
@check_subnets = ();	$check_subnets[$attack_proximate_subnets] = "checked";
@check_level = ();	$check_level[$attack_level] = "checked";
@check_firewall = ();	$check_firewall[$firewall_flag] = "checked";
@check_extreme = ();	$check_extreme[$extreme] = "checked";

#
# In case the primary target has not yet been set.
#
$primary_target = $THIS_HOST unless $primary_target;
$_host = $primary_target unless $_host;

print CLIENT <<EOF
<HTML>
<HEAD>
<TITLE>SAINT Target Selection</TITLE>
<LINK REV="made" HREF="mailto:saint\@saintcorporation.com">
</HEAD>
<BODY BGCOLOR="white" vlink="#000000" link="#04289D">

<P></P>

<P>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0">
	<TR>
		<TD COLSPAN="2"><IMG SRC="$HTML_ROOT/images/target_sel_banner.gif" WIDTH="621" HEIGHT="106" ALIGN="BOTTOM" ALT="Target Selection" BORDER="0"></TD>
	</TR>
	<TR>
	  <TD WIDTH="86" VALIGN="TOP">
	    <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0">
		<TR>
		    <TD WIDTH="86"><A HREF="http://www.saintcorporation.com"><IMG SRC="$HTML_ROOT/images/home.gif" WIDTH="86" HEIGHT="55" ALIGN="BOTTOM" ALT="SAINT Corporation"
			BORDER="0"></A></TD>
		</TR>
		<TR>
		    <TD WIDTH="86"><A HREF="$HTML_ROOT/saint.html"><IMG SRC="$HTML_ROOT/images/home_button.gif" WIDTH="86" HEIGHT="46"
			ALIGN="BOTTOM" ALT="SAINT Home" BORDER="0" STYLE="Background-Image : none"></A></TD>
		</TR>
		<TR>
		    <TD WIDTH="86"><A HREF="$HTML_SERVER/data/saint_data_form.pl"><IMG SRC="$HTML_ROOT/images/data_mgmt_button.gif" WIDTH="86"
			HEIGHT="46" ALIGN="BOTTOM" ALT="Data Management" BORDER="0"></A></TD>
		</TR>
		<TR>
		    <TD WIDTH="86"><IMG SRC="$HTML_ROOT/images/target_selection_button.gif"
			WIDTH="86" HEIGHT="46" ALIGN="BOTTOM" ALT="Target Selection" BORDER="0"></TD>
		</TR>
		<TR>
		    <TD WIDTH="86"><A HREF="$HTML_SERVER/reporting/analysis.pl"><IMG SRC="$HTML_ROOT/images/data_analysis_button.gif" WIDTH="86"
			HEIGHT="46" ALIGN="BOTTOM" ALT="Data Analysis" BORDER="0"></A></TD>
		</TR>
		<TR>
		    <TD WIDTH="86"><A HREF="$HTML_SERVER/admin/saint_cf_form.pl"><IMG SRC="$HTML_ROOT/images/config_mgmt_button.gif" WIDTH="86"
			HEIGHT="46" ALIGN="BOTTOM" ALT="Configuration Management" BORDER="0"></A></TD>
		</TR>
		<TR>
		    <TD WIDTH="86"><A HREF="$HTML_ROOT/saint_documentation.html"><IMG SRC="$HTML_ROOT/images/documentation_button.gif"
			WIDTH="86" HEIGHT="46" ALIGN="BOTTOM" ALT="SAINT Documentation" BORDER="0"></A></TD>
		</TR>
		<TR>
		    <TD WIDTH="86" HEIGHT="46"><A HREF="$HTML_ROOT/docs/FAQ.html#trouble"><IMG SRC="$HTML_ROOT/images/troubleshooting_button.gif" WIDTH="86"
			HEIGHT="46" ALIGN="BOTTOM" ALT="Troubleshooting" BORDER="0"></A></TD>
		</TR>
		<TR>
		    <TD WIDTH="86" HEIGHT="65"><IMG SRC="$HTML_ROOT/images/bottom_border.gif" WIDTH="86" HEIGHT="75" ALIGN="BOTTOM" ALT="--------" BORDER="0"></TD>
		</TR>
	    </TABLE>
	  </TD>
	  <TD VALIGN="TOP">
		<DL>
			<P>
		</DL>
<UL><UL>
<FORM METHOD=POST ACTION="saint_run_action.pl">

<h3> Primary target selection </h3>

Primary target host(s) or network, e.g. <tt>$THIS_HOST</tt>
<BR>May be a single host, space-separated list, IP range, or subnet:
<P><INPUT COLOR=white TYPE=radio NAME="use_target_file" VALUE="0" $check_target_file[0]>
<INPUT SIZE="42" NAME="primary_target" Value="$_host">
<P>
<B>OR</B>
<P>
File containing list of target host(s):
<P><INPUT COLOR=white TYPE=radio NAME="use_target_file" VALUE="1" $check_target_file[1]>
<INPUT SIZE="42" NAME="target_file" VALUE="$target_file">

<P>

<DL compact>
<DT><DD><input color=white type=radio name="attack_proximate_subnets" value="0" $check_subnets[0]>
	Scan the target host(s) only. (Disables smurf check.)

<DT><DD><input type=radio name="attack_proximate_subnets" value="1" $check_subnets[1]>
	Scan all hosts in the target hosts' subnet(s).
</DL>

<HR>

<h3> Scanning level selection </h3>

Should SAINT do a light scan, a normal scan, or should it hit the
(primary) target(s) at full blast?

<P>

<DL compact>
<DT><DD><input type=radio name="attack_level" value="0" $check_level[0]>
	Light
<DT><DD><input type=radio name="attack_level" value="1" $check_level[1]>
	Normal (may be detected even with minimal logging)
<DT><DD><input type=radio name="attack_level" value="2" $check_level[2]> 
	Heavy (avoids WinNT ports that are known to crash system) 
<DT><DD><input type=radio name="attack_level" value="3" $check_level[3]>
	Heavy+ (doesn't avoid WinNT ports that are known to crash system)
<DT><DD><input type=radio name="attack_level" value="4" $check_level[4]>
	Top 20 (scans specifically for
	<A HREF="http://www.sans.org/top20.htm">SANS Top 20 Internet
	Security Vulnerabilities</A>)
<DT><DD><input type=radio name="attack_level" value="5" $check_level[5]>
	Custom: <SELECT NAME=custom_level>
EOF
;
for (@custom_levels) {
	$selected = ($custom_level eq $_) ? " selected" : "";
	print CLIENT "<OPTION$selected>$_</OPTION>\n";
}
print CLIENT <<EOF
</SELECT>
(<A HREF="../admin/saint_custom_select.pl,run,$rnd">Set up custom scan</A>)
</DL>
<P>
Should SAINT perform <A HREF="$HTML_ROOT/docs/saint.cf.html#extreme-list">dangerous
tests</A>? Dangerous tests may help
reduce false alarms, but <b>may crash services on target hosts!</b>
<P>
<DL compact>
<DT><DD><input type=radio name="extreme" value="0" $check_extreme[0]>
	Do not perform dangerous tests. Just issue warnings of potential problems instead.
<DT><DD><input type=radio name="extreme" value="1" $check_extreme[1]>
	Perform dangerous tests.
</DL>
<HR>

<h3>Firewall Support </h3>

Is the host you are scanning behind a firewall?  If it is, you should enable
firewall support, or your results might not be accurate, or you might get
no results at all.

<DL compact>
<DT><DD><input type=radio name="firewall_flag" value="0" $check_firewall[0]>
	No Firewall Support
<DT><DD><input type=radio name="firewall_flag" value="1" $check_firewall[1]>
	Firewall Support
</DL>
<HR>
<h3>Windows Domain Authentication</h3>

If you wish to perform a more thorough assessment of Windows
targets, then <A HREF="$HTML_ROOT/docs/saint.cf.html#domain_user">authenticate</A>
using the login name and password of a domain administrator. <I>See
<A HREF="$HTML_ROOT/docs/saint.cf.html#domain_user_warn">security warning</A></I>.

<DL compact>
<DT><DD>Login: <input type=text name="domain_user" value="$domain_user" size=16>
<DT><DD>Password: <input type=password name="domain_pass" size=16>
</DL>
<P>
<INPUT TYPE="submit" VALUE=" Start the scan ">
</FORM>
</UL></UL>
	  </TD>
	</TR>
</TABLE>
</BODY>
</HTML>
EOF
