Advertisement
Doddy

DH ViewBot 0.2

Jan 1st, 2015
481
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 7.76 KB | None | 0 0
  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.         $anio,     $nomesirve1, $nomesirve2, $nomesirve3
  282.     ) = localtime(time);
  283.  
  284.     $anio += 1900;
  285.     $mes++;
  286.  
  287.     return "[+] $_[0] Time : " . "$dia/$mes/$anio $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 ?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement