I would like to telnet to a switch that supports telnet and issue some commands and dump the results back to the page.
This is what I have so far for code:
<?php
$fp = fsockopen("xxx.xxx.xxx.xxx", 23, $errno, $errstr, 1);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
$out = "root\r\n";
fwrite($fp, $out);
while (!feof($fp))
{
echo fgets($fp);
}
fclose($fp);
}
?>
This is what I get on my page:
ÿýÿûÿýÿû21-Feb-2000 00:46:46 %MSCM-I-NEWTERM: New TELNET connection from 67.119.281.12 User Name:root
Fatal error: Maximum execution time of 30 seconds exceeded in C:\Inetpub\wwwroot\b.php on line 11