[Perl] Half Life Servers List 0.1

Iniciado por BigBear, 12 Noviembre 2012, 23:30 PM

0 Miembros y 1 Visitante están viendo este tema.

BigBear

Este script se encarga de buscar servers del juego Half Life para entrar y jugar , los resultados se guardan en un archivo de texto.

El codigo

Código (perl) [Seleccionar]

#!usr/bin/perl
#Half Life Servers List 0.1
#Coded By Doddy H

use LWP::UserAgent;
use Cwd;
use Time::HiRes "usleep";

my $nave = LWP::UserAgent->new;
$nave->agent(
"Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8.1.12) Gecko/20080201Firefox/2.0.0.12"
);
$nave->timeout(5);

my @founds;
my @founds_final;

head();

print "[+] Searching Servers ....\n";

for my $count ( 1 .. 2 ) {

    my $code =
      toma( "http://www.game-monitor.com/search.php?game=valve&pg="
          . $count
          . "&num=100" );

    my @found = $code =~ m/(\d{1,3}[.]\d{1,3}[.]\d{1,3}[.]\d{1,3}:\d+)/g;

    for (@found) {
        push( @founds_final, $_ );
    }

}

my @founds_final = repes(@founds_final);

print "\n[+] Servers Found : " . int(@founds_final);

my $ruta_logs = getcwd() . "/" . "hl_servers.txt";

if ( -f $ruta_logs ) {
    unlink($ruta_logs);
}

open( LOGS, ">>hl_servers.txt" );

for (@founds_final) {
    print LOGS $_ . "\n";
}

close LOGS;

print "\n\n[+] All results are stored in : $ruta_logs\n";

if ( -f $ruta_logs ) {
    system($ruta_logs);
}

copyright();

sub head {

    my @logo = (
        "#=============================================#", "\n",
        "#         Half Life Servers List 0.1          #", "\n",
        "#---------------------------------------------#", "\n",
        "# Written By Doddy H                          #", "\n",
        "# Email: lepuke[at]hotmail[com]               #", "\n",
        "# Website: doddyhackman.webcindario.com       #", "\n",
        "#---------------------------------------------#", "\n",
        "# The End ?                                   #", "\n",
        "#=============================================#", "\n"
    );

    print "\n";

    marquesina(@logo);

    print "\n\n";

}

sub copyright {

    my @fin = ("-- == (C) Doddy Hackman 2012 == --");

    print "\n\n";
    marquesina(@fin);
    print "\n\n";

    <stdin>;

    exit(1);

}

sub marquesina {

    #Effect based in the exploits by Jafer Al Zidjali

    my @logo = @_;

    my $car = "|";

    for my $uno (@logo) {
        for my $dos ( split //, $uno ) {

            $|++;

            if ( $car eq "|" ) {
                mostrar( "\b" . $dos . $car, "/" );
            }
            elsif ( $car eq "/" ) {
                mostrar( "\b" . $dos . $car, "-" );
            }
            elsif ( $car eq "-" ) {
                mostrar( "\b" . $dos . $car, "\\" );
            }
            else {
                mostrar( "\b" . $dos . $car, "|" );
            }
            usleep(40_000);
        }
        print "\b ";
    }

    sub mostrar {
        print $_[0];
        $car = $_[1];
    }

}

sub repes {
    my @limpio;
    foreach $test (@_) {
        push @limpio, $test unless $repe{$test}++;
    }
    return @limpio;
}

sub toma {
    return $nave->get( $_[0] )->content;
}

#The End ?