• Earn real money by being active: Hello Guest, earn real money by simply being active on the forum — post quality content, get reactions, and help the community. Once you reach the minimum credit amount, you’ll be able to withdraw your balance directly. Learn how it works.

Phyton e-extract.py

Status
Not open for further replies.

Versus71

Leech
User
Joined
Nov 3, 2011
Messages
168
Reputation
0
Reaction score
304
Points
63
Credits
0
‎13 Years of Service‎
57%
This script can be used for extracting mails from given file. Usage is simple:

Code:
>python e-extract.py FILE_WITH_MAILS
Found mails will be saved in file checked.txt, and also checked for duplicates and if found same will be removed!

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"
 
Status
Not open for further replies.
Back
Top