[Perl & Batch/Ajuda] Hack Connect

Started by Anonymous, 04 de June , 2006, 05:50:37 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Anonymous

Bom, tenho tentado fazer um tipo de telnet unindo minhas duas linguagens que eu sei Batch Script & Perl.
No programa batch script não tive nenhum problema, o problema está no progrmaa em Perl. Códigos:
connect.bat@echo off
cls
echo     ___H_A_C_K____
echo    /\/ Connect  \/\
echo   /\/ by Sthealt \/\
echo  /\/\____________/\/\
echo /____\__________/____\
if "%1"=="" goto ZERO
if "%1"=="-h" goto HELP
if "%1"=="-c" goto CONNECT

:ZERO
echo ERRO: Tente usar %0 -h
goto FIM

:HELP
if not "%1"=="-h" goto ZERO
echo Use: %0 [-h]/[-c] [host] [porta] [protocolo]
echo %0 -h                ajuda
echo.
echo %0 -c               opcao de conexÆo
echo                host          DNS ou IP do host a se conectar
echo                porta         porta usada para se conectar
echo                protocolo     protocolo usado para a conexÆo (UDP ou TCP)
goto FIM

:CONNECT
if /i %1=="-c" goto CONNECT1
if /i %1=="" goto ZERO

:CONNECT1
if /i not %2=="" goto CONNECT2
if /i %2=="" goto ZERO

:CONNECT2
if /i not %3=="" goto CONNECT3
if /i %3=="" goto ZERO
goto FIM

:CONNECT3
if /i %4=="TCP" goto CONNECT4
if /i %4=="UDP" goto CONNECT4
if /i %4=="" goto ZERO

:CONNECT4
echo Tentando se conectar...
echo Host  [%2]
echo Porta [%3]
echo Proto [%4]
call conectar.pl %2 %3 %4
goto FIM

:FIM



Conectar.pluse IO::Socket;
@ARGV;
$host=$ARGV[0];
$port=$ARGV[1];
$proto=$ARGV[2];

my $socket=new IO::Socket::INET(PeerAddr => $host, PeerPort => $port, Proto => $proto, );
if (!$socket) {
print "\n\nErro ao se conectar ao servidor: $!";
exit(1); }
else {
print "\n\nConectado, abrindo prompt...";
$end="0";
while ($end=="0") {
print "\n$host> ";
                $cmd=<STDIN>;
                chomp $cmd;
$socket->send("$cmd\n");
# receber resposta do socket
# receber código da resposta (ex.: 220, 440 etc)
print "\nComando: $cmd - Codigo de resposta: code - Resposta:\nresposta";
}
}



Quem souber Perl, por favor me ajude.

Shady

while ($resposta = $socket->accept()){
print "\nComando: $cmd\n";
print "\nResposta: $resposta\n";
}

;)


Mundus Vult Decipi