def parse(self, data): """Parses the given data. May raise exceptions if incorrect data are given. You should not call this function yourself; DataStruct does data is a DataStruct object. Returns nothing. """ self.version = data.eat("L") self.provider = "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x" % data.eat("L2H8B") # For HMAC computation blobStart = data.ofs self.mkversion = data.eat("L") self.mkguid = "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x" % data.eat("L2H8B") self.flags = data.eat("L") self.description = data.eat_length_and_string("L").decode("UTF-16LE").encode("utf-8") self.cipherAlgo = crypto.CryptoAlgo(data.eat("L")) self.keyLen = data.eat("L") self.salt = data.eat_length_and_string("L") self.strong = data.eat_length_and_string("L") self.hashAlgo = crypto.CryptoAlgo(data.eat("L")) self.hashLen = data.eat("L") self.hmac = data.eat_length_and_string("L") self.cipherText = data.eat_length_and_string("L") # For HMAC computation self.blob = data.raw[blobStart:data.ofs] self.sign = data.eat_length_and_string("L")
def parse(self, data): self.version = data.eat("L") self.iv = data.eat("16s") self.rounds = data.eat("L") self.hashAlgo = crypto.CryptoAlgo(data.eat("L")) self.cipherAlgo = crypto.CryptoAlgo(data.eat("L")) self.ciphertext = data.remain() if self.SID: constant.dpapi_hash = self.jhash(self.SID, self.context)
def parse(self, data): self.revision = data.eat("L") self.hashAlgo = crypto.CryptoAlgo(data.eat("L")) self.rounds = data.eat("L") data.eat("L") self.cipherAlgo = crypto.CryptoAlgo(data.eat("L")) self.shaHashLen = data.eat("L") self.ntHashLen = data.eat("L") self.iv = data.eat("16s") self.userSID = RPC_SID() self.userSID.parse(data) n = self.shaHashLen + self.ntHashLen n += -n % self.cipherAlgo.blockSize self.encrypted = data.eat_string(n) self.revision2 = data.eat("L") self.guid = "%0x-%0x-%0x-%0x%0x-%0x%0x%0x%0x%0x%0x" % data.eat("L2H8B")
def __setstate__(self, d): for k in ["cipherAlgo", "hashAlgo"]: if k in d: d[k] = crypto.CryptoAlgo(d[k]) self.__dict__.update(d)