elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Guía rápida para descarga de herramientas gratuitas de seguridad y desinfección


+  Foro de elhacker.net
|-+  Programación
| |-+  Scripting
| | |-+  [Perl] SMF Manager 0.1
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: [Perl] SMF Manager 0.1  (Leído 1,657 veces)
BigBear


Desconectado Desconectado

Mensajes: 545



Ver Perfil
[Perl] SMF Manager 0.1
« en: 7 Diciembre 2012, 19:03 pm »

Traduccion a Perl (mega buggeada) del script que hizo Javier de PortalHacker para poder leer los mensajes privados y listar las categorias de un foro SMF.

El codigo

Código
  1. #!usr/bin/perl
  2. #SMF Manager 0.00001
  3. #Coded By Doddy H
  4.  
  5. #ppm install http://www.bribes.org/perl/ppm/HTML-Strip.ppd
  6.  
  7. use LWP::UserAgent;
  8. use HTTP::Cookies;
  9.  
  10. use HTML::Strip;
  11.  
  12. my $nave = LWP::UserAgent->new(
  13.    cookie_jar            => HTTP::Cookies->new(),
  14.    requests_redirectable => [],
  15.    timeout               => 5,
  16.    agent =>
  17. "Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8.1.12) Gecko/20080201Firefox/2.0.0.12"
  18. );
  19.  
  20.  @@@   @     @  @@@@@    @     @                                  
  21. @   @  @     @  @        @     @                                  
  22. @      @@   @@  @        @@   @@                                  
  23. @      @@   @@  @        @@   @@   @@@  @ @@   @@@   @@@@  @@@  @@
  24.  @@@   @ @ @ @  @@@@     @ @ @ @      @ @@  @     @ @   @ @   @ @
  25.     @  @ @ @ @  @        @ @ @ @   @@@@ @   @  @@@@ @   @ @@@@@ @
  26.     @  @  @  @  @        @  @  @  @   @ @   @ @   @ @   @ @     @
  27. @   @  @  @  @  @        @  @  @  @   @ @   @ @   @ @   @ @   @ @
  28.  @@@   @     @  @        @     @   @@@@ @   @  @@@@  @@@@  @@@  @
  29.                                                         @        
  30.                                                     @@@@          
  31.  
  32. );
  33.  
  34. print "\n\n[+] Page : ";
  35. chomp( my $url = <stdin> );
  36.  
  37. print "\n[+] Username : ";
  38. chomp( my $usera = <stdin> );
  39.  
  40. print "\n[+] Password : ";
  41. chomp( my $passa = <stdin> );
  42.  
  43. ## Login
  44.  
  45. print "\n[+] Connecting ....\n\n";
  46.  
  47. my $code = $nave->post(
  48.    $url . "/index.php?action=login2",
  49.    {
  50.        "user"         => $usera,
  51.        "passwrd"      => $passa,
  52.        "cookielength" => "9000",
  53.        "hash_passwrd" => "",
  54.        "submit"       => "submit"
  55.    }
  56. );
  57.  
  58. if ( $code->is_redirect ) {
  59.  
  60.    #print $code->header('location'),"\n";
  61. }
  62. elsif ( $code->is_success ) {
  63.    print $code->as_string, "\n";
  64. }
  65. else {
  66.    print STDERR $code->status_line, "\n";
  67. }
  68.  
  69. my $code = toma( $url . "/SSI.php?ssi_function=welcome" );
  70.  
  71. if ( $code =~ /Hola, <strong>(.*)<\/strong>/ ) {
  72.    my $name = $1;
  73.    print "[+] Welcome $name\n";
  74. }
  75. else {
  76.    print "[-] Error\n";
  77. }
  78.  
  79. ##
  80.  
  81. while (1) {
  82.  
  83.    print "\n[+] Options\n\n";
  84.  
  85.    print "1 - See MP\n";
  86.    print "2 - Navegate\n";
  87.    print "3 - Exit\n";
  88.  
  89.    print "\n[+] Option : ";
  90.    chomp( my $op = <stdin> );
  91.  
  92.    if ( $op eq "3" ) {
  93.        exit(1);
  94.    }
  95.  
  96.    if ( $op eq "1" ) {
  97.  
  98.        print qq(
  99. @     @  @@@@@
  100. @     @  @    @
  101. @@   @@  @    @
  102. @@   @@  @    @
  103. @ @ @ @  @@@@@
  104. @ @ @ @  @    
  105. @  @  @  @    
  106. @  @  @  @    
  107. @     @  @    
  108.  
  109. );
  110.  
  111.        mps($url);
  112.    }
  113.  
  114.    if ( $op eq "2" ) {
  115.        print qq(
  116. @    @                                        
  117. @@   @                                @      
  118. @@   @                                @      
  119. @ @  @   @@@  @   @  @@@   @@@@  @@@  @@  @@@
  120. @ @  @      @ @   @ @   @ @   @     @ @  @   @
  121. @  @ @   @@@@  @ @  @@@@@ @   @  @@@@ @  @@@@@
  122. @   @@  @   @  @ @  @     @   @ @   @ @  @    
  123. @   @@  @   @   @   @   @ @   @ @   @ @  @   @
  124. @    @   @@@@   @    @@@   @@@@  @@@@  @  @@@
  125.                               @              
  126.                           @@@@                
  127.  
  128.  
  129. );
  130.  
  131.        my $chau2 = 0;
  132.  
  133.        while ( $chau2 eq 0 ) {
  134.  
  135.            print "\n[+] 1 - List Categories\n";
  136.            print "[+] 2 - Exit\n";
  137.  
  138.            print "\n[+] Option : ";
  139.            chomp( my $op = <stdin> );
  140.  
  141.            if ( $op eq "1" ) {
  142.  
  143.                print "\n[+] Searching ...\n\n";
  144.  
  145.                my $code = toma($url);
  146.  
  147.                while ( $code =~
  148. /<a class=\"subject\" href=\"(.*?)\" name=(.*?)>(.*?)<\/a>/migs
  149.                  )
  150.                {
  151.                    print "[+] ID : $2 [+] Name : $3\n";
  152.                }
  153.  
  154.            }
  155.            else {
  156.                $chau2 = 1;
  157.            }
  158.  
  159.        }
  160.  
  161.    }
  162.  
  163. }
  164.  
  165. #gets_list_mp();
  166. #gets_msg_mp();
  167. #gets_msg_now();
  168.  
  169. sub mps {
  170.  
  171.    my $url = shift;
  172.  
  173.    my $chau = "0";
  174.  
  175.    print "\n[+] Searching pages ..\n";
  176.  
  177.    my @founds = gets_list_mp($url);
  178.  
  179.    my $count = int(@founds);
  180.  
  181.    print "\n[+] Pages Found : $count\n";
  182.  
  183.    while ( $chau eq 0 ) {
  184.  
  185.        print "\n[+] 1 - Get List Messages\n";
  186.        print "[+] 2 - Read Message\n";
  187.        print "[+] 3 - Exit\n";
  188.  
  189.        print "\n[+] Option : ";
  190.        chomp( my $op = <stdin> );
  191.  
  192.        if ( $op eq "1" ) {
  193.  
  194.            print "\n[+] Number Page : ";
  195.            chomp( my $op = <stdin> );
  196.  
  197.            print "\n[+] Searching ..\n";
  198.  
  199.            gets_msg_mp( $founds[ $op - 1 ] );
  200.  
  201.        }
  202.        elsif ( $op eq "2" ) {
  203.  
  204.            print "\n[+] Number Page : ";
  205.            chomp( my $n = <stdin> );
  206.  
  207.            print "\n[+] ID : ";
  208.            chomp( my $id = <stdin> );
  209.  
  210.            print "\n[+] Reading ...\n";
  211.  
  212.            gets_msg_now( $founds[ $n - 1 ], $id );
  213.  
  214.        }
  215.        else {
  216.            $chau = 1;
  217.        }
  218.  
  219.    }
  220. }
  221.  
  222. sub gets_msg_now {
  223.  
  224.    my $url = toma( $_[0] );
  225.  
  226.    my $id = "msg_" . $_[1];
  227.  
  228.    if ( $url =~ /<div class=\"inner\" id=\"$id\">(.*?)<\/div>/mig ) {
  229.  
  230.        my $uno = HTML::Strip->new( emit_spaces => 1 );
  231.        my $final = $uno->parse($1);
  232.        $final =~ s/^[\t\f ]+|[\t\f ]+$//mg;
  233.  
  234.        print "\n[START]\n\n";
  235.        print $final;
  236.        print "\n\n[END]\n\n";
  237.  
  238.    }
  239.  
  240. }
  241.  
  242. sub gets_msg_mp {
  243.  
  244.    my $url = toma( $_[0] );
  245.  
  246.    my @ids;
  247.    my @asunto;
  248.    my @nombre;
  249.  
  250.    while ( $url =~ /<td><a href=\"#msg(.*?)\">(.*?)<\/a><\/td>/migs ) {
  251.  
  252.        #print "$1 $2\n";
  253.        push( @ids,    $1 );
  254.        push( @asunto, $2 );
  255.    }
  256.  
  257.    while ( $url =~ /Ver perfil de (.*?)">/migs ) {
  258.  
  259.        #print "$1\n\n";
  260.        push( @nombre, $1 );
  261.    }
  262.  
  263.    my $total = int(@ids) - 1;
  264.  
  265.    for my $num ( 0 .. $total ) {
  266.        print "[+] ID : "
  267.          . $ids[$num]
  268.          . " [+] Asunto : "
  269.          . $asunto[$num]
  270.          . " [+] De : "
  271.          . $nombre[$num] . "\n";
  272.    }
  273.  
  274. }
  275.  
  276. sub gets_list_mp {
  277.  
  278.    my $url = shift;
  279.  
  280.    my @paginas;
  281.    my $code = toma( $url . "/index.php?action=pm" );
  282.  
  283.    push( @paginas, $url . "/index.php?action=pm" );
  284.  
  285.    while ( $code =~ /<a class="navPages" href="(.*?)">(.*?)<\/a>/migs ) {
  286.        push( @paginas, $1 );
  287.    }
  288.  
  289.    my @paginas = repes(@paginas);
  290.  
  291.    return @paginas;
  292.  
  293. }
  294.  
  295. sub repes {
  296.    my @limpio;
  297.    foreach $test (@_) {
  298.        push @limpio, $test unless $repe{$test}++;
  299.    }
  300.    return @limpio;
  301. }
  302.  
  303. sub toma {
  304.    return $nave->get( $_[0] )->content;
  305. }
  306.  
  307. sub tomar {
  308.    my ( $web, $var ) = @_;
  309.    return $nave->post( $web, [ %{$var} ] )->content;
  310. }
  311.  
  312. #The End ?
  313.  

