Advertisement
MGakowski

hash_over_writer.py

Dec 30th, 2016
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.78 KB | None | 0 0
  1. # input name of hash only file
  2. f = raw_input('Hash only, file name? ')
  3. print f + ".txt"
  4. read_file = f + ".txt"
  5.  
  6. g = raw_input("Hash:pass file name? ")
  7. print g + ".txt"
  8. pass_file = open(g + ".txt", "r")
  9.  
  10. lines = int(raw_input("How many hash:pass lines? "))
  11. hashlength = int(raw_input("char length of hash? "))
  12.  
  13. # Read in the file
  14. filedata = None
  15. with open(read_file, 'r') as file:
  16.     filedata = file.read()
  17.  
  18. for n in range(0, lines):
  19.   # Desired outpt string (hash:pass)
  20.   v = str(pass_file.readline())    # take out /n after readline
  21.   q = str(v.rstrip('\n'))
  22.   # Adjust length of hash type
  23.   hashfind = str(v[:hashlength])
  24.   # Writing
  25.   filedata = filedata.replace(hashfind, q)
  26.  
  27. # Write the file out again
  28. with open(read_file, 'w') as file:
  29.     file.write(filedata)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement