Advertisement
illwill

strip breach csvs

Jan 12th, 2019
4,286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.14 KB | None | 0 0
  1. import glob
  2. import re
  3. import base64
  4. from sys import argv as sa
  5.  
  6. #input:
  7. #email,hash,plaintext,source,hashtype
  8. #000alejandro000@gmail.com,NULL,avm777EO,breach of ea origin accounts,plaintext
  9.  
  10. #output:
  11. #000alejandro000@gmail.com:000alejandro000:gmail.com,NULL:avm777EO:breach of ea origin accounts
  12.  
  13. d = glob.glob(sa[1])
  14. find = re.compile(r"([^,]*)")
  15.  
  16. try:
  17.  for i in d:
  18.      with open(i, "r") as f:
  19.          for x in f:
  20.              x = x.strip()
  21.              
  22.              output = re.split(find,x)
  23.              #print output
  24.              if len(output) > 2:
  25.                  try:
  26.                   email=output[1]
  27.                  except Exception as e:
  28.                   print("Failed on email: %s") % e
  29.                   pass
  30.                  try:
  31.                   user=str(email).split("@")[0]
  32.                  except Exception as e:
  33.                   #print("Failed on user: %s") % e
  34.                   pass
  35.                  try:
  36.                   domain=str(email).split("@")[1]
  37.                  except Exception as e:
  38.                  # print("Failed on domain: %s") % e
  39.                   pass
  40.                  try:
  41.                   hash=str(output[3])
  42.                  except Exception as e:
  43.                  # print("Failed on hash: %s") % e
  44.                   pass
  45.                  try:
  46.                   pwd=str(output[5])
  47.                  except Exception as e:
  48.                  # print("Failed on pwd: %s") % e
  49.                   pass
  50.                  try:
  51.                   #source=str(output[7])
  52.                   source = re.sub(' ','_',re.sub('(unknown time|breach(ed|)( of|)|pre-cracked|credentials( list|)|leak|accounts) ', '', str(output[7])))
  53.                  except Exception as e:
  54.                  # print("Failed on source: %s") % e
  55.                   pass                
  56.                  try:
  57.                   hashtype=str(output[9])
  58.                  except Exception as e:
  59.                  # print("Failed on hashtype: %s") % e
  60.                   pass
  61.                  
  62.                  print '%s:%s:%s:%s:%s:%s:%s' % (email,user,domain,hash,pwd,source,hashtype)
  63.  
  64. except Exception as e:
  65.  #print e
  66.  print output
  67.  pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement