access.py 797 B

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