13 Years of Service
57%
This script can be used for extracting mails from given file. Usage is simple:
Found mails will be saved in file checked.txt, and also checked for duplicates and if found same will be removed!
Code:
>python e-extract.py FILE_WITH_MAILS
Code:
>#!/usr/bin/python
# This was written for educational purpose and pentest only. Use it at your own risk.
# Author will be not responsible for any damage!
# !!! Special greetz for my friend sinner_01 !!!
# Toolname : e-extract.py
# Coder : baltazar a.k.a b4ltazar < [email protected]>
# Version : 0.1
# Greetz for rsauron and low1z, great python coders
# greetz for d3hydr8, r45c4l, qk, fx0, Soul, MikiSoft, c0ax, b0ne, tek0t and all members of ex darkc0de.com, ljuska.org
import subprocess, sys, re
try:
set
except(NameError):
from sets import Set as set
def logo():
print "\n|---------------------------------------------------------------|"
print "| b4ltazar[@]gmail[dot]com |"
print "| 04/2012 e-extract.py v.0.1 |"
print "| b4ltazar.wordpress.com & ljuska.org |"
print "| |"
print "|---------------------------------------------------------------|\n"
if sys.platform == 'linux' or sys.platform == 'linux2':
subprocess.call("clear", shell=True)
logo()
else:
subprocess.call("cls", shell=True)
logo()
if len(sys.argv) != 2:
print "[!] Usage: e-extract.py FILE_WITH_MAILS\n"
print "[!] Please visit b4ltazar.wordpress.com & ljuska.org"
print "[!] Thx for using this script, now exiting!"
sys.exit(1)
path = sys.argv[1]
try:
mails = open(path, "r")
new_mails = open("checked.txt", "a")
except(IOError):
print "[-] Error, please check your file path!"
print "[!] Please visit b4ltazar.wordpress.com & ljuska.org!"
print "[!] Thx for using this script, now exiting!"
sys.exit(1)
regex = re.compile(r"\b\w+@(\w+\.)+\w+\b")
for line in mails:
for mail in regex.finditer(line):
new_mails.write(mail.group(0)+"\n")
print "[+] Mails loaded from file : ", path
print "[+] Mails has been written to file: checked.txt"
mails.close()
new_mails.close()
emails = open('checked.txt', 'r').readlines()
print "[+] You have", len(emails), "mails in checked.txt"
print "[+] Removing duplicates, please wait!"
emails = list(set(emails))
print "[+] After removing duplicates, you have", len(emails), "mails in checked.txt"