[Perl Tk] GoogleHack 0.3

Iniciado por BigBear, 1 Diciembre 2011, 22:08 PM

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

BigBear

Simple programa en tk para buscar en google


Código (perl) [Seleccionar]
#!usr/bin/perl
#GoogleHack 0.3
#By Doddy H
#Based in the program GoogleHacks
use Tk;
use Tk::PNG;

if ($^O eq 'MSWin32') {
use Win32::Console;
Win32::Console::Free();
}

my $ventana = MainWindow->new();
$ventana->title("GoogleHack 0.3 By Doddy H");
$ventana->geometry("370x300+20+20");
$ventana->resizable(0,0);

$ventana->Label(-font=>"Impact1",-text=>"String : ")->place(-x=>20,-y=>20);
my $v = $ventana->Entry(-text=>"Test",-width=>"31")->place(-x=>80,-y=>23);
$ventana->Button(-width=>"10",-text=>"Load",-command=>\&now)->place(-x=>278,-y=>23);

$ventana->Label(-text=>"Options",-font=>"Impact1")->place(-x=>140,-y=>70);

$ventana->Radiobutton(-text =>"Music", -value => "music",-variable=> \$op)->place(-x=>140,-y=>130);
$ventana->Radiobutton(-text =>"Programs", -value => "programs",-variable=> \$op)->place(-x=>140,-y=>160);
$ventana->Radiobutton(-text =>"Book", -value => "book",-variable=> \$op)->place(-x=>140,-y=>190);
$ventana->Radiobutton(-text =>"Videos", -value => "videos",-variable=> \$op)->place(-x=>140,-y=>220);
$ventana->Radiobutton(-text =>"Torrent", -value => "torrent",-variable=> \$op)->place(-x=>140,-y=>250);

MainLoop;

sub now {

my $test = $v->get;
my $link;

if ($op eq "music") {
$link = '-inurl:(htm|html|php) intitle:index of +last modified +parent directory +description +size +(.mp3|.wma|.ogg) "'.$test.'"';
}
elsif ($op eq "programs") {
$link = '-inurl:(htm|html|php) intitle:index of +last modified +parent directory +description +size +(.exe|.zip|.ddl) "'.$test.'"';
}
elsif ($op eq "book") {
$link = '-inurl:(htm|html|php) intitle:index of +last modified +parent directory +description +size +(.txt|.pps|.lit|.odt|.doc|.rtf|.zip|.rar|.pdf|.chm) "'.$test.'"';
}
elsif ($op eq "videos") {
$link = '-inurl:(htm|html|php) intitle:index of +last modified +parent directory +description +size +(.mpg|.avi|.flv|.wmv|.di) "'.$test.'"';
}
elsif ($op eq "torrent") {
$link = "$test filetype:torrent";
} else {
$link = "como aprender a escribir";
}
chomp $link;
my $final = "http://www.google.com.ar/search?q=".$link;
system('start firefox "'.$final.'"');
}

# The End ?