[Perl Tk] DH Bomber 0.2

Iniciado por BigBear, 27 Septiembre 2013, 17:50 PM

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

BigBear

Un simple script para mandar mensajes de correo a donde quieran , para usarlo necesitan una cuenta en gmail , lo nuevo de esta version es que use otro modulo que hace que el script no tenga tantas dependencias como en la ultima version.

El codigo :

Código (perl) [Seleccionar]

#!usr/bin/perl
#DH Bomber 0.2
#Coded By Doddy H

use Win32::OLE;

head();

print "\n[+] Host : ";
chomp( my $host = <stdin> );

print "\n[+] Port : ";
chomp( my $puerto = <stdin> );

print "\n[+] Username : ";
chomp( my $username = <stdin> );

print "\n[+] Password : ";
chomp( my $password = <stdin> );

print "\n[+] Count Message : ";
chomp( my $count = <stdin> );

print "\n[+] To : ";
chomp( my $to = <stdin> );

print "\n[+] Subject : ";
chomp( my $asunto = <stdin> );

print "\n[+] Body : ";
chomp( my $body = <stdin> );

print "\n[+] File to Send : ";
chomp( my $file = <stdin> );

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

for my $num ( 1 .. $count ) {
    print "[+] Sending Message : $num\n";
    sendmail(
        $host,     $puerto, $username, $password, $username, $username,
        $username, $to,     $asunto,   $body,     $file
    );
}

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

copyright();

sub head {
    print "\n\n-- == DH Bomber 0.2 == --\n\n";
}

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

sub sendmail {

## Function Based on : http://code.activestate.com/lists/pdk/5351/
## Credits : Thanks to Phillip Richcreek and Eric Promislow

    my (
        $host, $port, $username, $password, $from, $cc,
        $bcc,  $to,   $asunto,   $mensaje,  $file
    ) = @_;

    $correo = Win32::OLE->new('CDO.Message');

    $correo->Configuration->Fields->SetProperty( "Item",
        'http://schemas.microsoft.com/cdo/configuration/sendusername',
        $username );
    $correo->Configuration->Fields->SetProperty( "Item",
        'http://schemas.microsoft.com/cdo/configuration/sendpassword',
        $password );
    $correo->Configuration->Fields->SetProperty( "Item",
        'http://schemas.microsoft.com/cdo/configuration/smtpserver', $host );
    $correo->Configuration->Fields->SetProperty( "Item",
        'http://schemas.microsoft.com/cdo/configuration/smtpserverport',
        $port );
    $correo->Configuration->Fields->SetProperty( "Item",
        'http://schemas.microsoft.com/cdo/configuration/smtpusessl', 1 );
    $correo->Configuration->Fields->SetProperty( "Item",
        'http://schemas.microsoft.com/cdo/configuration/sendusing', 2 );
    $correo->Configuration->Fields->SetProperty( "Item",
        'http://schemas.microsoft.com/cdo/configuration/smtpauthenticate', 1 );
    $correo->Configuration->Fields->Update();

    if ( -f $file ) {
        $correo->AddAttachment($file);
    }

    $correo->{From}     = $from;
    $correo->{CC}       = $cc;
    $correo->{BCC}      = $bcc;
    $correo->{To}       = $to;
    $correo->{Subject}  = $asunto;
    $correo->{TextBody} = $mensaje;
    $correo->Send();

}

# The End ?


Y aca les dejo la version Tk.

Una imagen :



El codigo :

Código (perl) [Seleccionar]

#!usr/bin/perl
#DH Bomber 0.2
#Coded By Doddy H

use Tk;
use Tk::ROText;
use Tk::FileSelect;
use Cwd;
use Win32::OLE;

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

my $color_fondo = "black";
my $color_texto = "white";

my $ve =
  MainWindow->new( -background => $color_fondo, -foreground => $color_texto );
$ve->geometry("920x560+20+20");
$ve->resizable( 0, 0 );
$ve->title("DH Bomber 0.2 (C) Doddy Hackman 2013");

