| 0. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. | #!/usr/bin/python #Collects email addr from database #and writes them to a file. #added dupe checking #sh4rpr00ter project #http://www.darkc0de.com #d3hydr8[at]gmail[dot]com import sys, re, sets if len(sys.argv) != 3: print "\nUsage: ./dumpemail.py <database> <save file>" print "Example:" print "\t ./dumpemail.py db.sql emails.txt\n" sys.exit(1) try: database = open(sys.argv[1], "r").read() except(IOError): print "\nError: Check your db path\n" sys.exit(1) emails = list(sets.Set(re.findall('[\.\w]+@[a-zA-Z_]+?\.[a-zA-Z]{2,3}', database))) if len(emails) >= 1: ofile = open(sys.argv[2], "a") print "\nFound:",len(emails) print "Writing to file:",sys.argv[2],"\n\n" for e in emails: print e ofile.writelines(e+"\n") ofile.close() else: print "\n[-] No email addresses found\n" print "\n[+] Done\n" |