Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use strict;
- use warnings;
- use MRIM;
- use threads;
- use threads::shared;
- use D::dSub;
- my %config = loadcfg('config.cfg');
- $|=1;
- my @trl = ();
- my @black_list : shared = lf('./prospam/'.$config{'blacklist_file'});
- my @emails : shared = lf($config{'accounts_file'});
- my $total : shared = 0;
- unshift @emails , $config{'test_account'};
- for(0 .. $config{'threads'} - 1) { $trl[$_] = threads->create(\&main, $_); }
- for(@trl) { $_->join; }
- sub main
- {
- sleep $_;
- while(1)
- {
- last if !@emails;
- my $mrim = new Net::MRIM;
- my @cl = ();
- my $line = shift @emails;
- if(login($mrim, $line))
- {
- @cl = getcl($mrim);
- #@cl = get_online_contacts($mrim);
- my @good_cl = look_to_black_list(@cl);
- lo(" Found ".scalar @good_cl ." contacts ($line) ");
- sleep 5;
- foreach my $contact(@good_cl)
- {
- if ($contact && $contact !~ /support/)
- {
- my $sex = get_sex($mrim , $contact);
- my $text = create_text($sex);
- $mrim->send_message($contact, $text);
- write_to_black($contact);
- {
- lock @black_list;
- push @black_list ,$contact;
- }
- lo(" Sent to $contact ($line)");
- {
- lock($total);
- ++$total;
- }
- sleep $config{'delay'};
- }
- }
- writef('./prospam/'.$config{'prospam_file'} , $line);
- }
- $mrim->disconnect();
- undef $mrim;
- }
- }
- sub get_sex
- {
- my ($mrim , $contact) = @_;
- my $sex = "";
- my $ret=$mrim->ping();
- $ret=$mrim->contact_info($contact);
- if ($ret->is_message())
- {
- $sex = "From: ".$ret->get_from()." Message: ".$ret->get_message()." \n";
- }
- elsif ($ret->is_server_msg())
- {
- $sex = $ret->get_message()." \n";
- }
- if ($sex =~ /Female/)
- {
- return "w";
- }
- else
- {
- return "m";
- }
- }
- sub write_to_black
- {
- my ($contact) = @_;
- if ($contact !~ /dope_xx/)
- {
- writef('./prospam/'.$config{'blacklist_file'} , $contact);
- }
- }
- sub get_online_contacts
- {
- my ($mrim) = @_;
- my @online_contacts = ();
- my $ret = $mrim->ping();
- while(!$ret->is_contact_list())
- {
- $ret = $mrim->ping();
- }
- my $clist=$ret->get_contacts();
- while (my ($keys,$values)=each %$clist)
- {
- my $contact = $values->get_email();
- push @online_contacts , $contact;
- }
- return @online_contacts;
- }
- sub look_to_black_list
- {
- my (@cl) = @_;
- my $index = 0;
- foreach (@cl)
- {
- my $good_line = $_;
- if (delete_array($good_line))
- {
- delete $cl[$index];
- }
- $index++;
- }
- return @cl;
- }
- sub delete_array
- {
- my ($line) = @_;
- foreach (@black_list)
- {
- if ($_ =~/$line/)
- {
- return 1;
- }
- }
- return 0;
- }
- sub create_text
- {
- my ($sex) = @_;
- my @links = ();
- my @text = ();
- if ($sex eq 'm')
- {
- @links = lf($config{'links_file_m'});
- @text = lf($config{'text_file_m'});
- }
- elsif ($sex eq 'w')
- {
- @links = lf($config{'links_file_w'});
- @text = lf($config{'text_file_w'});
- }
- my $trash = generate_prefix(3);
- my $text = $text[rand scalar @text];
- my $link = $links[rand scalar @links];
- $text = rand_parens_str($text);
- while ($text =~/(<<prob>>)/g)
- {
- my $prob = generate_clean();
- $text =~ s/$1/$prob/g;
- }
- $text = replace_char($text, 10) ;
- $text =~ s/<<link>>/$link/g;
- $text =~ s/<<trash>>/$trash/g;
- $text =~ s/\[br\]/\n/g;
- return $text;
- }
- sub generate_clean
- {
- my $number = int rand(25);
- my $str = ' ' x $number;
- return $str;
- }
- sub uniq (@)
- {
- my %seen = ();
- grep { not $seen{$_}++ } @_;
- }
- sub getcl
- {
- my $mrim = $_[0];
- my $ret = $mrim->ping();
- while(!$ret->is_contact_list())
- {
- $ret = $mrim->ping();
- }
- my @mass = $ret->get_fcl();
- undef $ret;
- return @mass;
- }
- sub login
- {
- my ($mrim, $cred) = @_;
- my ($login, $password) = split /$config{'delimiter'}/, $cred;
- $mrim->hello();
- if ($mrim->login($login, $password))
- {
- lo("[+] $cred ");
- push @emails , $cred;
- return 1;
- }
- else
- {
- lo("[-] $cred ");
- return 0;
- }
- }
- sub lo
- {
- print " @_\n";
- print "[total sent: $total]\r";
- }
- sub generate_prefix
- {
- my ($pwd_max) = @_;
- $pwd_max = 20 if ($pwd_max < 1);
- 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);
- my $random_pwd;
- for(1..$pwd_max)
- {
- $random_pwd .= $digit[int(rand($#digit))];
- }
- return $random_pwd;
- }
Add Comment
Please, Sign In to add comment