$d = $ve->Frame(
    -relief     => "sunken",
    -bd         => 1,
    -background => $color_fondo,
    -foreground => $color_texto
);
my $ma = $d->Menubutton(
    -text             => "Mails",
    -underline        => 1,
    -background       => $color_fondo,
    -foreground       => $color_texto,
    -activebackground => $color_texto
)->pack( -side => "left" );
my $op = $d->Menubutton(
    -text             => "Options",
    -underline        => 1,
    -background       => $color_fondo,
    -foreground       => $color_texto,
    -activebackground => $color_texto
)->pack( -side => "left" );
my $ab = $d->Menubutton(
    -text             => "About",
    -underline        => 1,
    -background       => $color_fondo,
    -foreground       => $color_texto,
    -activebackground => $color_texto
)->pack( -side => "left" );
my $ex = $d->Menubutton(
    -text             => "Exit",
    -underline        => 1,
    -background       => $color_fondo,
    -foreground       => $color_texto,
    -activebackground => $color_texto
)->pack( -side => "left" );
$d->pack( -side => "top", -fill => "x" );

$ma->command(
    -label      => "Add Mailist",
    -background => $color_fondo,
    -foreground => $color_texto,
    -command    => \&addmailist
);
$ma->command(
    -label      => "Add Mail",
    -background => $color_fondo,
    -foreground => $color_texto,
    -command    => \&addmail
);
$ma->command(
    -label      => "Clean List",
    -background => $color_fondo,
    -foreground => $color_texto,
    -command    => \&delist
);

$op->command(
    -label      => "Spam Now",
    -background => $color_fondo,
    -foreground => $color_texto,
    -command    => \&spamnow
);
$op->command(
    -label      => "Add Attachment",
    -background => $color_fondo,
    -foreground => $color_texto,
    -command    => \&addfile
);
$op->command(
    -label      => "Clean All",
    -background => $color_fondo,
    -foreground => $color_texto,
    -command    => \&clean
);

$ab->command(
    -label      => "About",
    -background => $color_fondo,
    -foreground => $color_texto,
    -command    => \&about
);
$ex->command(
    -label      => "Exit",
    -background => $color_fondo,
    -foreground => $color_texto,
    -command    => \&chali
);

$ve->Label(
    -text       => "Gmail Login",
    -font       => "Impact3",
    -background => $color_fondo,
    -foreground => $color_texto
)->place( -x => 100, -y => 40 );

$ve->Label(
    -text       => "Username : ",
    -background => $color_fondo,
    -foreground => $color_texto
)->place( -x => 20, -y => 80 );
my $user = $ve->Entry(
    -width      => 30,
    -text       => 'lagartojuancho@gmail.com',
    -background => $color_fondo,
    -foreground => $color_texto
)->place( -y => 83, -x => 85 );

$ve->Label(
    -text       => "Password : ",
    -background => $color_fondo,
    -foreground => $color_texto
)->place( -x => 20, -y => 120 );
my $pass = $ve->Entry(
    -show       => "*",
    -width      => 30,
    -text       => 'Secret',
    -background => $color_fondo,
    -foreground => $color_texto
)->place( -y => 123, -x => 85 );

$ve->Label(
    -text       => "Message",
    -font       => "Impact3",
    -background => $color_fondo,
    -foreground => $color_texto
)->place( -x => 110, -y => 160 );

$ve->Label(
    -text       => "Number : ",
    -background => $color_fondo,
    -foreground => $color_texto
)->place( -x => 20, -y => 210 );
my $number = $ve->Entry(
    -width      => 5,
    -text       => "1",
    -background => $color_fondo,
    -foreground => $color_texto
)->place( -x => 75, -y => 212 );

$ve->Label(
    -text       => "Attachment : ",
    -background => $color_fondo,
    -foreground => $color_texto
)->place( -x => 20, -y => 240 );
my $fi = $ve->Entry(
    -text       => 'None',
    -width      => 30,
    -background => $color_fondo,
    -foreground => $color_texto
)->place( -x => 90, -y => 242 );

$ve->Label(
    -text       => "Subject : ",
    -background => $color_fondo,
    -foreground => $color_texto
)->place( -x => 20, -y => 270 );
my $tema = $ve->Entry(
    -text       => "Hi idiot",
    -width      => 20,
    -background => $color_fondo,
    -foreground => $color_texto
)->place( -x => 73, -y => 273 );

$ve->Label(
    -text       => "Body",
    -font       => "Impact3",
    -background => $color_fondo,
    -foreground => $color_texto
)->place( -x => 110, -y => 310 );
my $body = $ve->Scrolled(
    "Text",
    -width      => 30,
    -height     => 12,
    -background => $color_fondo,
    -foreground => $color_texto,
    -scrollbars => "e"
)->place( -x => 45, -y => 350 );
$body->insert( "end", "Welcome to the hell" );

