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

 

 


Tema destacado: Usando Git para manipular el directorio de trabajo, el índice y commits (segunda parte)


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


Desconectado Desconectado

Mensajes: 545



Ver Perfil
[Perl] PasteBin Downloader 0.1
« en: 20 Julio 2013, 23:58 pm »

Un simple script en Perl para bajar codigos de pastebin.
Pueden bajar solo uno o hacer que el programa busque links de pastebin en una pagina y bajarlos a todos.

El codigo :

Código
  1. #!usr/bin/perl
  2. #PasteBin Downloader 0.1
  3. #Coded By Doddy H
  4.  
  5. use LWP::UserAgent;
  6. use URI::Split qw(uri_split);
  7. use HTML::LinkExtor;
  8.  
  9. my $nave = LWP::UserAgent->new;
  10. $nave->agent(
  11. "Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8.1.12) Gecko/20080201Firefox/2.0.0.12"
  12. );
  13. $nave->timeout(10);
  14.  
  15. my $se = "downloads_pastebin";
  16.  
  17. unless ( -d $se ) {
  18.    mkdir( $se, "777" );
  19. }
  20.  
  21. chdir $se;
  22.  
  23. print "\n-- == PasteBin Downloader 0.1 == --\n";
  24.  
  25. unless ( $ARGV[0] and $ARGV[1] ) {
  26.    print "\n[+] Sintax : $0 < -single / -page > <url>\n";
  27. }
  28. else {
  29.    print "\n[+] Searching ...\n";
  30.    if ( $ARGV[0] eq "-single" ) {
  31.        download_this( $ARGV[1] );
  32.    }
  33.    if ( $ARGV[0] eq "-page" ) {
  34.        download_all( $ARGV[1] );
  35.    }
  36. }
  37.  
  38. print "\n(C) Doddy Hackman 2013\n";
  39.  
  40. sub download_all {
  41.  
  42.    my $page = shift;
  43.  
  44.    my $code = toma($page);
  45.    chomp $code;
  46.  
  47.    my @links_all = repes( get_links($code) );
  48.  
  49.    for my $page_down (@links_all) {
  50.        download_this($page_down);
  51.    }
  52.  
  53. }
  54.  
  55. sub download_this {
  56.  
  57.    my $page   = shift;
  58.    my $titulo = "";
  59.    my $num    = "";
  60.  
  61.    print "\n[+] Checking : $page\n";
  62.  
  63.    my $code = toma($page);
  64.  
  65.    if ( $page =~ /http:\/\/(.*)\/(.*)/ ) {
  66.        $num = $2;
  67.  
  68.        if ( $code =~ /<div class="paste_box_line1" title="(.*)">/ ) {
  69.            $titulo = $1;
  70.  
  71.            print "[+] Downloading : http://pastebin.com/download.php?i=$num\n";
  72.  
  73.            if (
  74.                download(
  75.                    "http://pastebin.com/download.php?i=$num",
  76.                    $titulo . ".txt"
  77.                )
  78.              )
  79.            {
  80.                print "[+] File Downloaded !\n";
  81.            }
  82.            else {
  83.                print "[-] Error\n";
  84.            }
  85.  
  86.        }
  87.    }
  88.  
  89. }
  90.  
  91. sub download {
  92.  
  93.    if ( $nave->mirror( $_[0], $_[1] ) ) {
  94.        if ( -f $_[1] ) {
  95.            return true;
  96.        }
  97.    }
  98. }
  99.  
  100. sub repes {
  101.    my @limpio;
  102.    foreach $test (@_) {
  103.        push @limpio, $test unless $repe{$test}++;
  104.    }
  105.    return @limpio;
  106. }
  107.  
  108. sub toma {
  109.    return $nave->get( $_[0] )->content;
  110. }
  111.  
  112. sub get_links {
  113.  
  114.    $test = HTML::LinkExtor->new( \&agarrar )->parse( $_[0] );
  115.    return @links;
  116.  
  117.    sub agarrar {
  118.        my ( $a, %b ) = @_;
  119.        push( @links, values %b );
  120.    }
  121. }
  122.  
  123. #The End ?
  124.  


En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
[Perl] PasteBin Uploader
Scripting
BigBear 0 2,237 Último mensaje 8 Octubre 2011, 16:55 pm
por BigBear
[Perl] Simple Downloader 0.1
Scripting
BigBear 0 1,526 Último mensaje 6 Mayo 2012, 02:08 am
por BigBear
[Perl Tk] Simple Downloader 0.1
Scripting
BigBear 0 1,643 Último mensaje 6 Mayo 2012, 02:08 am
por BigBear
[Perl] MP3 Downloader 0.1
Scripting
BigBear 2 1,770 Último mensaje 27 Noviembre 2012, 16:18 pm
por BigBear
PasteBin Downloader VBScript
Scripting
xXSCORPIOXx 1 2,170 Último mensaje 18 Marzo 2014, 16:30 pm
por BigBear
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines