Script Filter Email : Gmail, Yahoo & Hotmail

by teh - 03-07-2018 at 06:55 PM
Junior Member
Posts:
33
Joined:
Mar 2016
Likes:
0
Reputation:
0
2 Year Of Member
#1
OP
Posted: 03-07-2018, 06:55 PM
lama ane tidak terjun ke dunia fana ini hihi
kali ini ane mau share script dan sdikit jelaskan tentang tools buatan ane mailfilter.py
langsung aja cekidot ke source code nya :


Code:
#!/usr/bin/env python

from optparse import OptionParser
import os.path
import re

class warna():       #ini definisikan warna
   cetak = '\033[0m'
   ijo ='\033[1;32m'
   putih = '\033[1;37m'
   biru = '\033[1;34m'
   kuning = '\033[1;33m'
   abang = '\033[1;31m'

def author():  
   print('''%s  #tanda %s untuk menentukan string warna
______  ___      ___________________________________
___   |/  /_____ ___(_)__  /___  ____/__(_)__  /_  /_____________
__  /|_/ /_  __ `/_  /__  / __  /_   __  /__  /_  __/  _ \_  ___/
_  /  / / / /_/ /_  / _  /___  __/   _  / _  / / /_ /  __/  /
/_/  /_/  \__,_/ /_/  /_____/_/      /_/  /_/  \__/ \___//_/
                                                      v.01
%s
[+] Author      : Ruitze
[+] Tool        : MailFilter v.01
[+] Description : Filter mailist Gmail, Yahoo, Hotmail
[+] Usage       : python mailFilter.py nameMailist -o %s''' % (warna.ijo,warna.putih, warna.cetak))




regex = re.compile(r'''(
                  ([a-zA-Z0-9._%+-]+)
                   @
                   (gmail|yahoo|hotmail)
                   (\.com)
                   )''', re.VERBOSE)

def file_to_str(filename):
   with open(filename) as f:
       return f.read().lower()

def get_emails(s):
   return (email[0] for email in re.findall(regex, s) if not email[0].startswith('//'))

def main():
   parser = OptionParser()
   parser.add_option('-o','--output',dest='output',help='output file to saveFile.txt', action='store_true')
   (options, args) = parser.parse_args()
   try:
       if args and options.output:
           for arg in args:
               if os.path.isfile(arg):
                   for email in get_emails(file_to_str(arg)):
                       if 'gmail' in email:
                           f =open('gmailFile.txt', 'a')
                           f.write(email+'\n')
                           f.close()
                       elif 'yahoo' in email:
                           f = open('yahooFile.txt', 'a')
                           f.write(email + '\n')
                           f.close()
                       else:
                           f = open('hotmailFile.txt', 'a')
                           f.write(email + '\n')
                           f.close()
                   author()
                   print(warna.cetak)
                   print('%s[+] Succes filter to gmailFile.txt   [+]%s' % (warna.biru, warna.cetak))
                   print('%s[+] Succes filter to yahooFile.txt   [+]%s' % (warna.kuning, warna.cetak))
                   print('%s[+] Succes filter to hotmailFile.txt [+]%s' % (warna.abang, warna.cetak))
               else:
                   print('"{}" is not a file.').format(arg)

       else:
           author()
           print(warna.cetak)
   except Exception as e:
       print('Error Description', e)


if __name__=='__main__':
   main()
Reply
Find Posts
Junior Member
Posts:
6
Joined:
May 2018
Likes:
0
Reputation:
0
1 Year of Member
#2
Posted: 05-28-2018, 03:34 PM
fungsinya gimana gan, belum paham betul ane gan
Reply
Find Posts
Register an account or login to reply
Create an account
Create a free account today and start posting right away. It only takes a few seconds.
Login
Log into an existing account.
1 Guest(s)