$ve->Label(
    -text       => "Mailist",
    -font       => "Impact3",
    -background => $color_fondo,
    -foreground => $color_texto
)->place( -y => 40, -x => 400 );
my $mailist = $ve->Listbox(
    -height     => 31,
    -width      => 33,
    -background => $color_fondo,
    -foreground => $color_texto
)->place( -y => 85, -x => 330 );

$ve->Label(
    -text       => "Console",
    -font       => "Impact3",
    -background => $color_fondo,
    -foreground => $color_texto
)->place( -y => 40, -x => 685 );
my $console = $ve->Scrolled(
    "ROText",
    -width      => 40,
    -height     => 31,
    -background => $color_fondo,
    -foreground => $color_texto,
    -scrollbars => "e"
)->place( -x => 580, -y => 84 );

MainLoop;

sub addmailist {

    my $adda = MainWindow->new(
        -background => $color_fondo,
        -foreground => $color_texto
    );
    $adda->geometry("400x90+20+20");
    $adda->resizable( 0, 0 );
    $adda->title("Add Mailist");

    $adda->Label(
        -text       => "Mailist : ",
        -background => $color_fondo,
        -foreground => $color_texto,
        -font       => "Impact1"
    )->place( -x => 10, -y => 30 );
    my $en = $adda->Entry(
        -background => $color_fondo,
        -foreground => $color_texto,
        -width      => 33
    )->place( -y => 33, -x => 75 );
    $adda->Button(
        -text             => "Browse",
        -background       => $color_fondo,
        -foreground       => $color_texto,
        -width            => 7,
        -activebackground => $color_texto,
        -command          => \&brona
    )->place( -y => 33, -x => 285 );
    $adda->Button(
        -text             => "Load",
        -background       => $color_fondo,
        -foreground       => $color_texto,
        -width            => 7,
        -activebackground => $color_texto,
        -command          => \&bronaxa
    )->place( -y => 33, -x => 340 );

    sub brona {
        $browse = $adda->FileSelect( -directory => getcwd() );
        my $file = $browse->Show;
        $en->configure( -text => $file );
    }

    sub bronaxa {
        open( FILE, $en->get );
        @words = <FILE>;
        close FILE;

        for (@words) {
            $mailist->insert( "end", $_ );
        }
    }
}

sub addfile {

    my $addax = MainWindow->new(
        -background => $color_fondo,
        -foreground => $color_texto
    );
    $addax->geometry("390x90+20+20");
    $addax->resizable( 0, 0 );
    $addax->title("Add File");

    $addax->Label(
        -text       => "File : ",
        -background => $color_fondo,
        -foreground => $color_texto,
        -font       => "Impact1"
    )->place( -x => 10, -y => 30 );
    my $enaf = $addax->Entry(
        -background => $color_fondo,
        -foreground => $color_texto,
        -width      => 33
    )->place( -y => 33, -x => 55 );
    $addax->Button(
        -text             => "Browse",
        -background       => $color_fondo,
        -foreground       => $color_texto,
        -width            => 7,
        -activebackground => $color_texto,
        -command          => \&bronax
    )->place( -y => 33, -x => 265 );
    $addax->Button(
        -text             => "Load",
        -background       => $color_fondo,
        -foreground       => $color_texto,
        -width            => 7,
        -activebackground => $color_texto,
        -command          => \&bronaxx
    )->place( -y => 33, -x => 320 );

    sub bronax {
        $browse = $addax->FileSelect( -directory => getcwd() );
        my $filea = $browse->Show;
        $enaf->configure( -text => $filea );
    }

    sub bronaxx {
        $fi->configure( -text => $enaf->get );
    }
}

sub addmail {

    my $add = MainWindow->new(
        -background => $color_fondo,
        -foreground => $color_texto
    );
    $add->geometry("350x90+20+20");
    $add->resizable( 0, 0 );
    $add->title("Add Mail");

    $add->Label(
        -text       => "Mail : ",
        -background => $color_fondo,
        -foreground => $color_texto,
        -font       => "Impact1"
    )->place( -x => 10, -y => 30 );
    my $ew = $add->Entry(
        -background => $color_fondo,
        -foreground => $color_texto,
        -width      => 33
    )->place( -y => 33, -x => 60 );
    $add->Button(
        -text             => "Add",
        -background       => $color_fondo,
        -activebackground => $color_texto,
        -foreground       => $color_texto,
        -width            => 7,
        -command          => \&addnow
    )->place( -y => 33, -x => 275 );

    sub addnow {
        $mailist->insert( "end", $ew->get );
    }

}

