Skip to content

Commit

Permalink
Some python3 comp
Browse files Browse the repository at this point in the history
Former-commit-id: b2dfc249f8d631664bc3a2e094eaf5d75bd33117 [formerly 79f6462]
Former-commit-id: 52d593e04abdda594a275e7293a4fce56b0bca34
  • Loading branch information
AlessandroZ committed Aug 2, 2018
1 parent c2856de commit f04f211
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 839 deletions.
2 changes: 1 addition & 1 deletion Mac/lazagne/softwares/system/chainbreaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def run(self, software_name=None):
# try to open it (suppose the file has bad privilege or that the tool is launched with sudo rights)
key = open('/private/var/db/SystemKey').read()
system_key = binascii.hexlify(str(key[8:32])).upper()
except Exception, e:
except Exception as e:
print_debug('DEBUG', 'SystemKey file could not be openned: {error}'.format(error=str(e)))
try:
# try to open the file using a password found (supposing a password is also used as a system password)
Expand Down
12 changes: 2 additions & 10 deletions Mac/lazagne/softwares/system/chainbreaker_module/chainbreaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
#

from lazagne.config.write_output import print_debug
from lazagne.config.crypto.pyDes import *
import os
import struct
from binascii import unhexlify
import datetime
from pbkdf2 import pbkdf2
from pyDes import triple_des, CBC
from ctypes import *
from Schema import *

Expand Down Expand Up @@ -358,7 +358,7 @@ def getKeyblobRecord(self, base_addr, offset):

CipherLen = KeyBlobRecord.totalLength - KeyBlobRecord.startCryptoBlob
if CipherLen % BLOCKSIZE != 0:
print "Bad ciphertext len"
print_debug('ERROR', "Bad ciphertext len")
return '', '', '', 1

ciphertext = record[KeyBlobRecord.startCryptoBlob:KeyBlobRecord.totalLength]
Expand Down Expand Up @@ -412,28 +412,20 @@ def getInternetPWRecord(self, base_addr, offset):

record.append(self.getKeychainTime(BASE_ADDR, RecordMeta.CreationDate & 0xFFFFFFFE))
record.append(self.getKeychainTime(BASE_ADDR, RecordMeta.ModDate & 0xFFFFFFFE))

record.append(self.getLV(BASE_ADDR, RecordMeta.Description & 0xFFFFFFFE))
record.append(self.getLV(BASE_ADDR, RecordMeta.Comment & 0xFFFFFFFE))

record.append(self.getFourCharCode(BASE_ADDR, RecordMeta.Creator & 0xFFFFFFFE))
record.append(self.getFourCharCode(BASE_ADDR, RecordMeta.Type & 0xFFFFFFFE))

record.append(self.getLV(BASE_ADDR, RecordMeta.PrintName & 0xFFFFFFFE))
record.append(self.getLV(BASE_ADDR, RecordMeta.Alias & 0xFFFFFFFE))
record.append(self.getLV(BASE_ADDR, RecordMeta.Protected & 0xFFFFFFFE))
record.append(self.getLV(BASE_ADDR, RecordMeta.Account & 0xFFFFFFFE))
record.append(self.getLV(BASE_ADDR, RecordMeta.SecurityDomain & 0xFFFFFFFE))
record.append(self.getLV(BASE_ADDR, RecordMeta.Server & 0xFFFFFFFE))

record.append(self.getFourCharCode(BASE_ADDR, RecordMeta.Protocol & 0xFFFFFFFE))

record.append(self.getLV(BASE_ADDR, RecordMeta.AuthType & 0xFFFFFFFE))

record.append(self.getInt(BASE_ADDR, RecordMeta.Port & 0xFFFFFFFE))

record.append(self.getLV(BASE_ADDR, RecordMeta.Path & 0xFFFFFFFE))

return record

def getx509Record(self, base_addr, offset):
Expand Down
15 changes: 0 additions & 15 deletions Mac/lazagne/softwares/system/chainbreaker_module/pbkdf2.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,3 @@ def pbkdf2_F(h, salt, itercount, blocknum):

return T


def test():
# test vector from rfc3211
password = 'password'
salt = unhexlify('1234567878563412')
password = 'All n-entities must communicate with other n-entities via n-1 entiteeheehees'
itercount = 500
keylen = 16
ret = pbkdf2(password, salt, itercount, keylen)
print "key: %s" % hexlify(ret)
print "expected: 6A 89 70 BF 68 C9 2C AE A8 4A 8D F2 85 10 85 86"


if __name__ == '__main__':
test()
Loading

0 comments on commit f04f211

Please sign in to comment.