AVISO : Solo esta probado en el foro  spam portalhacker spam .  


« Última modificación: 7 Diciembre 2012, 20:26 pm por EleKtro H@cker » En línea

Eleкtro
Ex-Staff
*
Desconectado Desconectado

Mensajes: 9.821



Ver Perfil
Re: [Perl] SMF Manager 0.1
« Respuesta #1 en: 7 Diciembre 2012, 20:20 pm »

Código:
C:\Windows\Perl\bin>ppm install http://www.bribes.org/perl/ppm/HTML-Strip.ppd
ppm install failed: The PPD does not provide code to install for this platform

Alguna posibilidad de hacer el aporte compatible con Win7 x64?

Gracias de todas formas!


En línea

BigBear


Desconectado Desconectado

Mensajes: 545



Ver Perfil
Re: [Perl] SMF Manager 0.1
« Respuesta #2 en: 7 Diciembre 2012, 20:45 pm »

lo hice con ese modulo porque no encontraba ninguno que viniera por defecto.
En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
[Perl] Manager
Scripting
BigBear 0 1,511 Último mensaje 9 Octubre 2011, 17:50 pm
por BigBear
[Perl] FTP Manager
Scripting
BigBear 0 1,537 Último mensaje 14 Octubre 2011, 15:25 pm
por BigBear
[Perl] USB Manager 0.2
Scripting
BigBear 0 1,536 Último mensaje 3 Diciembre 2011, 16:34 pm
por BigBear
[Perl] FTP Manager 0.2
Scripting
BigBear 0 1,510 Último mensaje 22 Abril 2012, 05:03 am
por BigBear
[Perl Tk] FTP Manager 0.2
Scripting
BigBear 0 1,517 Último mensaje 22 Abril 2012, 05:03 am
por BigBear
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines