VanGans

mail filter cli

Sep 17th, 2018
5,967
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 10.03 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:   VanGans
  7.  * @Last Modified time: 2018-09-17 17:03:32
  8.  */
  9. error_reporting(0);
  10. ini_set('memory_limit', '-1');
  11. mkdir('result-email');
  12. mkdir('result-sampah');
  13.  
  14. $f = file_get_contents($argv[1]);
  15. $f = explode("\r\n", $f);
  16. $counts = count($f);
  17. $f = array_unique($f);
  18.  
  19. $count      = count($f);
  20. $yahoo      = 0;
  21. $gmail      = 0;
  22. $hotmail    = 0;
  23. $aol        = 0;
  24. $other      = 0;
  25. $icloud     = 0;
  26. $sampah     = 0;
  27. $valid      = 0;
  28. $hitung     = 0;
  29. echo '
  30. ____ _ _    ___ ____ ____    ____ _  _ ____ _ _    
  31. |___ | |     |  |___ |__/    |___ |\/| |__| | |     SPAMMER ID 2018
  32. |    | |___  |  |___ |  \    |___ |  | |  | | |___  VanGans
  33.  
  34. ';
  35.  
  36.  
  37. foreach ($f as $key => $email) {
  38.     $explode = explode("@", $email);
  39.     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])){
  40.            
  41.  
  42.         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);
  43.  
  44.         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);
  45.  
  46.        
  47.         preg_match_all('/(.*?)@(.*?)(.co.nl|.nl)+$/m', $email , $belanda);
  48.         preg_match_all('/(.*?)@(.*?)(.fr)+$/m', $email , $france);
  49.         preg_match_all('/(.*?)@(.*?)(.co.jp|.jp|.jp.net|.jpn.com|.or.jp)+$/m', $email , $japan);
  50.         preg_match_all('/(.*?)@(.*?)(.ca)+$/m', $email , $canada);
  51.         preg_match_all('/(.*?)@(.*?)(.asn.au|.auz.biz|.auz.info|.auz.net|.id.au|.net.au|.com.au|.org.au)+$/m', $email , $audonk);
  52.  
  53.         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);
  54.  
  55.  
  56.         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);
  57.  
  58.  
  59.         if(preg_match("/gmail/", $explode[1])){
  60.             $x = fopen("result-email/email-gmail.txt", "a+");
  61.             fwrite($x, $email."\r\n");
  62.             fclose($x);
  63.            
  64.             $gmail++;
  65.  
  66.         }else if(preg_match("/yahoo|ymail|rocketmail/", $explode[1])){
  67.             $x = fopen("result-email/email-yahoo.txt", "a+");
  68.             fwrite($x, $email."\r\n");
  69.             fclose($x);
  70.  
  71.             $yahoo++;
  72.  
  73.         }else if(preg_match("/hotmail|live|outlook|msn/", $explode[1])){
  74.             $x = fopen("result-email/email-hotmail.txt", "a+");
  75.             fwrite($x, $email."\r\n");
  76.             fclose($x);
  77.             $hotmail++;
  78.         }else if(preg_match("/aol/", $explode[1])){
  79.             $x = fopen("result-email/email-aol.txt", "a+");
  80.             fwrite($x, $email."\r\n");
  81.             fclose($x);
  82.             $aol++;
  83.         }else if(preg_match("/me.com|icloud.com|mac.com/", $explode[1])){
  84.             $x = fopen("result-email/email-icloud.txt", "a+");
  85.             fwrite($x, $email."\r\n");
  86.             fclose($x);
  87.             $icloud++;
  88.         }else{
  89.  
  90.             if($japan[0][0]){
  91.  
  92.                 $x = fopen("result-email/other-japan.txt", "a+");
  93.                 fwrite($x, $japan[0][0]."\r\n");
  94.                 fclose($x);
  95.  
  96.                 $c_japan++;
  97.  
  98.             }else if($canada[0][0]){
  99.  
  100.                 $x = fopen("result-email/other-canda.txt", "a+");
  101.                 fwrite($x, $canada[0][0]."\r\n");
  102.                 fclose($x);
  103.  
  104.                 $c_canada++;
  105.  
  106.             }else if($belanda[0][0]){
  107.  
  108.                 $x = fopen("result-email/other-belanda.txt", "a+");
  109.                 fwrite($x, $belanda[0][0]."\r\n");
  110.                 fclose($x);
  111.  
  112.                 $c_belanda++;
  113.  
  114.             }else if($france[0][0]){
  115.  
  116.                 $x = fopen("result-email/other-france.txt", "a+");
  117.                 fwrite($x, $france[0][0]."\r\n");
  118.                 fclose($x);
  119.  
  120.                 $c_fr++;
  121.  
  122.             }else if($audonk[0][0]){
  123.  
  124.                 $x = fopen("result-email/other-au.txt", "a+");
  125.                 fwrite($x, $audonk[0][0]."\r\n");
  126.                 fclose($x);
  127.  
  128.                 $c_au++;
  129.  
  130.             }else if($american[0][0]){
  131.  
  132.                 $x = fopen("result-email/other-american.txt", "a+");
  133.                 fwrite($x, $american[0][0]."\r\n");
  134.                 fclose($x);
  135.  
  136.                 $c_amr++;
  137.  
  138.             }else if($asia[0][0]){
  139.                
  140.                 $x = fopen("result-email/other-asia.txt", "a+");
  141.                 fwrite($x, $asia[0][0]."\r\n");
  142.                 fclose($x);
  143.  
  144.                 $c_asia++;
  145.  
  146.             }else if($european[0][0]){
  147.  
  148.                 $x = fopen("result-email/other-european.txt", "a+");
  149.                 fwrite($x, $european[0][0]."\r\n");
  150.                 fclose($x);
  151.                 $c_euro++;
  152.  
  153.             }else if($african[0][0]){
  154.  
  155.                 $x = fopen("result-email/other-african.txt", "a+");
  156.                 fwrite($x, $african[0][0]."\r\n");
  157.                 fclose($x);
  158.                 $c_aff++;
  159.  
  160.             }else{
  161.                
  162.                 $x = fopen("result-email/other-benua.txt", "a+");
  163.                 fwrite($x, $email."\r\n");
  164.                 fclose($x);
  165.  
  166.                 $c_other++;
  167.             }
  168.  
  169.             $other++;
  170.         }
  171.  
  172.         $valid++;
  173.     }else{
  174.         $x = fopen("result-sampah/email-sampah.txt", "a+");
  175.         fwrite($x, $email."\r\n");
  176.         fclose($x);
  177.         $sampah++;
  178.     }
  179.     echo "[Filter Email - Bmarket.or.id] Email ".number_format( $hitung , 0 , '' , ',' )." of ".number_format( $count , 0 , '' , ',' )." -[ ".round(($hitung+1)/$count * 100,2)."% ]-\r\n";
  180.     $hitung++;
  181. }
  182. echo '
  183. -------------------------------------------------
  184.    REPORT EMAIL - Email Filter - Spammer ID
  185. -------------------------------------------------
  186. [+] Hotmail : '.number_format( $hotmail, 0 , '' , ',' ).' ('. (round(100-($valid-$hotmail)/$valid * 100,2)) .'%)
  187. [+] Yahoo   : '.number_format( $yahoo, 0 , '' , ',' ).' ('. (round(100-($valid-$yahoo)/$valid * 100,2)) .'%)
  188. [+] Aol     : '.number_format( $aol, 0 , '' , ',' ).' ('. (round(100-($valid-$aol)/$valid * 100,2)) .'%)
  189. [+] Apple   : '.number_format( $icloud, 0 , '' , ',' ).' ('. (round(100-($valid-$icloud)/$valid * 100,2)) .'%)
  190. [+] Gmail   : '.number_format( $gmail, 0 , '' , ',' ).' ('. (round(100-($valid-$gmail)/$valid * 100,2)) .'%)
  191. [+] Other   : '.number_format( $other, 0 , '' , ',' ).' ('. (round(100-($valid-$other)/$count * 100,2)) .'%)
  192. -------------------------------------------------
  193. [+] '.strtoupper('asia').'     : '.number_format( $c_asia, 0 , '' , ',' ).' ('. (round(100-($valid-$c_asia)/$valid * 100,2)) .'%)
  194. [+] '.strtoupper('european').' : '.number_format( $c_euro, 0 , '' , ',' ).' ('. (round(100-($valid-$c_euro)/$valid * 100,2)) .'%)
  195. [+] '.strtoupper('American').' : '.number_format( $c_amr, 0 , '' , ',' ).' ('. (round(100-($valid-$c_amr)/$valid * 100,2)) .'%)
  196. [+] '.strtoupper('African').'  : '.number_format( $c_aff, 0 , '' , ',' ).' ('. (round(100-($valid-$c_aff)/$valid * 100,2)) .'%)
  197. [+] '.strtoupper('Other').'    : '.number_format( $c_other, 0 , '' , ',' ).' ('. (round(100-($valid-$c_other)/$valid * 100,2)) .'%)
  198. -------------------------------------------------
  199. [+] '.strtoupper('Japan').'    : '.number_format( $c_japan, 0 , '' , ',' ).' ('. (round(100-($valid-$c_japan)/$valid * 100,2)) .'%)
  200. [+] '.strtoupper('Canada').'   : '.number_format( $c_canada, 0 , '' , ',' ).' ('. (round(100-($valid-$c_canada)/$valid * 100,2)) .'%)
  201. [+] '.strtoupper('Austra').'   : '.number_format( $c_au, 0 , '' , ',' ).' ('. (round(100-($valid-$c_au)/$valid * 100,2)) .'%)
  202. [+] '.strtoupper('France').'   : '.number_format( $c_fr, 0 , '' , ',' ).' ('. (round(100-($valid-$c_fr)/$valid * 100,2)) .'%)
  203. [+] '.strtoupper('Belanda').'   : '.number_format( $c_belanda, 0 , '' , ',' ).' ('. (round(100-($valid-$c_belanda)/$valid * 100,2)) .'%)
  204. -------------------------------------------------
  205. [+] Jumlah Email Sama  : '.number_format( ($counts-$count) , 0 , '' , ',' ).' dari '.number_format( $counts, 0 , '' , ',' ).' Email
  206. [+] Jumlah Email Unik  : '.number_format( $count , 0 , '' , ',' ).'
  207. [+] Email  Bagus       : '.number_format( $valid , 0 , '' , ',' ).'
  208. [+] Email  Sampah      : '.number_format( $sampah , 0 , '' , ',' ).'
  209. [+] Reputasi Hasil     : '.(100-round(($valid-$other)/$count * 100,2)).'%
  210. -------------------------------------------------
  211. [+] Filter date time : '.date("Y-m-d h:i:sa").'  
  212. -------------------------------------------------
  213. ';
Advertisement
Add Comment
Please, Sign In to add comment