access.py 749 B

123456789101112131415161718192021222324252627282930
  1. import codecs
  2. import sys
  3. def crack_access_mdb(file):
  4. no_pass_62 = "0C"
  5. no_pass_42 = "BE68EC3765D79CFAFECD28E62B258A606C077B36CDE1DFB14F671343F73C"
  6. with open(file, "rb") as f:
  7. f.seek(66, 0) # x42 == 66
  8. myfile_42 = f.read(30)
  9. f.seek(98) # x62 == 98
  10. myfile_62 = f.read(1)
  11. salt = ord(codecs.decode(no_pass_62, "hex")) ^ ord(myfile_62)
  12. add_salt = True
  13. word = ""
  14. for i in range(0, 52, 4):
  15. xored = ord(codecs.decode(no_pass_42[i : i + 2], "hex")) ^ myfile_42[i // 2]
  16. if add_salt:
  17. xored = xored ^ salt
  18. word = word + chr(xored)
  19. add_salt = not add_salt
  20. print(word)
  21. if __name__ == "__main__":
  22. file = sys.argv[1]
  23. crack_access_mdb(file)