[Perl] FindIcons 0.1

Iniciado por BigBear, Noviembre 25, 2012, 07:24:38 PM

Tema anterior - Siguiente tema

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

Un simple script para bajar los iconos que quieran , los iconos bajados se guardan en un carpeta con el nombre buscado.

Código: perl

#!usr/bin/perl
#FindIcons 0.1
#Coded By Doddy H

use LWP::UserAgent;
use URI::Split qw(uri_split);
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);

head();

print "[?] Search : ";
chomp( my $se = <stdin> );

$se =~ s/ /-/;

my $code = toma( "http://findicons.com/search/" . $se );

if ( $code =~ /<div class="box_info left">(.*)<\/div>/ ) {
    print "\n[+] $1\n";

    unless ( -d $se ) {
        mkdir( $se, "777" );
    }

    chdir $se;

}
else {
    print "\n[-] Not Found\n";
    copyright();
}

print "\n[?] Pages : ";

chomp( my $pages = <stdin> );

print "\n[+] Downloading ...\n\n";

for my $pages ( 1 .. $pages ) {

    my $code = toma("http://findicons.com/search/$se/$pages");

    while ( $code =~
        /<img src="http:\/\/png-(.*).findicons.com\/files\/(.*)" alt/mig )
    {
        my $link = "http://png-" . $1 . ".findicons.com/files/" . $2;

        now($link);

    }

}

print "[+] Finished ...\n";

copyright();

sub head {

    my @logo = (
        "#=============================================#", "\n",
        "#              FindIcons 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 now {

    my ( $scheme, $auth, $path, $query, $frag ) = uri_split( $_[0] );

    if ( $path =~ /(.*)\/(.*)$/ ) {
        my $file = $2;
        if ( download( $_[0], $file ) ) {
        }
    }
}

sub download {
    if ( $nave->mirror( $_[0], $_[1] ) ) {
        if ( -f $_[1] ) {
            return true;
        }
    }
}

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

#The End ?