• Publicidad

[Perl Tk] DH Bomber 0.2

¿Estás desarrollando un proyecto, o piensas hacerlo? Pon aquí tu propuesta, lo más seguro es que alguien esté interesado en ayudarte.

[Perl Tk] DH Bomber 0.2

Notapor BigBear » 2013-09-27 10:46 @490

Un simple script para mandar mensajes de correo a donde quieran. Para usarlo necesitan una cuenta en Gmail. Lo nuevo de esta versión es que usé otro módulo que hace que el script no tenga tantas dependencias como en la última versión.

El código:
Sintáxis: [ Descargar ] [ Ocultar ]
Using perl Syntax Highlighting
  1. #!usr/bin/perl
  2. #DH Bomber 0.2
  3. #Coded By Doddy H
  4.  
  5. use Win32::OLE;
  6.  
  7. head();
  8.  
  9. print "\n[+] Host : ";
  10. chomp( my $host = <stdin> );
  11.  
  12. print "\n[+] Port : ";
  13. chomp( my $puerto = <stdin> );
  14.  
  15. print "\n[+] Username : ";
  16. chomp( my $username = <stdin> );
  17.  
  18. print "\n[+] Password : ";
  19. chomp( my $password = <stdin> );
  20.  
  21. print "\n[+] Count Message : ";
  22. chomp( my $count = <stdin> );
  23.  
  24. print "\n[+] To : ";
  25. chomp( my $to = <stdin> );
  26.  
  27. print "\n[+] Subject : ";
  28. chomp( my $asunto = <stdin> );
  29.  
  30. print "\n[+] Body : ";
  31. chomp( my $body = <stdin> );
  32.  
  33. print "\n[+] File to Send : ";
  34. chomp( my $file = <stdin> );
  35.  
  36. print "\n[+] Starting ...\n\n";
  37.  
  38. for my $num ( 1 .. $count ) {
  39.     print "[+] Sending Message : $num\n";
  40.     sendmail(
  41.         $host,     $puerto, $username, $password, $username, $username,
  42.         $username, $to,     $asunto,   $body,     $file
  43.     );
  44. }
  45.  
  46. print "\n[+] Finished\n";
  47.  
  48. copyright();
  49.  
  50. sub head {
  51.     print "\n\n-- == DH Bomber 0.2 == --\n\n";
  52. }
  53.  
  54. sub copyright {
  55.     print "\n\n(C) Doddy Hackman 2013\n\n";
  56.     exit(1);
  57. }
  58.  
  59. sub sendmail {
  60.  
  61. ## Function Based on : http://code.activestate.com/lists/pdk/5351/
  62. ## Credits : Thanks to Phillip Richcreek and Eric Promislow
  63.  
  64.     my (
  65.         $host, $port, $username, $password, $from, $cc,
  66.         $bcc,  $to,   $asunto,   $mensaje,  $file
  67.     ) = @_;
  68.  
  69.     $correo = Win32::OLE->new('CDO.Message');
  70.  
  71.     $correo->Configuration->Fields->SetProperty( "Item",
  72.         'http://schemas.microsoft.com/cdo/configuration/sendusername',
  73.         $username );
  74.     $correo->Configuration->Fields->SetProperty( "Item",
  75.         'http://schemas.microsoft.com/cdo/configuration/sendpassword',
  76.         $password );
  77.     $correo->Configuration->Fields->SetProperty( "Item",
  78.         'http://schemas.microsoft.com/cdo/configuration/smtpserver', $host );
  79.     $correo->Configuration->Fields->SetProperty( "Item",
  80.         'http://schemas.microsoft.com/cdo/configuration/smtpserverport',
  81.         $port );
  82.     $correo->Configuration->Fields->SetProperty( "Item",
  83.         'http://schemas.microsoft.com/cdo/configuration/smtpusessl', 1 );
  84.     $correo->Configuration->Fields->SetProperty( "Item",
  85.         'http://schemas.microsoft.com/cdo/configuration/sendusing', 2 );
  86.     $correo->Configuration->Fields->SetProperty( "Item",
  87.         'http://schemas.microsoft.com/cdo/configuration/smtpauthenticate', 1 );
  88.     $correo->Configuration->Fields->Update();
  89.  
  90.     if ( -f $file ) {
  91.         $correo->AddAttachment($file);
  92.     }
  93.  
  94.     $correo->{From}     = $from;
  95.     $correo->{CC}       = $cc;
  96.     $correo->{BCC}      = $bcc;
  97.     $correo->{To}       = $to;
  98.     $correo->{Subject}  = $asunto;
  99.     $correo->{TextBody} = $mensaje;
  100.     $correo->Send();
  101.  
  102. }
  103.  
  104. # The End ?
