[Perl] Whois Online 0.1

Iniciado por BigBear, Abril 23, 2012, 12:18:41 PM

Tema anterior - Siguiente tema

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

Abril 23, 2012, 12:18:41 PM Ultima modificación: Marzo 14, 2015, 10:20:01 AM por Expermicid
Debido a problemas con el modulo Net::Whois::Raw me vi obligado a realizar un whois mediante una pagina online.

Código: perl

#!usr/bin/perl
#Whois Online 0.1
#Coded By Doddy H

use LWP::UserAgent;

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);

head();
if ( $ARGV[0] ) {
    print whois( $ARGV[0] );
}
else {
    sintax();
}
copyright();

sub sintax {
    print "\n[+] Sintax : $0 <domain>\n";
}

sub head {
    print "\n-- == Whois Online 0.1 == --\n\n";
}

sub copyright {
    print "\n\n(C) Doddy Hackman 2012\n\n";
    exit(1);
}

sub whois {

    my $ob   = shift;
    my $code = tomar(
        "http://networking.ringofsaturn.com/Tools/whois.php",
        { "domain" => $ob, "submit" => "submit" }
    );

    my @chau = ( "&quot;", "&gt;&gt;&gt;", "&lt;&lt;&lt;" );

    if ( $code =~ /<pre>(.*?)<\/pre>/sig ) {
        my $resul = $1;
        chomp $resul;

        for my $cha (@chau) {
            $resul =~ s/$cha//ig;
        }

        if ( $resul =~ /Whois Server Version/ ) {
            return $resul;
        }
        else {
            return "Not Found";
        }
    }
}

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

sub tomar {
    my ( $web, $var ) = @_;
    return $nave->post( $web, [ %{$var} ] )->content;
}

# The End ?