RHDyarAP

Filter Email

Dec 3rd, 2018
1,252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 11.08 KB | None | 0 0
  1. <?php
  2. date_default_timezone_set('Asia/Jakarta');
  3. /**
  4.  * @Author: Eka Syahwan
  5.  * @Date:   2017-09-09 07:04:25
  6.  * @Last Modified by:   RHD
  7.  * @Last Modified time: 2018-12-03 17:03:32
  8.  */
  9.  
  10. /*
  11.  + Usage : php check.php mail.txt
  12. */
  13.         $red  = "\033[1;31m";
  14.         $yell = "\033[1;33m";
  15.         $grn  = "\033[1;32m";
  16.         $blue = "\033[1;32m";
  17.         $prpl = "\033[1;35m";
  18.         $orng = "\033[0;33m";
  19.         $cyan = "\033[1;36m";
  20.         $whit = "\033[37m";
  21.         $grn  = "\e[32m";
  22.         $wht  = "\033[37m";
  23.         print "
  24. $grn=================================================================$wht
  25.                         $grn       .---.  $wht ".date("Y-m-d h:i:sa")."
  26.                         $grn      /     \ $wht
  27.                         $grn      \.@-@./ $wht
  28.                         $grn      /`\_/`\  $wht
  29.                         $grn     // RHD ,\  $wht
  30.                         $grn     | \     )|_  $wht
  31.                         $grn   /`\_`>  <_/ \  $wht
  32.                         $grn   \__/'---'\__/   $wht
  33. $grn==================================================================$wht\n";
  34. echo "                       [-Filter Email-]\r\n";
  35. sleep(2);
  36. error_reporting(0);
  37. ini_set('memory_limit', '-1');
  38. mkdir('result-email');
  39. mkdir('result-sampah');
  40.  
  41. $f = file_get_contents($argv[1]);
  42. $f = explode("\r\n", $f);
  43. $counts = count($f);
  44. $f = array_unique($f);
  45.  
  46. $count      = count($f);
  47. $yahoo      = 0;
  48. $gmail      = 0;
  49. $hotmail    = 0;
  50. $aol        = 0;
  51. $other      = 0;
  52. $icloud     = 0;
  53. $sampah     = 0;
  54. $valid      = 0;
  55. $hitung     = 0;
  56.  
  57. foreach ($f as $key => $email) {
  58.     $explode = explode("@", $email);
  59.     if(! is_numeric($explode[0]) && filter_var($email, FILTER_VALIDATE_EMAIL) && !preg_match("/marketplace|marketplace.amazon|example|test|auto@|cdiscount.com/", $explode[0]) && !preg_match("/marketplace|marketplace.amazon|example|test|auto@|cdiscount.com|emaildomain|.png/", $explode[1])){
  60.            
  61.  
  62.         preg_match_all('/(.*?)@(.*?)(.ac|.ag|.ai|.as|.biz.pr|.biz.tt|.bo|.br.com|.bs|.bz|.cl|.co.ag|.co.bz|.co.cr|.co.dm|.co.gy|.co.lc|.co.ms|.co.ni|.co.tt|.co.ve|.co.vi|.com.ag|.com.ai|.com.ar|.com.bo|.com.br|.com.bs|.com.bz|.com.co|.com.do|.com.ec|.com.gp|.com.gt|.com.gy|.com.hn|.com.ht|.com.jm|.com.kn|.com.lc|.com.ms|.com.mx|.com.ni|.com.pa|.com.pe|.com.pr|.com.py|.com.sv|.com.tt|.com.uy|.com.vc|.com.ve|.com.vi|.cr|.dm|.do|.ec|.gd|.gp|.gs|.gt|.gy|.hn|.ht|.info.ec|.kn|.lc|.mex.com|.ms|.mx|.net.ag|.net.br|.net.bz|.net.co|.net.ec|.net.ht|.net.pr|.net.vc|.nom.ag|.nom.co|.north.am|.org.ag|.org.bz|.org.ht|.org.ms|.org.pr|.org.vc|.pa|.pe|.pr|.south.am|.sx|.tc|.tt|.tv.br|.us|.us.com|.us.org|.uy|.vc|.vg)+$/m', $email , $american);
  63.  
  64.         preg_match_all('/(.*?)@(.*?)(.ac.nz|.ae|.ae.org|.af|.asia|.az|.bh|.biz.fj|.biz.id|.biz.ki|.biz.pk|.cc|.cn|.cn.com|.co.id|.co.in|.co.kr|.co.nz|.co.th|.com.af|.com.az|.com.bd|.com.bh|.com.cn|.com.fj|.com.hk|.com.jo|.com.ki|.com.kz|.com.lk|.com.my|.com.nf|.com.ph|.com.pk|.com.ps|.com.sa|.com.sb|.com.sg|.com.tw|.com.vn|.com.vu|.cx|.edu.sg|.firm.in|.fm|.geek.nz|.gen.in|.gen.nz|.hk|.hk.com|.hk.org|.id|.idv.hk|.in|.in.net|.in.th|.inc.hk|.ind.in|.info.fj|.info.ki|.info.nf|.int.az|.io|.jo|.ki|.kiwi.nz|.kr|.kz|.la|.lk|.ltd.hk|.maori.nz|.mn|.mobi.ki|.my|.my.id|.name.fj|.ne.kr|.net.az|.net.cn|.net.fj|.net.in|.net.ki|.net.nf|.net.nz|.net.pk|.net.ps|.net.sb|.net.vn|.nf|.nu|.nz|.or.kr|.org.az|.org.cn|.org.fj|.org.hk|.org.in|.org.ki|.org.kz|.org.lk|.org.nz|.org.pk|.org.ps|.org.sb|.org.sg|.org.vn|.per.sg|.ph|.phone.ki|.pk|.pp.az|.pro.fj|.ps|.qa|.sa|.sa.com|.sb|.school.nz|.sg|.tk|.tl|.tm|.to|.tv|.tw|.vn|.vu|.web.id|.web.nf|.web.pk|.ws|.한국|.公司.香港|.中国|.香港|.امارات|.السعودية|.網絡.香港|.組織.香港|.قطر)+$/m', $email , $asia);
  65.  
  66.        
  67.         preg_match_all('/(.*?)@(.*?)(.co.nl|.nl)+$/m', $email , $belanda);
  68.         preg_match_all('/(.*?)@(.*?)(.fr)+$/m', $email , $france);
  69.         preg_match_all('/(.*?)@(.*?)(.co.jp|.jp|.jp.net|.jpn.com|.or.jp)+$/m', $email , $japan);
  70.         preg_match_all('/(.*?)@(.*?)(.ca)+$/m', $email , $canada);
  71.         preg_match_all('/(.*?)@(.*?)(.asn.au|.auz.biz|.auz.info|.auz.net|.id.au|.net.au|.com.au|.org.au)+$/m', $email , $audonk);
  72.  
  73.         preg_match_all('/(.*?)@(.*?)(.ac.im|.am|.at|.ba|.be|.bg|.biz.pl|.biz.tr|.by|.ch|.co.at|.co.ee|.co.gg|.co.gl|.co.hu|.co.il|.co.im|.co.je|.co.no|.co.rs|.co.uk|.com.de|.com.es|.com.gl|.com.gr|.com.hr|.com.im|.com.mk|.com.mt|.com.pl|.com.pt|.com.ro|.com.ru|.com.se|.com.tr|.com.ua|.cz|.de|.de.com|.dk|.ee|.es|.eu|.eu.com|.fi|.gb.net|.gg|.gr|.gr.com|.hr|.hu|.hu.net|.ie|.im|.in.rs|.info.pl|.info.tr|.is|.it|.je|.li|.lt|.ltd.co.im|.ltd.uk|.lu|.lv|.md|.me.uk|.mk|.mp|.mt|.net.im|.net.mt|.net.pl|.net.ru|.net.ua|.no|.nom.es|.or.at|.org.es|.org.il|.org.im|.org.mt|.org.pl|.org.ua|.org.uk|.pl|.plc.co.im|.pm|.pt|.re|.ro|.rs|.ru|.ru.com|.se|.se.net|.si|.sk|.su|.tf|.tv.tr|.ua|.uk|.uk.com|.uk.net|.web.tr|.wf|.рф)+$/m', $email , $european);
  74.  
  75.  
  76.         preg_match_all('/(.*?)@(.*?)(.africa.com|.bi|.cd|.cg|.cm|.co.bi|.co.cm|.co.ke|.co.mg|.co.mw|.co.na|.co.ug|.co.za|.com.bi|.com.cm|.com.ly|.com.mg|.com.mw|.com.na|.com.ng|.com.sc|.coop.mw|.ly|.mg|.mu|.mw|.na|.net.cm|.net.mg|.net.za|.ng|.or.bi|.org.mg|.org.na|.org.za|.rw|.sc|.sh|.sl|.so|.st|.ug|.web.za|.za.com)+$/m', $email , $african);
  77.  
  78.  
  79.         if(preg_match("/gmail/", $explode[1])){
  80.             $x = fopen("result-email/email-gmail.txt", "a+");
  81.             fwrite($x, $email."\r\n");
  82.             fclose($x);
  83.            
  84.             $gmail++;
  85.  
  86.         }else if(preg_match("/yahoo|ymail|rocketmail/", $explode[1])){
  87.             $x = fopen("result-email/email-yahoo.txt", "a+");
  88.             fwrite($x, $email."\r\n");
  89.             fclose($x);
  90.  
  91.             $yahoo++;
  92.  
  93.         }else if(preg_match("/hotmail|live|outlook|msn/", $explode[1])){
  94.             $x = fopen("result-email/email-hotmail.txt", "a+");
  95.             fwrite($x, $email."\r\n");
  96.             fclose($x);
  97.             $hotmail++;
  98.         }else if(preg_match("/aol/", $explode[1])){
  99.             $x = fopen("result-email/email-aol.txt", "a+");
  100.             fwrite($x, $email."\r\n");
  101.             fclose($x);
  102.             $aol++;
  103.         }else if(preg_match("/me.com|icloud.com|mac.com/", $explode[1])){
  104.             $x = fopen("result-email/email-icloud.txt", "a+");
  105.             fwrite($x, $email."\r\n");
  106.             fclose($x);
  107.             $icloud++;
  108.         }else{
  109.  
  110.             if($japan[0][0]){
  111.  
  112.                 $x = fopen("result-email/other-japan.txt", "a+");
  113.                 fwrite($x, $japan[0][0]."\r\n");
  114.                 fclose($x);
  115.  
  116.                 $c_japan++;
  117.  
  118.             }else if($canada[0][0]){
  119.  
  120.                 $x = fopen("result-email/other-canda.txt", "a+");
  121.                 fwrite($x, $canada[0][0]."\r\n");
  122.                 fclose($x);
  123.  
  124.                 $c_canada++;
  125.  
  126.             }else if($belanda[0][0]){
  127.  
  128.                 $x = fopen("result-email/other-belanda.txt", "a+");
  129.                 fwrite($x, $belanda[0][0]."\r\n");
  130.                 fclose($x);
  131.  
  132.                 $c_belanda++;
  133.  
  134.             }else if($france[0][0]){
  135.  
  136.                 $x = fopen("result-email/other-france.txt", "a+");
  137.                 fwrite($x, $france[0][0]."\r\n");
  138.                 fclose($x);
  139.  
  140.                 $c_fr++;
  141.  
  142.             }else if($audonk[0][0]){
  143.  
  144.                 $x = fopen("result-email/other-au.txt", "a+");
  145.                 fwrite($x, $audonk[0][0]."\r\n");
  146.                 fclose($x);
  147.  
  148.                 $c_au++;
  149.  
  150.             }else if($american[0][0]){
  151.  
  152.                 $x = fopen("result-email/other-american.txt", "a+");
  153.                 fwrite($x, $american[0][0]."\r\n");
  154.                 fclose($x);
  155.  
  156.                 $c_amr++;
  157.  
  158.             }else if($asia[0][0]){
  159.                
  160.                 $x = fopen("result-email/other-asia.txt", "a+");
  161.                 fwrite($x, $asia[0][0]."\r\n");
  162.                 fclose($x);
  163.  
  164.                 $c_asia++;
  165.  
  166.             }else if($european[0][0]){
  167.  
  168.                 $x = fopen("result-email/other-european.txt", "a+");
  169.                 fwrite($x, $european[0][0]."\r\n");
  170.                 fclose($x);
  171.                 $c_euro++;
  172.  
  173.             }else if($african[0][0]){
  174.  
  175.                 $x = fopen("result-email/other-african.txt", "a+");
  176.                 fwrite($x, $african[0][0]."\r\n");
  177.                 fclose($x);
  178.                 $c_aff++;
  179.  
  180.             }else{
  181.                
  182.                 $x = fopen("result-email/other-benua.txt", "a+");
  183.                 fwrite($x, $email."\r\n");
  184.                 fclose($x);
  185.  
  186.                 $c_other++;
  187.             }
  188.  
  189.             $other++;
  190.         }
  191.  
  192.         $valid++;
  193.     }else{
  194.         $x = fopen("result-sampah/email-sampah.txt", "a+");
  195.         fwrite($x, $email."\r\n");
  196.         fclose($x);
  197.         $sampah++;
  198.     }
  199.     echo "$orng [Filter Email] Filtering Mail $red".number_format( $hitung , 0 , '' , ',' )." of ".number_format( $count , 0 , '' , ',' )."$cyan [ ".round(($hitung+1)/$count * 100,2)."% ]\r\n";
  200.     $hitung++;
  201. }
  202. print "
  203. $cyan-------------------------------------------------$wht
  204.    $prpl                 RESULT                  $wht
  205. $cyan-------------------------------------------------$wht
  206. $red.[+]$grn Hotmail : ".number_format( $hotmail, 0 , '' , ',' ).' ('. (round(100-($valid-$hotmail)/$valid * 100,2)) ."%)
  207. $red.[+]$grn Yahoo   : ".number_format( $yahoo, 0 , '' , ',' ).' ('. (round(100-($valid-$yahoo)/$valid * 100,2)) ."%)
  208. $red.[+]$grn Aol     : ".number_format( $aol, 0 , '' , ',' ).' ('. (round(100-($valid-$aol)/$valid * 100,2)) ."%)
  209. $red.[+]$grn Apple   : ".number_format( $icloud, 0 , '' , ',' ).' ('. (round(100-($valid-$icloud)/$valid * 100,2)) ."%)
  210. $red.[+]$grn Gmail   : ".number_format( $gmail, 0 , '' , ',' ).' ('. (round(100-($valid-$gmail)/$valid * 100,2)) ."%)
  211. $red.[+]$grn Other   : ".number_format( $other, 0 , '' , ',' ).' ('. (round(100-($valid-$other)/$count * 100,2)) ."%)
  212. -------------------------------------------------
  213. $red.[+]$yell ".strtoupper('asia').'     : '.number_format( $c_asia, 0 , '' , ',' ).' ('. (round(100-($valid-$c_asia)/$valid * 100,2)) ."%)
  214. $red.[+]$yell ".strtoupper('european').' : '.number_format( $c_euro, 0 , '' , ',' ).' ('. (round(100-($valid-$c_euro)/$valid * 100,2)) ."%)
  215. $red.[+]$yell ".strtoupper('American').' : '.number_format( $c_amr, 0 , '' , ',' ).' ('. (round(100-($valid-$c_amr)/$valid * 100,2)) ."%)
  216. $red.[+]$yell ".strtoupper('African').'  : '.number_format( $c_aff, 0 , '' , ',' ).' ('. (round(100-($valid-$c_aff)/$valid * 100,2)) ."%)
  217. $red.[+]$yell ".strtoupper('Other').'    : '.number_format( $c_other, 0 , '' , ',' ).' ('. (round(100-($valid-$c_other)/$valid * 100,2)) ."%)
  218. -------------------------------------------------
  219. $red.[+]$cyan ".strtoupper('Japan').'    : '.number_format( $c_japan, 0 , '' , ',' ).' ('. (round(100-($valid-$c_japan)/$valid * 100,2)) ."%)
  220. $red.[+]$cyan ".strtoupper('Canada').'   : '.number_format( $c_canada, 0 , '' , ',' ).' ('. (round(100-($valid-$c_canada)/$valid * 100,2)) ."%)
  221. $red.[+]$cyan ".strtoupper('Austra').'   : '.number_format( $c_au, 0 , '' , ',' ).' ('. (round(100-($valid-$c_au)/$valid * 100,2)) ."%)
  222. $red.[+]$cyan ".strtoupper('France').'   : '.number_format( $c_fr, 0 , '' , ',' ).' ('. (round(100-($valid-$c_fr)/$valid * 100,2)) ."%)
  223. $red.[+]$cyan ".strtoupper('Belanda').'  : '.number_format( $c_belanda, 0 , '' , ',' ).' ('. (round(100-($valid-$c_belanda)/$valid * 100,2)) ."%)
  224. -------------------------------------------------
  225. $red.[+]$prpl Jumlah Email Sama  : ".number_format( ($counts-$count) , 0 , '' , ',' ).' dari '.number_format( $counts, 0 , '' , ',' )." Email
  226. $red.[+]$prpl Jumlah Email Unik  : ".number_format( $count , 0 , '' , ',' )."
  227. $red.[+]$prpl Email  Bagus       : ".number_format( $valid , 0 , '' , ',' )."
  228. $red.[+]$prpl Email  Sampah      : ".number_format( $sampah , 0 , '' , ',' )."
  229. $red.[+]$prpl Reputasi Hasil     : ".(100-round(($valid-$other)/$count * 100,2))."%
  230. $cyan-------------------------------------------------$wht
  231. $red.[+]$prpl Filter date time : $wht".date("Y-m-d h:i:sa")."  
  232. $cyan-------------------------------------------------$wht
  233. \n";
Advertisement
Add Comment
Please, Sign In to add comment