n0fate / chainbreaker

Mac OS X Keychain Forensic Tool
GNU General Public License v2.0
816 stars 157 forks source link

Support python 3 #29

Closed toshetah closed 1 year ago

toshetah commented 2 years ago

Hey,

I've solved it for the bounty, but I can't link the PR into the bounty. If you accept please consider me as the hunter. :)

THanks!

ericfitz commented 2 years ago

@toshetah - I'm still getting type errors:

┌─(~/Projects/bounty)───────────────────────────────────────────────────────────────────────────────────(eric@Erics-Mac-Pro:s000)─┐
└─(12:05:52-0400)──> git clone -b Support-python-3 git@github.com:toshetah/chainbreaker.git                    ──(Sun 2022-04-03)─┘
Cloning into 'chainbreaker'...
remote: Enumerating objects: 157, done.
remote: Counting objects: 100% (40/40), done.
remote: Compressing objects: 100% (29/29), done.
remote: Total 157 (delta 17), reused 13 (delta 11), pack-reused 117
Receiving objects: 100% (157/157), 121.70 KiB | 1.52 MiB/s, done.
Resolving deltas: 100% (83/83), done.
┌─(~/Projects/bounty)───────────────────────────────────────────────────────────────────────────────────(eric@Erics-Mac-Pro:s000)─┐
└─(12:06:19-0400)──> cd chainbreaker                                                                           ──(Sun 2022-04-03)─┘
┌─(~/Projects/bounty/chainbreaker)──────────────────────────────────────────────────────────────────────(eric@Erics-Mac-Pro:s000)─┐
└─(12:06:26-0400 on Support-python-3)──> sudo python3 ./chainbreaker.py -p -o ~/Downloads/keychain-export/ --export-private-keys /Library/Keychains/System.keychain --unlock-file /var/db/SystemKey
Unlock Password:
2022-04-03 12:06:39,337 - INFO -

ChainBreaker 2 - https://github.com/gaddie-3/chainbreaker

2022-04-03 12:06:39,337 - INFO - Runtime Command: ./chainbreaker.py -p -o /Users/eric/Downloads/keychain-export/ --export-private-keys /Library/Keychains/System.keychain --unlock-file /var/db/SystemKey
2022-04-03 12:06:39,337 - INFO - Keychain: /Library/Keychains/System.keychain
2022-04-03 12:06:39,337 - INFO - Keychain MD5: dcbe47b235cf7fbe6d478b908f2db39e
2022-04-03 12:06:39,337 - INFO - Keychain 256: fb2b63894837680590f21b8ade98340b2a2f283e20324d963fcab49c794bf16d
2022-04-03 12:06:39,338 - INFO - Dump Start: 2022-04-03 12:06:39.337130
2022-04-03 12:06:39,339 - WARNING - Keychain signature does not match. are you sure this is a valid keychain file?
Traceback (most recent call last):
  File "/Users/eric/Projects/bounty/chainbreaker/./chainbreaker.py", line 1290, in <module>
    keychain = Chainbreaker(args.keychain, unlock_password=args.password, unlock_key=args.key,
  File "/Users/eric/Projects/bounty/chainbreaker/./chainbreaker.py", line 77, in __init__
    self.unlock_password = unlock_password
  File "/Users/eric/Projects/bounty/chainbreaker/./chainbreaker.py", line 584, in unlock_password
    master_key = self._generate_master_key(self._unlock_password)
  File "/Users/eric/Projects/bounty/chainbreaker/./chainbreaker.py", line 348, in _generate_master_key
    return str(PBKDF2(pw, str(bytearray(self.dbblob.Salt)), 1000, Chainbreaker.KEYLEN))
  File "/Users/eric/Projects/bounty/chainbreaker/pbkdf2.py", line 39, in __init__
    for i in range(1, l + 1):
TypeError: 'float' object cannot be interpreted as an integer
toshetah commented 2 years ago

Sorry @ericfitz ! I committed a fix.

GingerGeneste commented 2 years ago

I have created a PR for this a while ago, see: https://github.com/n0fate/chainbreaker/pull/21