Ver Mensaje Individual
  #3 (permalink)  
Antiguo 14/12/2006, 09:55
Avatar de dontripi
dontripi
 
Fecha de Ingreso: enero-2006
Mensajes: 240
Antigüedad: 18 años, 10 meses
Puntos: 1
Re: realizar coneccion a un servidor telnet

por si alguien lo necesita ya lo encontre

<?php
# This is the difficult part, the Telnet header
$header1=chr(0xFF).chr(0xFB).chr(0x1F).chr(0xFF).c hr(0xFB).
chr(0x20).chr(0xFF).chr(0xFB).chr(0x18).chr(0xFF). chr(0xFB).
chr(0x27).chr(0xFF).chr(0xFD).chr(0x01).chr(0xFF). chr(0xFB).
chr(0x03).chr(0xFF).chr(0xFD).chr(0x03).chr(0xFF). chr(0xFC).
chr(0x23).chr(0xFF).chr(0xFC).chr(0x24).chr(0xFF). chr(0xFA).
chr(0x1F).chr(0x00).chr(0x50).chr(0x00).chr(0x18). chr(0xFF).
chr(0xF0).chr(0xFF).chr(0xFA).chr(0x20).chr(0x00). chr(0x33).
chr(0x38).chr(0x34).chr(0x30).chr(0x30).chr(0x2C). chr(0x33).
chr(0x38).chr(0x34).chr(0x30).chr(0x30).chr(0xFF). chr(0xF0).
chr(0xFF).chr(0xFA).chr(0x27).chr(0x00).chr(0xFF). chr(0xF0).
chr(0xFF).chr(0xFA).chr(0x18).chr(0x00).chr(0x58). chr(0x54).
chr(0x45).chr(0x52).chr(0x4D).chr(0xFF).chr(0xF0);
$header2=chr(0xFF).chr(0xFC).chr(0x01).chr(0xFF).c hr(0xFC).
chr(0x22).chr(0xFF).chr(0xFE).chr(0x05).chr(0xFF). chr(0xFC).chr(0x21);

$fp=fsockopen("192.168.100.1",23);

fputs($fp,$header1);
sleep(1);
fputs($fp,$header2);
sleep(1);

fputs($fp,"usuario\r");
sleep(1);
fputs($fp,"passwd\r");
sleep(1);
fputs($fp,"su\r");
sleep(1);
fputs($fp,"root.pass\r");
sleep(1);
fputs($fp,"ifconfig\r");
fputs($fp,"echo dat lupt|wall\r");
sleep(1);

$output=fread($fp,128);
$stat=socket_get_status($fp);

$output.=fread($fp, $stat["unread_bytes"]);
$output = explode("\n", $output);
echo $output[4]."esta es una salida";
unset($output['0']);
$output = implode("\n", $output);

$output = str_replace("\n", "<br>", $output);
echo $output;
fclose($fp);
?>