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

 

 


Tema destacado: Curso de javascript por TickTack


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


Desconectado Desconectado

Mensajes: 545



Ver Perfil
[Perl] DH ViewBot 0.2
« en: 16 Enero 2015, 16:59 pm »

Un simple script que sirve como bot para hacer visitas con las siguientes opciones :

  • Visitar una sola pagina
  • Visitar paginas en un archivo marcado de forma ordenada
  • Visitar paginas en un archivo marcado de forma aleatoria
  • Opciones para timeout y cantidad de visitas

El codigo :

Código
  1. #!usr/bin/perl
  2. #DH ViewBot 0.2
  3. #(C) Doddy Hackman 2015
  4.  
  5. use Getopt::Long;
  6. use LWP::UserAgent;
  7. use URI::Split qw(uri_split);
  8. use IO::Socket;
  9.  
  10. my @agents = (
  11. 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0',
  12.    'Opera/9.80 (Windows NT 6.0) Presto/2.12.388 Version/12.14',
  13. 'Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1667.0 Safari/537.36',
  14. 'Mozilla/5.0 (compatible; MSIE 10.6; Windows NT 6.1; Trident/5.0; InfoPath.2; SLCC1; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 2.0.50727) 3gpp-gba UNTRUSTED/1.0',
  15. 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.8pre) Gecko/20070928 Firefox/2.0.0.7 Navigator/9.0RC1',
  16.    'Mozilla/5.0 (Windows; U; MSIE 9.0; WIndows NT 9.0; en-US))',
  17. 'Mozilla/5.0 (Windows NT 6.0; rv:2.0) Gecko/20100101 Firefox/4.0 Opera 12.14',
  18. 'Mozilla/5.0 (Windows; U; Windows NT 6.1; tr-TR) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27'
  19. );
  20.  
  21. GetOptions(
  22.    "single=s"     => \$single_opt,
  23.    "file=s"       => \$file_opt,
  24.    "randomfile=s" => \$randomfile_opt,
  25.    "timeout=i"    => \$timeout_opt,
  26.    "count=i"      => \$count_opt
  27. );
  28.  
  29. head();
  30.  
  31. if ( $single_opt or $file_opt or $randomfile_opt ) {
  32.  
  33.    my $page = $single_opt;
  34.  
  35.    my $timeout = "";
  36.  
  37.    if ( $timeout_opt eq "" ) {
  38.        $timeout = "5";
  39.    }
  40.    else {
  41.        $timeout = $timeout_opt;
  42.    }
  43.  
  44.    my $count = "";
  45.  
  46.    if ( $count_opt eq "" ) {
  47.        $count = "10";
  48.    }
  49.    else {
  50.        $count = $count_opt;
  51.    }
  52.  
  53.    if ( $single_opt ne "" ) {
  54.  
  55.        my $page = $single_opt;
  56.  
  57.        print "\n[+] Configuration\n";
  58.  
  59.        print "\n--------------------------------------------------";
  60.        print "\n[+] Page : " . $page . "\n";
  61.        print "[+] Timeout : " . $timeout . "\n";
  62.        print "[+] Visit Count  : " . $count . "\n";
  63.        print "--------------------------------------------------";
  64.  
  65.        visitar( $page, $timeout, $count, "single" );
  66.  
  67.    }
  68.  
  69.    elsif ( $randomfile_opt ne "" ) {
  70.  
  71.        visitar_random( $randomfile_opt, $timeout, $count );
  72.  
  73.    }
  74.    elsif ( $file_opt ne "" ) {
  75.  
  76.        if ( $file_opt ne "" ) {
  77.  
  78.            unless ( -f $file_opt ) {
  79.                print "\n[-] File not exist\n";
  80.                copyright();
  81.                exit(1);
  82.            }
  83.  
  84.            print "\n" . toma_fecha_y_hora("Started");
  85.  
  86.            my @paginas = repes( leer_archivo($file_opt) );
  87.  
  88.            for my $page (@paginas) {
  89.  
  90.                chomp $page;
  91.  
  92.                print "\n--------------------------------------------------";
  93.                print "\n[+] Page : " . $page . "\n";
  94.                print "[+] Timeout : " . $timeout . "\n";
  95.                print "[+] Visit Count : " . $count . "\n";
  96.                print "--------------------------------------------------";
  97.  
  98.                visitar( $page, $timeout, $count, "file" );
  99.  
  100.            }
  101.  
  102.            print "\n" . toma_fecha_y_hora("Finished");
  103.  
  104.        }
  105.        else {
  106.            print "\n[-] Option not selected\n";
  107.            exit(1);
  108.        }
  109.  
  110.    }
  111.  
  112. }
  113. else {
  114.    print qq(
  115. [+] Options :
  116.  
  117. -single : Page to visit
  118. -file : File with pages to visit
  119. -randomfile : File with pages to visit as random
  120. -timeout : Time for visit
  121. -count : Count to visist
  122.  
  123. );
  124.    print
  125. "[+] Example : perl $0 -single http://www.supertangas.com/index.php -timeout 5 -count 50\n";
  126. }
  127. copyright();
  128.  
  129. # Functions
  130.  
  131. sub head {
  132.    print "\n-- == DH ViewBot 0.2 == --\n";
  133. }
  134.  
  135. sub copyright {
  136.    print "\n-- == (C) Doddy Hackman 2015 == --\n";
  137. }
  138.  
  139. sub visitar_random {
  140.  
  141.    my ( $file, $timeout, $count ) = @_;
  142.  
  143.    my @paginas     = repes( leer_archivo($file) );
  144.    my $total_bueno = "";
  145.    my $total_malo  = "";
  146.  
  147.    print "\n" . toma_fecha_y_hora("Started");
  148.  
  149.    for ( 1 .. $count ) {
  150.        my $target = $paginas[ rand(@paginas) ];
  151.        chomp $target;
  152.        print "\n--------------------------------------------------";
  153.        print "\n[+] Page : " . $target . "\n";
  154.        print "[+] Timeout : " . $timeout . "\n";
  155.        print "--------------------------------------------------";
  156.  
  157.        print "\n\n[+] Getting information ...\n\n";
  158.  
  159.        print toma_banner($target) . "\n";
  160.  
  161.        my ( $status, $control ) = toma_response($target);
  162.  
  163.        if ( $control eq "1" ) {
  164.            $total_bueno++;
  165.        }
  166.        else {
  167.            $total_malo++;
  168.        }
  169.  
  170.        print "\n[+] Visit $_ : $target : " . $status . "\n";
  171.  
  172.        sleep($timeout);
  173.  
  174.    }
  175.  
  176.    print "\n[+] Successful Visits : " . $total_bueno . "\n";
  177.  
  178.    print "\n" . toma_fecha_y_hora("Finished");
  179.  
  180. }
  181.  
  182. sub visitar {
  183.  
  184.    my ( $page, $timeout, $count, $type ) = @_;
  185.  
  186.    print "\n\n[+] Getting information ...\n\n";
  187.  
  188.    print toma_banner($page);
  189.  
  190.    if ( $type eq "single" ) {
  191.        print "\n\n" . toma_fecha_y_hora("Started") . "\n";
  192.    }
  193.    else {
  194.        print "\n\n" . "[+] Working ..." . "\n\n";
  195.    }
  196.  
  197.    my $total_bueno = "";
  198.    my $total_malo  = "";
  199.  
  200.    for ( 1 .. $count ) {
  201.  
  202.        sleep($timeout);
  203.  
  204.        my ( $status, $control ) = toma_response($page);
  205.  
  206.        if ( $control eq "1" ) {
  207.            $total_bueno++;
  208.        }
  209.        else {
  210.            $total_malo++;
  211.        }
  212.  
  213.        syswrite STDOUT, "[+] Visit $_ : $page : " . $status . "\r";
  214.  
  215.    }
  216.  
  217.    syswrite STDOUT,
  218.      "[+] Successful Visits : " . $total_bueno . "\t\t\t\t\t\t\t\t\t\t\r";
  219.  
  220.    if ( $type eq "single" ) {
  221.        print "\n" . toma_fecha_y_hora("Finished");
  222.    }
  223.    else {
  224.        print "\n" . "[+] Finished\n";
  225.    }
  226.  
  227. }
  228.  
  229. sub toma_response {
  230.    my $control = "";
  231.    my $nave    = LWP::UserAgent->new();
  232.    $nave->agent( $agents[ rand @agents ] );
  233.    $nave->timeout(5);
  234.    my $code = $nave->get( $_[0] );
  235.    if ( $code->is_success ) {
  236.        $control = "1";
  237.    }
  238.    else {
  239.        $control = "0";
  240.    }
  241.    my $status = $code->status_line();
  242.    return ( $status, $control );
  243. }
  244.  
  245. sub toma_banner {
  246.    my $resultado = "";
  247.    my $nave      = LWP::UserAgent->new();
  248.    $nave->agent( $agents[ rand @agents ] );
  249.    $nave->timeout(5);
  250.    my $code = $nave->get( $_[0] );
  251.    $resultado = $resultado
  252.      . "--------------------------------------------------------------------------";
  253.    $resultado = $resultado . "\n[+] IP : " . get_ip( $_[0] );
  254.    $resultado = $resultado . "\n[+] Date : " . $code->header('date');
  255.    $resultado = $resultado . "\n[+] Server : " . $code->header('server');
  256.    $resultado =
  257.      $resultado . "\n[+] Connection : " . $code->header('connection');
  258.    $resultado =
  259.      $resultado . "\n[+] Content-Type : " . $code->header('content-type');
  260.  
  261.    if ( $code->header("Set-Cookie") ne "" ) {
  262.        $resultado =
  263.          $resultado . "\n[+] Cookie : " . $code->header("Set-Cookie");
  264.    }
  265.    $resultado = $resultado
  266.      . "\n--------------------------------------------------------------------------";
  267.    return $resultado;
  268. }
  269.  
  270. sub get_ip {
  271.    my ( $nomesirve1, $host, $nomesirve2, $nomesirve3, $nomesirve4 ) =
  272.      uri_split( $_[0] );
  273.    my $get = gethostbyname($host);
  274.    return inet_ntoa($get);
  275. }
  276.  
  277. sub toma_fecha_y_hora {
  278.  
  279.    my (
  280.        $segundos, $minutos,    $hora,       $dia, $mes,
  281.        $año,     $nomesirve1, $nomesirve2, $nomesirve3
  282.    ) = localtime(time);
  283.  
  284.    $año += 1900;
  285.    $mes++;
  286.  
  287.    return "[+] $_[0] Time : " . "$dia/$mes/$año $hora:$minutos:$segundos\n";
  288.  
  289. }
  290.  
  291. sub repes {
  292.    my @limpio;
  293.    foreach $test (@_) {
  294.        push @limpio, $test unless $repe{$test}++;
  295.    }
  296.    return @limpio;
  297. }
  298.  
  299. sub leer_archivo {
  300.    my @r;
  301.    my @words;
  302.    open( FILE, $_[0] );
  303.    @words = <FILE>;
  304.    close FILE;
  305.    for (@words) {
  306.        push( @r, $_ );
  307.    }
  308.    return (@r);
  309. }
  310.  
  311. #The End ?
  312.  

Un ejemplo de uso :

Código:

C:\Users\Doddy\Desktop\WarFactory\Warfactory X\perl\DH ViewBot>view.pl

-- == DH ViewBot 0.2 == --

[+] Options :

-single : Page to visit
-file : File with pages to visit
-randomfile : File with pages to visit as random
-timeout : Time for visit
-count : Count to visist

[+] Example : perl C:\Users\Doddy\Desktop\WarFactory\Warfactory X\perl\DH ViewBo
t\view.pl -single http://www.supertangas.com/index.php -timeout 5 -count 50

-- == (C) Doddy Hackman 2015 == --

C:\Users\Doddy\Desktop\WarFactory\Warfactory X\perl\DH ViewBot>view.pl -single h
ttp://www.petardas.com/index.php -timeout 5 -count 5

-- == DH ViewBot 0.2 == --

[+] Configuration

--------------------------------------------------
[+] Page : http://www.petardas.com/index.php
[+] Timeout : 5
[+] Visit Count  : 5
--------------------------------------------------

[+] Getting information ...

--------------------------------------------------------------------------
[+] IP : 5.135.178.142
[+] Date : Fri, 2 Jan 2015 16:44:10 GMT
[+] Server : Apache/2.2.3 (CentOS)
[+] Connection : close
[+] Content-Type : text/html; charset=latin1
[+] Cookie : pais=AR; expires=Sat, 07-Feb-2015 16:44:10 GMT; path=/; domain=www.
petardas.com, cookieconsent=1; expires=Sat, 07-Feb-2015 16:44:10 GMT; path=/; do
main=www.petardas.com, esmovil=0; expires=Mon, 2-Jan-2015 00:17:30 GMT; path=/;
 domain=www.petardas.com
--------------------------------------------------------------------------

[+] Started Time : 2/1/2015 13:44:31

[+] Successful Visits : 5

[+] Finished Time : 2/1/2015 13:45:2

-- == (C) Doddy Hackman 2015 == --



En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
perl
Scripting
nobo 0 3,186 Último mensaje 22 Febrero 2005, 07:49 am
por nobo
Perl
Scripting
zhynar_X 2 2,206 Último mensaje 12 Enero 2008, 04:36 am
por GroK
Libros de Perl online [PERL]
Scripting
madpitbull_99 0 3,816 Último mensaje 18 Mayo 2011, 21:49 pm
por madpitbull_99
[Perl] Creacion de un Joiner en Perl
Scripting
BigBear 0 2,771 Último mensaje 15 Marzo 2013, 16:12 pm
por BigBear
[Tutorial] Programado un viewbot en pascal usando APIS
Programación General
WarZ0n3 0 2,310 Último mensaje 3 Agosto 2013, 18:50 pm
por WarZ0n3
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines