Guest User

Untitled

a guest
Oct 23rd, 2017
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 4.40 KB | None | 0 0
  1. use strict;
  2. use warnings;
  3. use MRIM;
  4. use threads;
  5. use threads::shared;
  6. use D::dSub;
  7.  
  8. my %config                    = loadcfg('config.cfg');
  9.  
  10. $|=1;
  11.  
  12. my @trl                     = ();
  13. my @black_list : shared     = lf('./prospam/'.$config{'blacklist_file'});
  14. my @emails     : shared     = lf($config{'accounts_file'});
  15. my $total      : shared     = 0;
  16.  
  17. unshift @emails , $config{'test_account'};
  18.  
  19. for(0 .. $config{'threads'} - 1) { $trl[$_] = threads->create(\&main, $_); }
  20. for(@trl)   { $_->join; }
  21.  
  22. sub main
  23. {
  24.     sleep $_;
  25.     while(1)
  26.     {
  27.         last if !@emails;
  28.         my $mrim = new Net::MRIM;
  29.         my @cl = ();
  30.         my $line = shift @emails;      
  31.         if(login($mrim, $line))
  32.         {
  33.            
  34.             @cl = getcl($mrim);
  35.             #@cl    = get_online_contacts($mrim);
  36.             my @good_cl = look_to_black_list(@cl);         
  37.             lo(" Found ".scalar @good_cl ." contacts ($line) ");
  38.             sleep 5;
  39.             foreach my $contact(@good_cl)
  40.             {  
  41.                                
  42.                 if ($contact && $contact !~ /support/)
  43.                 {  
  44.                     my $sex = get_sex($mrim , $contact);
  45.                     my $text = create_text($sex);                  
  46.                     $mrim->send_message($contact, $text);                  
  47.                     write_to_black($contact);
  48.                    
  49.                     {
  50.                         lock @black_list;
  51.                         push @black_list ,$contact;
  52.                     }                  
  53.                    
  54.                     lo("  Sent to $contact ($line)");
  55.                    
  56.                     {
  57.                         lock($total);
  58.                         ++$total;
  59.                     }
  60.                    
  61.                     sleep $config{'delay'};
  62.                 }
  63.             }
  64.             writef('./prospam/'.$config{'prospam_file'} , $line);
  65.         }  
  66.         $mrim->disconnect();
  67.         undef $mrim;
  68.     }
  69. }
  70.  
  71. sub get_sex
  72. {
  73.     my ($mrim , $contact) = @_;
  74.    
  75.     my $sex = "";
  76.     my $ret=$mrim->ping();             
  77.     $ret=$mrim->contact_info($contact);
  78.    
  79.     if ($ret->is_message())
  80.     {
  81.         $sex = "From: ".$ret->get_from()." Message: ".$ret->get_message()." \n";
  82.     }
  83.     elsif ($ret->is_server_msg())
  84.     {
  85.         $sex = $ret->get_message()." \n";
  86.     }
  87.    
  88.     if ($sex =~ /Female/)
  89.     {
  90.         return "w";
  91.     }
  92.     else
  93.     {
  94.         return "m";
  95.     }
  96. }
  97.  
  98. sub write_to_black
  99. {
  100.     my ($contact) = @_;
  101.    
  102.     if ($contact !~ /dope_xx/)
  103.     {
  104.         writef('./prospam/'.$config{'blacklist_file'} , $contact);
  105.        
  106.     }  
  107. }
  108.  
  109. sub get_online_contacts
  110. {
  111.     my ($mrim) = @_;
  112.     my @online_contacts = ();
  113.     my $ret = $mrim->ping();
  114.     while(!$ret->is_contact_list())
  115.     {
  116.         $ret = $mrim->ping();
  117.     }  
  118.     my $clist=$ret->get_contacts();
  119.     while (my ($keys,$values)=each %$clist)
  120.     {
  121.         my $contact = $values->get_email();    
  122.         push @online_contacts , $contact;
  123.     }
  124.     return @online_contacts;
  125. }
  126.  
  127. sub look_to_black_list
  128. {
  129.     my (@cl) = @_;
  130.     my $index = 0; 
  131.     foreach (@cl)
  132.     {      
  133.         my $good_line = $_;
  134.         if (delete_array($good_line))
  135.         {
  136.             delete $cl[$index];
  137.         }
  138.         $index++;
  139.     }
  140.     return @cl;
  141. }
  142.  
  143. sub delete_array
  144. {
  145.     my ($line) = @_;
  146.     foreach (@black_list)
  147.     {
  148.         if ($_ =~/$line/)
  149.         {
  150.             return 1;
  151.         }
  152.     }
  153.     return 0;
  154. }
  155.  
  156. sub create_text
  157. {
  158.     my ($sex) = @_;
  159.    
  160.     my @links = ();
  161.     my @text = ();
  162.    
  163.     if ($sex eq 'm')
  164.     {
  165.         @links = lf($config{'links_file_m'});
  166.         @text  = lf($config{'text_file_m'});
  167.     }
  168.     elsif ($sex eq 'w')
  169.     {
  170.         @links = lf($config{'links_file_w'});
  171.         @text  = lf($config{'text_file_w'});
  172.     }
  173.    
  174.     my $trash = generate_prefix(3);
  175.     my $text = $text[rand scalar @text];   
  176.     my $link = $links[rand scalar @links];
  177.     $text = rand_parens_str($text);
  178.    
  179.     while ($text =~/(<<prob>>)/g)
  180.     {
  181.         my $prob = generate_clean();
  182.         $text =~ s/$1/$prob/g;
  183.     }  
  184.        
  185.     $text = replace_char($text, 10) ;  
  186.     $text =~ s/<<link>>/$link/g;
  187.     $text =~ s/<<trash>>/$trash/g;
  188.    
  189.     $text =~ s/\[br\]/\n/g;
  190.     return $text;
  191. }
  192.  
  193. sub generate_clean
  194. {
  195.     my $number = int rand(25);
  196.     my $str = ' ' x $number;
  197.     return $str;
  198. }
  199. sub uniq (@)
  200. {
  201.     my %seen = ();
  202.     grep { not $seen{$_}++ } @_;
  203. }
  204.  
  205.  
  206. sub getcl
  207. {
  208.     my $mrim = $_[0];
  209.     my $ret = $mrim->ping();
  210.     while(!$ret->is_contact_list())
  211.     {
  212.         $ret = $mrim->ping();
  213.     }
  214.     my @mass =  $ret->get_fcl();
  215.     undef $ret;
  216.     return @mass;
  217. }
  218.  
  219. sub login
  220. {
  221.     my ($mrim, $cred) = @_;
  222.     my ($login, $password) = split /$config{'delimiter'}/, $cred;
  223.     $mrim->hello();
  224.     if ($mrim->login($login, $password))
  225.     {
  226.         lo("[+] $cred ");
  227.         push @emails , $cred;
  228.         return 1;
  229.     }
  230.     else
  231.     {  
  232.         lo("[-] $cred ");
  233.         return 0;
  234.     }
  235. }
  236.  
  237. sub lo
  238. {
  239.     print " @_\n";
  240.     print "[total sent: $total]\r";
  241. }
  242.  
  243. sub generate_prefix
  244. {
  245.     my ($pwd_max) = @_;
  246.     $pwd_max = 20 if ($pwd_max < 1);
  247.     my @digit = qw(0 1 2 3 4 5 6 7 8 9 a s d f g h j k l z x c v b n m q w e r t y u i o p);
  248.     my $random_pwd;
  249.     for(1..$pwd_max)
  250.     {
  251.         $random_pwd .= $digit[int(rand($#digit))];
  252.     }
  253.     return $random_pwd;
  254. }
Add Comment
Please, Sign In to add comment