sub delist {
    $mailist->delete( 0.0, "end" );
}

sub spamnow {

    $console->delete( 0.1, "end" );

    $console->insert( "end", "[+] Starting the Party\n\n" );

    my @mails = $mailist->get( "0.0", "end" );
    chomp @mails;
    for my $mail (@mails) {

        my $text = $body->get( "1.0", "end" );

        if ( $fi->get eq "None" ) {

            for ( 1 .. $number->get ) {

                $ve->update;
                $console->insert( "end",
                    "[+] Mail Number " . $_ . " to $mail\n" );

                sendmail(
                    "smtp.gmail.com", "465",
                    $user->get,       $pass->get,
                    $user->get,       $user->get,
                    $user->get,       $mail,
                    $tema->get,       $text,
                    ""
                );
            }

        }
        else {

            for ( 1 .. $number->get ) {

                $ve->update;
                $console->insert( "end",
                    "[+] Mail Number " . $_ . " to $mail\n" );

                sendmail(
                    "smtp.gmail.com", "465",
                    $user->get,       $pass->get,
                    $user->get,       $user->get,
                    $user->get,       $mail,
                    $tema->get,       $text,
                    $fi->get
                );
            }

        }
    }
    $console->insert( "end", "\n\n[+] Finished" );

}

sub clean {

    $user->configure( -text => " " );
    $pass->configure( -text => " " );
    $number->configure( -text => " " );
    $fi->configure( -text => "None" );
    $tema->configure( -text => " " );
    $body->delete( 0.1, "end" );
    $mailist->delete( 0.0, "end" );
    $console->delete( 0.1, "end" );

}

sub about {
    $about = MainWindow->new( -background => "black" );
    $about->title("About");
    $about->geometry("300x110");
    $about->resizable( 0, 0 );
    $about->Label( -background => "black", -foreground => "white" )->pack();
    $about->Label(
        -text       => "Contact : lepuke[at]hotmail[com]",
        -font       => "Impact",
        -background => "black",
        -foreground => "white"
    )->pack();
    $about->Label(
        -text       => "Web : doddyhackman.webcindario.com",
        -font       => "Impact",
        -background => "black",
        -foreground => "white"
    )->pack();
    $about->Label(
        -text       => "Blog : doddy-hackman.blogspot.com",
        -font       => "Impact",
        -background => "black",
        -foreground => "white"
    )->pack();
}

sub chali { exit(1); }

sub sendmail {

## Function Based on : http://code.activestate.com/lists/pdk/5351/
## Credits : Thanks to Phillip Richcreek and Eric Promislow

    my (
        $host, $port, $username, $password, $from, $cc,
        $bcc,  $to,   $asunto,   $mensaje,  $file
    ) = @_;

    $correo = Win32::OLE->new('CDO.Message');

    $correo->Configuration->Fields->SetProperty( "Item",
        'http://schemas.microsoft.com/cdo/configuration/sendusername',
        $username );
    $correo->Configuration->Fields->SetProperty( "Item",
        'http://schemas.microsoft.com/cdo/configuration/sendpassword',
        $password );
    $correo->Configuration->Fields->SetProperty( "Item",
        'http://schemas.microsoft.com/cdo/configuration/smtpserver', $host );
    $correo->Configuration->Fields->SetProperty( "Item",
        'http://schemas.microsoft.com/cdo/configuration/smtpserverport',
        $port );
    $correo->Configuration->Fields->SetProperty( "Item",
        'http://schemas.microsoft.com/cdo/configuration/smtpusessl', 1 );
    $correo->Configuration->Fields->SetProperty( "Item",
        'http://schemas.microsoft.com/cdo/configuration/sendusing', 2 );
    $correo->Configuration->Fields->SetProperty( "Item",
        'http://schemas.microsoft.com/cdo/configuration/smtpauthenticate', 1 );
    $correo->Configuration->Fields->Update();

    if ( -f $file ) {
        $correo->AddAttachment($file);
    }

    $correo->{From}     = $from;
    $correo->{CC}       = $cc;
    $correo->{BCC}      = $bcc;
    $correo->{To}       = $to;
    $correo->{Subject}  = $asunto;
    $correo->{TextBody} = $mensaje;
    $correo->Send();

}

#The End ?