Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- trait Email {
- public function _h(){
- $h[] = "\t Email Extractor V.1";
- $h[] = "\t Code By ZakirDotID";
- $h[] = "\t Don`t Change CopyRight!";
- $head = implode("\n", $h);
- return $head;
- }
- public static function _v($email){
- if (filter_var($email,FILTER_VALIDATE_EMAIL)) {
- return true;
- } else {
- return false;
- }
- }
- public static function run(){
- echo self::_h();
- echo "\n\t Input File : ";
- $file = trim(fgets(STDIN));
- $files = file_get_contents($file) or exit("\nError Fatal!\n");
- $ext = explode(".", $file);
- $email = explode("\r\n", $files);
- if ($ext[1] == "csv") {
- self::_csv($file);
- } else {
- echo "Found ( ".count($email)." )\n ";
- foreach ($email as $data) {
- echo "[+] $data \n";
- self::save("email.log",$data);
- }
- }
- }
- public static function _csv($file){
- $target = fopen($file, 'r');
- while($baris = fgetcsv($target, 0, ';')){
- for($i=0,$kolom=count($baris); $i<$kolom; $i++){
- if (self::_v($baris[$i]) == true) {
- echo " [+] $baris[$i] \n";
- self::save("email.log",$baris[$i]);
- } else {
- // Error Tidak Valid
- }
- }
- }
- fclose($target);
- }
- public static function save($file,$data){
- $fp = @fopen(date("d").$file, "a+");
- fwrite($fp, $data."\r\n");
- fclose($fp);
- }
- }
- Email::run();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement