1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
|
<!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>
<title>Scanner</title>
<link href="style.css" rel=stylesheet type="text/css">
</head>
<body>
<br/>
<div id="conteneur">
<br/>
<div id="header">
Scanner de Port
</div>
<table id="tableau">
<?php
// Récupération du nom depuis l'adresse IP
$hostname = gethostbyaddr("8.8.8.8");
// Récupération de l'adresse ip depuis le nom
$hostip = gethostbyname("www.google.fr");
$hostname = $_POST["hostname"];
$hostip = $_POST["hostip"];
echo '<tr>';
echo '<td class="text_tableau_resultat">'.$hostname.'</td>';
echo '<td class="text_tableau_resultat">'.$hostip.'</td>';
echo '</tr>';
echo '</br>';
echo '</br>';
// Ping avec commande du système (Pour Linux, à adapter si le système est différent)
function ping($host)
{
// exec(sprintf('ping -c 1 -W 5 %s', escapeshellarg($host)), $res, $rval);
return $rval === 0;
}
if (ping("8.8.4.4")) {
echo '<tr>';
echo '<br/><br/><td>Liaison OK</td>';
echo '<td> </td>';
echo '</tr>';
echo '<br/>';
echo '<br/>';
}
else
{
echo '<tr>';
echo '<td>Liaison KO<br/><br/></td>';
echo '<td> </td>';
echo '</tr>';
}
// Scanner de ports
$host = $_POST["adresse"];
$ports = array(21, 22, 23, 25, 53, 80, 110, 1433, 3306);
$results = array();
foreach($ports as $port) {
if($pf = @fsockopen($host, $port, $err, $err_string, 1)) {
$results[$port] = true;
fclose($pf);
} else
{
$results[$port] = false;
}
}
foreach($results as $port=>$val) {
$prot = getservbyport($port,"tcp");
echo '<tr>';
echo "<td><img src='serveur.png' border='0'> Port $port ($prot):</td>";
if($val) {
echo '<td><span class="text_tableau_resultat"><img src="port-ouvert.png" border="0"> Le port est Ouvert !</span></td>';
}
else
{
echo '<td><span class="text_tableau_resultat2"><img src="port-fermer.png" border="0"> Le port n\'est pas ouvert</span></td>';
echo '</tr>';
}
}
?>
</table>
<br/>
<form method="POST" action="scan-tools.php">
<table id="tableau2">
<tr>
<td align="right" width="100" class="text_tableau2"> Hostname :</td>
<td align="right" width="300"><input name="hostname" type="text"></td>
</tr>
<tr>
<td align="right" width="100" class="text_tableau2"> L'URL / WWW :</td>
<td align="right" width="300"><input name="adresse" type="text"></td>
</tr>
<tr>
<td align="right" width="100" class="text_tableau2"> Adresse IP:</td>
<td align="right" width="300"><input name="hostip" type="text"></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td align="right" width="100"> </td>
<td align="right" width="300"><button type="submit">Lancer le Scan !</button></td>
</tr>
</table>
<br/>
</form>
</div>
<br/>
<div id="footer"><br/></div>
</body>
</html> |
Partager