📄 nmap.php
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title><?=$titleOfPage?></title>
<link rel="stylesheet" type="text/css" href="templates/<?=$theme?>/style.css" />
</head>
<body>
<? backToIndex(); ?>
<h2>Nmap Frontend</h2>
<div class="info">
<img src="images/info.png" alt="info" align="absmiddle" border="0" />
For using this modules nmap is required.<br/>
I found this nmap frontend code over internet. The original developer is <a href="mailto:testicyoules@hotmail.com">Testic</a><br/>
</div>
<?php
/*
HTML/PHP interface for NMAP.
by Testic. testicyoules@hotmail.com
www.testic.co.uk < I may start putting PHP scripts here one day.
*/
$version = "1.0"; // This version :)
/*
Set the default settings.
*/
$message = ""; // Message to be displayed when form is posted.
$target_host = "127.0.0.1"; // Target for scan.
$target_ports = "1-2048"; // Target port range.
$source_port = ""; // Source port for scans.
$bounce_on = false; // Do FTP bounce? No.
$bounce_host = ""; // Target host for FTP bounce.
$scantype = "sT"; // Scan type to connect();
$ping_options = "P0"; // Don't ping hosts.
$os = false; // Do OS detection? May as well.
$ident = false; // Reverse ident scan.
$frag = false; // Fragment certain scan types?
$fast = false; // Only scan ports in 'services', ie, well known ports.
$max_sock = "256"; // Maximum sockets to use for scan.
$custom_timing = "preset"; // Use preset or custom timings?
$host_timeout = "60000"; // Ms to time out host.
$max_probe = "9000"; // Max probe timeout (ms).
$min_probe = "1000"; // Min probe timeout (ms).
$max_hosts = "128"; // Probe parallelism.
$probe_delay = "1"; // Min delay between probes (ms).
$timing = "3"; // General timing, 'Normal'.
$addition = "-v"; // Any additional arguments.
/*
Grab and parse POST variables.
*/
if (count($_POST) != 0) {
if ($_POST['target_host']) {
$target_host = $_POST['target_host'];
} else {
$message .= "No host specified, using default.<br>";
}
$target_ports = $_POST['target_ports'];
if ($_POST['fast']) { $fast = true; } else { $fast = false; }
if ($target_ports != "" && $fast) {
$message .= "Port range and \'fast\' specified, using port range.<br>";
$fast = false;
}
if ($target_ports == "" && !$fast) {
$message .= "No port range or \'fast\' specified, using \'fast\' scan.<br>";
$fast = true;
}
$ping_options = $_POST['ping_options'];
if ($_POST['source_port']) { $source_port = $_POST['source_port']; }
if ($_POST['bounce_on']) { $bounce_on = true; }
if ($_POST['bounce_host']) { $bounce_host = $_POST['bounce_host']; }
if ($bounce_on && $bounce_host == "") {
$message .= "No FTP bounce host specified, ignoring.<br>";
$bounce_on = false;
}
}
/*
Parse command line.
*/
if (count($_POST) != 0 && $_POST['Submit']) {
//echo str_repeat(" ", 512);
$commandline = "$target_host ";
if ($target_ports) { $commandline .= "-p $target_ports "; }
if ($source_port) { $commandline .= "-g $source_port "; }
if ($bounce_on) { $commandline .= "-b $bounce_host "; }
$commandline .= "-".$scantype." ";
$commandline .= "-".$ping_options." ";
if ($os) { $commandline .= "-O "; }
if ($ident) { $commandline .= "-I "; }
if ($frag) { $commandline .= "-f "; }
if ($fast) { $commandline .= "-F "; }
if ($max_sock) { $commandline .= "-M $max_sock "; }
echo "command line \"sudo /usr/bin/nmap $commandline"."\"<br>";
flush();
echo "<textarea name=\"textfield\" cols=\"80\" rows=\"12\" wrap=\"VIRTUAL\">";
//system("nohup nmap $commandline &");
system("sudo /usr/bin/nmap $commandline &");
echo "</textarea>\n";
flush();
}
?>
<br/>
<form action="index.php?modules=nmap" method="post">
<table class="tableBorder" width="300" border="0" cellpadding="3" cellspacing="0">
<tr><td class="thFirst" colspan="2"><strong>Target options:</strong></td></tr>
<tr><td align="right" valign="middle" class="lineBest">Host:</td>
<td align="left" valign="middle">
<input type="text" name="target_host" size="18" maxlength="50" value="<?php echo $target_host; ?>">
</td></tr>
<tr><td align="right" valign="middle"class="lineBest">Port range: </td>
<td align="left" valign="middle">
<input type="text" name="target_ports" value="<?php echo $target_ports; ?>" size="6" maxlength="12">
</td></tr>
<tr><td align="right" valign="middle" class="lineBest">Source port:</td>
<td align="left" valign="middle">
<input type="text" name="source_port" size="4" maxlength="6" value="<?php echo $source_port; ?>">
</td></tr>
<tr><td align="right" valign="middle"class="lineBest">
<input type="checkbox" name="bounce_on" value="1" <?php if ($bounce_on) { echo "checked";} ?>>
FTP Bounce: </td>
<td align="left" valign="middle">
<input type="text" name="bounce_host" value="<?php echo $bounce_host; ?>">
</td></tr>
<tr><td colspan="2" class="thFirst"><b>Ping options:</b></td></tr>
<tr><td align="right" valign="middle">
<input type="radio" name="ping_options" value="P0" <?php if ($ping_options == "P0") { echo "checked"; } ?>>
</td>
<td align="left" valign="middle">Dont ping.</td></tr>
<tr><td align="right" valign="middle">
<input type="radio" name="ping_options" value="PT"<?php if ($ping_options == "PT") { echo "checked"; } ?>>
</td>
<td align="left" valign="middle">TCP ping</td></tr>
<tr> <td align="right" valign="middle">
<input type="radio" name="ping_options" value="PS" <?php if ($ping_options == "PS") { echo "checked"; } ?>>
</td>
<td align="left" valign="middle">SYN</td></tr>
<tr><td align="right" valign="middle">
<input type="radio" name="ping_options" value="PI" <?php if ($ping_options == "PI") { echo "checked"; } ?>>
</td>
<td align="left" valign="middle">Echo Req</td></tr>
<tr><td align="right" valign="middle">
<input type="radio" name="ping_options" value="PP" <?php if ($ping_options == "PP") { echo "checked"; } ?>>
</td>
<td align="left" valign="middle">Timestamp req</td></tr>
<tr><td align="right" valign="middle">
<input type="radio" name="ping_options" value="PM" <?php if ($ping_options == "PM") { echo "checked"; } ?>>
</td>
<td align="left" valign="middle">Netmask req</td></tr>
<tr><td align="right" valign="middle">
<input type="radio" name="ping_options" value="PB" <?php if ($ping_options == "PB") { echo "checked"; } ?>>
</td>
<td align="left" valign="middle">ACK + echo req.</td></tr>
<tr>
<td>Additional arguments:
<input type="text" name="addition" value="<?php echo $addition; ?>">
</td>
<td width="20"> </td></tr>
<tr>
<td colspan="2">
<input type="submit" name="Submit" value="Scan">
<a href="index.php?modules=nmap">Reset</a> </td></tr>
</table>
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -