Hola a todos , aca les traigo un programa que hice para mandar mails con las siguientes opciones.
- Mensajes que permitan codigo HTML.
- Adjuntar archivos
- Mandar la cantidad que quieran
- Se maneja con una lista de correos (para poder enviar el mismo mail a varios correos)
Para usarlo necesitan una cuenta Gmail para indicarle al programa que los mensajes van a ser enviados desde esa cuenta.
Una imagen del programa
El codigo (formateado con perltidy) es ...........
#!usr/bin/perl
#DH Spammer 0.1
#Coded By Doddy H
#Dependencies
#http://search.cpan.org/~peco/Email-Send-SMTP-Gmail-0.24/lib/Email/Send/SMTP/Gmail.pm
#http://search.cpan.org/~cwest/Net-SMTP-SSL-1.01/lib/Net/SMTP/SSL.pm
#http://search.cpan.org/~sullr/IO-Socket-SSL-1.54/SSL.pm
#ppm install http://www.open.com.au/radiator/free-downloads/Net-SSLeay.ppd
#http://search.cpan.org/~gbarr/Authen-SASL-2.15/lib/Authen/SASL.pod
#Based on http://robertmaldon.blogspot.com/2006/10/sending-email-through-google-smtp-from.html
use Tk;
use Tk::ROText;
use Tk::FileSelect;
use Email::Send::SMTP::Gmail;
use Net::SMTP::SSL;
use Cwd;
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 Spammer 0.1 (C) Doddy Hackman 2012");
$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" );
my $control = "0";
my $msg = Net::SMTP::SSL->new( "smtp.gmail.com", Port => 465 );
if ( $msg->auth( $user->get, $pass->get ) ) {
$control = "1";
}
else {
$control = "0";
}
$msg->quit();
if ($control) {
$console->insert( "end", "[+] Starting the Party\n\n" );
my @mails = $mailist->get( "0.0", "end" );
chomp @mails;
for my $mail (@mails) {
$ve->update;
$console->insert( "end", "[+] Mail : $mail\n" );
my $text = $body->get( "1.0", "end" );
if ( $fi->get eq "None" ) {
singlemail( $user->get, $pass->get, $mail, $tema->get, $text,
$number->get );
}
else {
singlemailwithfile( $user->get, $pass->get, $mail, $tema->get,
$text, $fi->get, $number->get );
}
}
$console->insert( "end", "\n\n[+] Finished" );
}
else {
$console->insert( "end", "[-] Bad Login\n" );
}
}
sub singlemail {
my ( $user, $password, $target, $asunto, $mensaje, $cantidad ) = @_;
for ( 1 .. $cantidad ) {
my $msg = Net::SMTP::SSL->new( "smtp.gmail.com", Port => 465 );
$msg->auth( $user, $password );
$msg->mail( $user . "\n" );
$msg->to( $target . "\n" );
$msg->data();
$msg->datasend( "From: " . $user . "\n" );
$msg->datasend( "To: " . $target . "\n" );
$msg->datasend( "Subject: " . $asunto . "\n" );
$msg->datasend("Content-Type: text/html \n");
$msg->datasend("\n");
$msg->datasend( $mensaje . "\n" );
$msg->dataend();
$msg->quit();
}
}
sub singlemailwithfile {
my ( $user, $password, $target, $asunto, $mensaje, $file, $cantidad ) = @_;
my $mail = Email::Send::SMTP::Gmail->new(
-smtp => "gmail.com",
-login => $user,
-pass => $password
);
for my $number ( 1 .. $cantidad ) {
$mail->send(
-to => $target,
-subject => $asunto,
-body => $mensaje,
-attachments => $file
);
}
$mail->bye;
}
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); }
#The End ?