Comunidad Underground Hispana  

Retroceder   Comunidad Underground Hispana > Programacion > Programación > Perl


Respuesta Crear Nuevo Tema
 
Compartir en twitter LinkBack Herramientas Desplegado
Antiguo 28-abr-2012, 09:48   #1
Yes! I am invincible!
 
Avatar de Doddy
 
Fecha de Ingreso: febrero-2009
Ubicación: Infierno
Amigos 32
Mensajes: 2.399
Gracias: 0
Agradecido 153 veces en 109 mensajes.
Predeterminado [Perl Tk] Gmail Inbox 0.1

Un simple programa en Perl para leer el correo usando Gmail.

Una imagen



El codigo

Código:
#!usr/bin/perl
#Gmail Inbox 0.1
#Version Tk
#Coded By Doddy H
#Modules
#ppm install http://www.open.com.au/radiator/free-downloads/Net-SSLeay.ppd
#http://search.cpan.org/~sullr/IO-Socket-SSL-1.54/SSL.pm
#http://search.cpan.org/~fays/GMail-Checker-1.04/Checker.pm

use Tk;
use Tk::HList;
use Tk::ROText;
use GMail::Checker;
use HTML::Strip;

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

my $yeahfucktk = MainWindow->new();
$yeahfucktk->title(
    "Gmail Inbox 0.1 || Coded by Doddy H || [+] Status : <None>");
$yeahfucktk->geometry("870x220+20+20");
$yeahfucktk->resizable( 0, 0 );

my $agen = $yeahfucktk->Scrolled( HList,
    -columns    => 4,
    -header     => 1,
    -width      => 80,
    -scrollbars => "se"
)->place( -x => 20, -y => 20 );

$agen->headerCreate( 0, -text => "ID" );
$agen->headerCreate( 1, -text => "From" );
$agen->headerCreate( 2, -text => "Subject" );
$agen->headerCreate( 3, -text => "Date" );

$agen->bind( "<Double-1>", [ \&yeah ] );

$yeahfucktk->Label( -text => "Gmail Login", -font => "Impact" )
  ->place( -x => 650, -y => 20 );
$yeahfucktk->Label( -text => "Username : ", -font => "Impact1" )
  ->place( -x => 565, -y => 68 );
my $username = $yeahfucktk->Entry( -width => 30 )->place( -x => 653, -y => 73 );
$yeahfucktk->Label( -text => "Password : ", -font => "Impact1" )
  ->place( -x => 565, -y => 100 );
my $password =
  $yeahfucktk->Entry( -width => 30, -show => "*" )
  ->place( -x => 653, -y => 103 );
$yeahfucktk->Button(
    -text    => "Messages list",
    -width   => 20,
    -command => \&startnow
)->place( -x => 640, -y => 150 );

MainLoop;

sub startnow {
    $agen->delete( "all", 0 );
    my $total = total( $username->get, $password->get );
    $yeahfucktk->title(
"Gmail Inbox 0.1 || Coded by Doddy H || [+] Status : $total messages found"
    );

    for ( reverse 1 .. $total ) {
        $yeahfucktk->update;
        $yeahfucktk->title(
"Gmail Inbox 0.1 || Coded by Doddy H || [+] Status : Getting message $_"
        );
        my ( $from, $asunto, $date ) =
          getdata( $username->get, $password->get, $_ );

        $agen->add($_);
        $agen->itemCreate( $_, 0, -text => $_ );
        $agen->itemCreate( $_, 1, -text => $from );
        $agen->itemCreate( $_, 2, -text => $asunto );
        $agen->itemCreate( $_, 3, -text => $date );

    }
    $yeahfucktk->title(
        "Gmail Inbox 0.1 || Coded by Doddy H || [+] Status : <None>");
}

sub total {
    my $mod_total = new GMail::Checker( USERNAME => $_[0], PASSWORD => $_[1] );
    my ( $a, $b ) = $mod_total->get_msg_nb_size("TOTAL_MSG");
    return $a;
}

sub getdata {

    my $mod_msg = new GMail::Checker( USERNAME => $_[0], PASSWORD => $_[1] );
    my @msg = $mod_msg->get_msg( MSG => $_[2] );

    my $mas = $msg[0]->{headers};

    if ( $mas =~ /From: (.*)/ig ) {
        $from = $1;
    }

    if ( $mas =~ /Subject: (.*)/ig ) {
        $asunto = $1;
    }

    if ( $mas =~ /Date: (.*)/ig ) {
        $date = $1;
    }
    return ( $from, $asunto, $date );
}

sub yeah {
    my @ar = $agen->selectionGet();
    openmessage( $username->get, $password->get, $ar[0] );
}

sub openmessage {

    my $cons = MainWindow->new();
    $cons->geometry("500x350+20+20");
    $cons->resizable( 0, 0 );
    $cons->title("Reading message");

    my $conso = $cons->Scrolled(
        "ROText",
        -width      => 70,
        -height     => 40,
        -scrollbars => "e"
    )->pack();

    my $mod_msg = new GMail::Checker( USERNAME => $_[0], PASSWORD => $_[1] );

    my @msg = $mod_msg->get_msg( MSG => $_[2] );

    $conso->insert( "end", "[+] ID : $_[2]\n" );

    my $mas = $msg[0]->{headers};

    if ( $mas =~ /From: (.*)/ig ) {
        my $from = $1;
        $conso->insert( "end", "[+] From : $from\n" );
    }

    if ( $mas =~ /To: (.*)/ig ) {
        my $to = $1;
        $conso->insert( "end", "[+] To : $to\n" );
    }

    if ( $mas =~ /Subject: (.*)/ig ) {
        my $asunto = $1;
        $conso->insert( "end", "[+] Subject : $asunto\n" );
    }

    if ( $mas =~ /Date: (.*)/ig ) {
        my $date = $1;
        $conso->insert( "end", "[+] Date : $date\n\n" );
    }

    my $text = $msg[0]->{body};
    if ( $text =~
        /<body class=3D'hmmessage'><div dir=3D'ltr'>(.*?)<\/div><\/body>/sig )
    {
        my $body = $1;
        $body =~ s/<br>/\n/g;

        my $uno = HTML::Strip->new( emit_spaces => 1 );
        my $body = $uno->parse($body);
        $conso->insert( "end", $body );
    }
}

#The End ?
  
__________________
Doddy está desconectado   Responder Citando
Respuesta

Herramientas
Desplegado

Normas de Publicación
No puedes crear nuevos temas
No puedes responder mensajes
No puedes subir archivos adjuntos
No puedes editar tus mensajes

Los Códigos BB están Activado
Las Caritas están Activado
[IMG] está Activado
El Código HTML está Desactivado
Trackbacks están Activado
Pingbacks están Activado
Refbacks están Activado



Temas Similares
Tema Autor Foro Respuestas Último mensaje
[Perl] Gmail Inbox 0.1 Doddy Perl 0 28-abr-2012 09:48
Gmail Notifier Pro 4.1 Warez2010 Software 0 22-abr-2012 10:02
Descargar NINGAL Gmail Desktop 0.1.1.0 soft2010 Top 100 0 13-ene-2012 14:50
Descargar GMail Drive shell extension 1.0.17 soft2010 Top 100 0 01-sep-2011 08:38
Descargar GMail Desktop Notifier 1.0 soft2010 Top 100 0 28-jul-2011 07:34



Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.6.0