def addCredhistFile(self, sid, credfile): """Adds a Credhist file to the pool. sid is a string representing the user's SID credfile is the full path to the CREDHIST file to add. """ with open(credfile, 'rb') as f: self.addCredhist(sid, credhist.CredHistFile(f.read()))
def test_parse(self): c = credhist.CredHistFile(self.credhist) self.assertEquals(c.curr_guid, "355633b7-1ee3-4a46-8e93-c0998e62938") self.assertEquals(len(c.entries.items()), 4) g, i = c.entries.items()[0] self.assertEquals(i.revision, 1) self.assertEquals(i.hashAlgo.algnum, 0x8009) self.assertEquals(i.rounds, 4000) self.assertEquals(i.cipherAlgo.algnum, 0x6603) self.assertEquals(i.shaHashLen, 20) self.assertEquals(i.ntHashLen, 20) self.assertEquals(str(i.userSID), "S-1-5-21-583907252-1547161642-682003330-1001") self.assertEquals(i.guid, g) self.assertEquals(len(i.iv), 16) self.assertEquals(i.iv, "453685f445507b7cbc3d6f7bc7a942a8".decode("hex"))