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 120 121 122 123 124 125
|
<html>
<pre>
<?
$cfgServer = "125.689.25.23";
$cfgPort = 23;
$cfgTimeOut = 10;
// open a socket
if(!$cfgTimeOut)
// without timeout
$usenet_handle = fsockopen($cfgServer, $cfgPort);
else
// with timeout
$usenet_handle = fsockopen($cfgServer, $cfgPort, &$errno, &$errstr, $cfgTimeOut);
sleep (5);
if(!$usenet_handle) {
echo "Connexion failed\\n";
exit();
}
else {
echo "Connected\\n";
$tmp = fgets($usenet_handle, 1024);
sleep (5);
echo $tmp;
}
$cfgUser = "login";
$cfgPasswd = "pwd";
// *****************************
// Valide si l'ouverture de session TCP a eu lieu
// *****************************
if($usenet_handle)
{
// ********************************************
// Présentation des résultats
// ********************************************
echo "
<pre>
<p align='center'>
<font size='4' color='#008000'>
<b>
Session Telnet :
Socket Id : $usenet_handle
Adresse IP : $cfgServer
</b>
</font>
</p>
</pre>
";
$tempo=@fgets($usenet_handle,1024);
echo "tempo :".$tempo;
// *****************************
// Indication au routeur que le buffer de reception est illimité
// *****************************
fputs ($usenet_handle, "terminal length 0\n");
// *****************************
// Reception
// *****************************
$tempo1=@fgets($usenet_handle,102400);
sleep (10);
// *****************************
// Affichage du prompt
// *****************************
echo "tempo1 :".$tempo1;
// *****************************
// Indication au routeur du login
// *****************************
fputs ($usenet_handle, $cfgUser."\\n");
// *****************************
// Reception
// *****************************
$tempo2=@fgets($usenet_handle,1024);
sleep (10);
// *****************************
// Affichage du prompt
// *****************************
echo "tempo2 :".$tempo2;
// *****************************
// Indication au routeur du password
// *****************************
fputs ($usenet_handle, $cfgPasswd."\\n");
// *****************************
// Reception
// *****************************
$tempo3=@fgets($usenet_handle,1024);
sleep (10);
// *****************************
// Affichage du prompt
// *****************************
echo "tempo3 :".$tempo3;
// *****************************
// Indication au routeur de la commande ping
// *****************************
fputs ($usenet_handle, "ping 125.189.25.23");
// *****************************
// Reception
// *****************************
$tempo4=@fgets($usenet_handle,1024);
sleep (15);
// *****************************
// Affichage du prompt
// *****************************
echo "tempo4 :".$tempo4;
// close connexion
fclose($usenet_handle);
}
?>
</pre>
</html> |
Partager