Coloreado en 0.006 segundos, usando GeSHi 1.0.8.4

Y acá les dejo la versión Tk.

Imagen

El código:
Sintáxis: [ Descargar ] [ Ocultar ]
Using perl Syntax Highlighting
  1. #!usr/bin/perl
  2. #DH Bomber 0.2
  3. #Coded By Doddy H
  4.  
  5. use Tk;
  6. use Tk::ROText;
  7. use Tk::FileSelect;
  8. use Cwd;
  9. use Win32::OLE;
  10.  
  11. if ( $^O eq 'MSWin32' ) {
  12.     use Win32::Console;
  13.     Win32::Console::Free();
  14. }
  15.  
  16. my $color_fondo = "black";
  17. my $color_texto = "white";
  18.  
  19. my $ve =
  20.   MainWindow->new( -background => $color_fondo, -foreground => $color_texto );
  21. $ve->geometry("920x560+20+20");
  22. $ve->resizable( 0, 0 );
  23. $ve->title("DH Bomber 0.2 (C) Doddy Hackman 2013");
  24.  
  25. $d = $ve->Frame(
  26.     -relief     => "sunken",
  27.     -bd         => 1,
  28.     -background => $color_fondo,
  29.     -foreground => $color_texto
  30. );
  31. my $ma = $d->Menubutton(
  32.     -text             => "Mails",
  33.     -underline        => 1,
  34.     -background       => $color_fondo,
  35.     -foreground       => $color_texto,
  36.     -activebackground => $color_texto
  37. )->pack( -side => "left" );
  38. my $op = $d->Menubutton(
  39.     -text             => "Options",
  40.     -underline        => 1,
  41.     -background       => $color_fondo,
  42.     -foreground       => $color_texto,
  43.     -activebackground => $color_texto
  44. )->pack( -side => "left" );
  45. my $ab = $d->Menubutton(
  46.     -text             => "About",
  47.     -underline        => 1,
  48.     -background       => $color_fondo,
  49.     -foreground       => $color_texto,
  50.     -activebackground => $color_texto
  51. )->pack( -side => "left" );
  52. my $ex = $d->Menubutton(
  53.     -text             => "Exit",
  54.     -underline        => 1,
  55.     -background       => $color_fondo,
  56.     -foreground       => $color_texto,
  57.     -activebackground => $color_texto
  58. )->pack( -side => "left" );
  59. $d->pack( -side => "top", -fill => "x" );
  60.  
  61. $ma->command(
  62.     -label      => "Add Mailist",
  63.     -background => $color_fondo,
  64.     -foreground => $color_texto,
  65.     -command    => \&addmailist
  66. );
  67. $ma->command(
  68.     -label      => "Add Mail",
  69.     -background => $color_fondo,
  70.     -foreground => $color_texto,
  71.     -command    => \&addmail
  72. );
  73. $ma->command(
  74.     -label      => "Clean List",
  75.     -background => $color_fondo,
  76.     -foreground => $color_texto,
  77.     -command    => \&delist
  78. );
  79.  
  80. $op->command(
  81.     -label      => "Spam Now",
  82.     -background => $color_fondo,
  83.     -foreground => $color_texto,
  84.     -command    => \&spamnow
  85. );
  86. $op->command(
  87.     -label      => "Add Attachment",
  88.     -background => $color_fondo,
  89.     -foreground => $color_texto,
  90.     -command    => \&addfile
  91. );
  92. $op->command(
  93.     -label      => "Clean All",
  94.     -background => $color_fondo,
  95.     -foreground => $color_texto,
  96.     -command    => \&clean
  97. );
  98.  
  99. $ab->command(
  100.     -label      => "About",
  101.     -background => $color_fondo,
  102.     -foreground => $color_texto,
  103.     -command    => \&about
  104. );
  105. $ex->command(
  106.     -label      => "Exit",
  107.     -background => $color_fondo,
  108.     -foreground => $color_texto,
  109.     -command    => \&chali
  110. );
  111.  
  112. $ve->Label(
  113.     -text       => "Gmail Login",
  114.     -font       => "Impact3",
  115.     -background => $color_fondo,
  116.     -foreground => $color_texto
  117. )->place( -x => 100, -y => 40 );
  118.  
  119. $ve->Label(
  120.     -text       => "Username : ",
  121.     -background => $color_fondo,
  122.     -foreground => $color_texto
  123. )->place( -x => 20, -y => 80 );
  124. my $user = $ve->Entry(
  125.     -width      => 30,
  126.     -text       => '[email protected]',
  127.     -background => $color_fondo,
  128.     -foreground => $color_texto
  129. )->place( -y => 83, -x => 85 );
  130.  
  131. $ve->Label(
  132.     -text       => "Password : ",
  133.     -background => $color_fondo,
  134.     -foreground => $color_texto
  135. )->place( -x => 20, -y => 120 );
  136. my $pass = $ve->Entry(
  137.     -show       => "*",
  138.     -width      => 30,
  139.     -text       => 'Secret',
  140.     -background => $color_fondo,
  141.     -foreground => $color_texto
  142. )->place( -y => 123, -x => 85 );
  143.  
  144. $ve->Label(
  145.     -text       => "Message",
  146.     -font       => "Impact3",
  147.     -background => $color_fondo,
  148.     -foreground => $color_texto
  149. )->place( -x => 110, -y => 160 );
  150.  
  151. $ve->Label(
  152.     -text       => "Number : ",
  153.     -background => $color_fondo,
  154.     -foreground => $color_texto
  155. )->place( -x => 20, -y => 210 );
  156. my $number = $ve->Entry(
  157.     -width      => 5,
  158.     -text       => "1",
  159.     -background => $color_fondo,
  160.     -foreground => $color_texto
  161. )->place( -x => 75, -y => 212 );
  162.  
  163. $ve->Label(
  164.     -text       => "Attachment : ",
  165.     -background => $color_fondo,
  166.     -foreground => $color_texto
  167. )->place( -x => 20, -y => 240 );
  168. my $fi = $ve->Entry(
  169.     -text       => 'None',
  170.     -width      => 30,
  171.     -background => $color_fondo,
  172.     -foreground => $color_texto
  173. )->place( -x => 90, -y => 242 );
  174.  
  175. $ve->Label(
  176.     -text       => "Subject : ",
  177.     -background => $color_fondo,
  178.     -foreground => $color_texto
  179. )->place( -x => 20, -y => 270 );
  180. my $tema = $ve->Entry(
  181.     -text       => "Hi idiot",
  182.     -width      => 20,
  183.     -background => $color_fondo,
  184.     -foreground => $color_texto
  185. )->place( -x => 73, -y => 273 );
  186.  
  187. $ve->Label(
  188.     -text       => "Body",
  189.     -font       => "Impact3",
  190.     -background => $color_fondo,
  191.     -foreground => $color_texto
  192. )->place( -x => 110, -y => 310 );
  193. my $body = $ve->Scrolled(
  194.     "Text",
  195.     -width      => 30,
  196.     -height     => 12,
  197.     -background => $color_fondo,
  198.     -foreground => $color_texto,
  199.     -scrollbars => "e"
  200. )->place( -x => 45, -y => 350 );
  201. $body->insert( "end", "Welcome to the hell" );
  202.  
  203. $ve->Label(
  204.     -text       => "Mailist",
  205.     -font       => "Impact3",
  206.     -background => $color_fondo,
  207.     -foreground => $color_texto
  208. )->place( -y => 40, -x => 400 );
  209. my $mailist = $ve->Listbox(
  210.     -height     => 31,
  211.     -width      => 33,
  212.     -background => $color_fondo,
  213.     -foreground => $color_texto
  214. )->place( -y => 85, -x => 330 );
  215.  
  216. $ve->Label(
  217.     -text       => "Console",
  218.     -font       => "Impact3",
  219.     -background => $color_fondo,
  220.     -foreground => $color_texto
  221. )->place( -y => 40, -x => 685 );
  222. my $console = $ve->Scrolled(
  223.     "ROText",
  224.     -width      => 40,
  225.     -height     => 31,
  226.     -background => $color_fondo,
  227.     -foreground => $color_texto,
  228.     -scrollbars => "e"
  229. )->place( -x => 580, -y => 84 );
  230.  
  231. MainLoop;
  232.  
  233. sub addmailist {
  234.  
  235.     my $adda = MainWindow->new(
  236.         -background => $color_fondo,
  237.         -foreground => $color_texto
  238.     );
  239.     $adda->geometry("400x90+20+20");
  240.     $adda->resizable( 0, 0 );
  241.     $adda->title("Add Mailist");
  242.  
  243.     $adda->Label(
  244.         -text       => "Mailist : ",
  245.         -background => $color_fondo,
  246.         -foreground => $color_texto,
  247.         -font       => "Impact1"
  248.     )->place( -x => 10, -y => 30 );
  249.     my $en = $adda->Entry(
  250.         -background => $color_fondo,
  251.         -foreground => $color_texto,
  252.         -width      => 33
  253.     )->place( -y => 33, -x => 75 );
  254.     $adda->Button(
  255.         -text             => "Browse",
  256.         -background       => $color_fondo,
  257.         -foreground       => $color_texto,
  258.         -width            => 7,
  259.         -activebackground => $color_texto,
  260.         -command          => \&brona
  261.     )->place( -y => 33, -x => 285 );
  262.     $adda->Button(
  263.         -text             => "Load",
  264.         -background       => $color_fondo,
  265.         -foreground       => $color_texto,
  266.         -width            => 7,
  267.         -activebackground => $color_texto,
  268.         -command          => \&bronaxa
  269.     )->place( -y => 33, -x => 340 );
  270.  
  271.     sub brona {
  272.         $browse = $adda->FileSelect( -directory => getcwd() );
  273.         my $file = $browse->Show;
  274.         $en->configure( -text => $file );
  275.     }
  276.  
  277.     sub bronaxa {
  278.         open( FILE, $en->get );
  279.         @words = <FILE>;
  280.         close FILE;
  281.  
  282.         for (@words) {
  283.             $mailist->insert( "end", $_ );
  284.         }
  285.     }
  286. }
  287.  
  288. sub addfile {
  289.  
  290.     my $addax = MainWindow->new(
  291.         -background => $color_fondo,
  292.         -foreground => $color_texto
  293.     );
  294.     $addax->geometry("390x90+20+20");
  295.     $addax->resizable( 0, 0 );
  296.     $addax->title("Add File");
  297.  
  298.     $addax->Label(
  299.         -text       => "File : ",
  300.         -background => $color_fondo,
  301.         -foreground => $color_texto,
  302.         -font       => "Impact1"
  303.     )->place( -x => 10, -y => 30 );
  304.     my $enaf = $addax->Entry(
  305.         -background => $color_fondo,
  306.         -foreground => $color_texto,
  307.         -width      => 33
  308.     )->place( -y => 33, -x => 55 );
  309.     $addax->Button(
  310.         -text             => "Browse",
  311.         -background       => $color_fondo,
  312.         -foreground       => $color_texto,
  313.         -width            => 7,
  314.         -activebackground => $color_texto,
  315.         -command          => \&bronax
  316.     )->place( -y => 33, -x => 265 );
  317.     $addax->Button(
  318.         -text             => "Load",
  319.         -background       => $color_fondo,
  320.         -foreground       => $color_texto,
  321.         -width            => 7,
  322.         -activebackground => $color_texto,
  323.         -command          => \&bronaxx
  324.     )->place( -y => 33, -x => 320 );
  325.  
  326.     sub bronax {
  327.         $browse = $addax->FileSelect( -directory => getcwd() );
  328.         my $filea = $browse->Show;
  329.         $enaf->configure( -text => $filea );
  330.     }
  331.  
  332.     sub bronaxx {
  333.         $fi->configure( -text => $enaf->get );
  334.     }
  335. }
  336.  
  337. sub addmail {
  338.  
  339.     my $add = MainWindow->new(
  340.         -background => $color_fondo,
  341.         -foreground => $color_texto
  342.     );
  343.     $add->geometry("350x90+20+20");
  344.     $add->resizable( 0, 0 );
  345.     $add->title("Add Mail");
  346.  
  347.     $add->Label(
  348.         -text       => "Mail : ",
  349.         -background => $color_fondo,
  350.         -foreground => $color_texto,
  351.         -font       => "Impact1"
  352.     )->place( -x => 10, -y => 30 );
  353.     my $ew = $add->Entry(
  354.         -background => $color_fondo,
  355.         -foreground => $color_texto,
  356.         -width      => 33
  357.     )->place( -y => 33, -x => 60 );
  358.     $add->Button(
  359.         -text             => "Add",
  360.         -background       => $color_fondo,
  361.         -activebackground => $color_texto,
  362.         -foreground       => $color_texto,
  363.         -width            => 7,
  364.         -command          => \&addnow
  365.     )->place( -y => 33, -x => 275 );
  366.  
  367.     sub addnow {
  368.         $mailist->insert( "end", $ew->get );
  369.     }
  370.  
  371. }
  372.  
  373. sub delist {
  374.     $mailist->delete( 0.0, "end" );
  375. }
  376.  
  377. sub spamnow {
  378.  
  379.     $console->delete( 0.1, "end" );
  380.  
  381.     $console->insert( "end", "[+] Starting the Party\n\n" );
  382.  
  383.     my @mails = $mailist->get( "0.0", "end" );
  384.     chomp @mails;
  385.     for my $mail (@mails) {
  386.  
  387.         my $text = $body->get( "1.0", "end" );
  388.  
  389.         if ( $fi->get eq "None" ) {
  390.  
  391.             for ( 1 .. $number->get ) {
  392.  
  393.                 $ve->update;
  394.                 $console->insert( "end",
  395.                     "[+] Mail Number " . $_ . " to $mail\n" );
  396.  
  397.                 sendmail(
  398.                     "smtp.gmail.com", "465",
  399.                     $user->get,       $pass->get,
  400.                     $user->get,       $user->get,
  401.                     $user->get,       $mail,
  402.                     $tema->get,       $text,
  403.                     ""
  404.                 );
  405.             }
  406.  
  407.         }
  408.         else {
  409.  
  410.             for ( 1 .. $number->get ) {
  411.  
  412.                 $ve->update;
  413.                 $console->insert( "end",
  414.                     "[+] Mail Number " . $_ . " to $mail\n" );
  415.  
  416.                 sendmail(
  417.                     "smtp.gmail.com", "465",
  418.                     $user->get,       $pass->get,
  419.                     $user->get,       $user->get,
  420.                     $user->get,       $mail,
  421.                     $tema->get,       $text,
  422.                     $fi->get
  423.                 );
  424.             }
  425.  
  426.         }
  427.     }
  428.     $console->insert( "end", "\n\n[+] Finished" );
  429.  
  430. }
  431.  
  432. sub clean {
  433.  
  434.     $user->configure( -text => " " );
  435.     $pass->configure( -text => " " );
  436.     $number->configure( -text => " " );
  437.     $fi->configure( -text => "None" );
  438.     $tema->configure( -text => " " );
  439.     $body->delete( 0.1, "end" );
  440.     $mailist->delete( 0.0, "end" );
  441.     $console->delete( 0.1, "end" );
  442.  
  443. }
  444.  
  445. sub about {
  446.     $about = MainWindow->new( -background => "black" );
  447.     $about->title("About");
  448.     $about->geometry("300x110");
  449.     $about->resizable( 0, 0 );
  450.     $about->Label( -background => "black", -foreground => "white" )->pack();
  451.     $about->Label(
  452.         -text       => "Contact : lepuke[at]hotmail[com]",
  453.         -font       => "Impact",
  454.         -background => "black",
  455.         -foreground => "white"
  456.     )->pack();
  457.     $about->Label(
  458.         -text       => "Web : doddyhackman.webcindario.com",
  459.         -font       => "Impact",
  460.         -background => "black",
  461.         -foreground => "white"
  462.     )->pack();
  463.     $about->Label(
  464.         -text       => "Blog : doddy-hackman.blogspot.com",
  465.         -font       => "Impact",
  466.         -background => "black",
  467.         -foreground => "white"
  468.     )->pack();
  469. }
  470.  
  471. sub chali { exit(1); }
  472.  
  473. sub sendmail {
  474.  
  475. ## Function Based on : http://code.activestate.com/lists/pdk/5351/
  476. ## Credits : Thanks to Phillip Richcreek and Eric Promislow
  477.  
  478.     my (
  479.         $host, $port, $username, $password, $from, $cc,
  480.         $bcc,  $to,   $asunto,   $mensaje,  $file
  481.     ) = @_;
  482.  
  483.     $correo = Win32::OLE->new('CDO.Message');
  484.  
  485.     $correo->Configuration->Fields->SetProperty( "Item",
  486.         'http://schemas.microsoft.com/cdo/configuration/sendusername',
  487.         $username );
  488.     $correo->Configuration->Fields->SetProperty( "Item",
  489.         'http://schemas.microsoft.com/cdo/configuration/sendpassword',
  490.         $password );
  491.     $correo->Configuration->Fields->SetProperty( "Item",
  492.         'http://schemas.microsoft.com/cdo/configuration/smtpserver', $host );
  493.     $correo->Configuration->Fields->SetProperty( "Item",
  494.         'http://schemas.microsoft.com/cdo/configuration/smtpserverport',
  495.         $port );
  496.     $correo->Configuration->Fields->SetProperty( "Item",
  497.         'http://schemas.microsoft.com/cdo/configuration/smtpusessl', 1 );
  498.     $correo->Configuration->Fields->SetProperty( "Item",
  499.         'http://schemas.microsoft.com/cdo/configuration/sendusing', 2 );
  500.     $correo->Configuration->Fields->SetProperty( "Item",
  501.         'http://schemas.microsoft.com/cdo/configuration/smtpauthenticate', 1 );
  502.     $correo->Configuration->Fields->Update();
  503.  
  504.     if ( -f $file ) {
  505.         $correo->AddAttachment($file);
  506.     }
  507.  
  508.     $correo->{From}     = $from;
  509.     $correo->{CC}       = $cc;
  510.     $correo->{BCC}      = $bcc;
  511.     $correo->{To}       = $to;
  512.     $correo->{Subject}  = $asunto;
  513.     $correo->{TextBody} = $mensaje;
  514.     $correo->Send();
  515.  
  516. }
  517.  
  518. #The End ?
Coloreado en 0.014 segundos, usando GeSHi 1.0.8.4
BigBear
Perlero frecuente
Perlero frecuente
 
Mensajes: 981
Registrado: 2009-03-01 18:39 @818

Publicidad

Volver a Proyectos

¿Quién está conectado?

Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 0 invitados

cron