当前位置: 首页>>代码示例>>Python>>正文


Python Keybag.createWithDataSignBlob方法代码示例

本文整理汇总了Python中keystore.keybag.Keybag.createWithDataSignBlob方法的典型用法代码示例。如果您正苦于以下问题:Python Keybag.createWithDataSignBlob方法的具体用法?Python Keybag.createWithDataSignBlob怎么用?Python Keybag.createWithDataSignBlob使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在keystore.keybag.Keybag的用法示例。


在下文中一共展示了Keybag.createWithDataSignBlob方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: bf_system

# 需要导入模块: from keystore.keybag import Keybag [as 别名]
# 或者: from keystore.keybag.Keybag import createWithDataSignBlob [as 别名]
def bf_system():
    client = RamdiskToolClient()
    di = client.getDeviceInfos()
    devicedir = di["udid"]
    if os.getcwd().find(devicedir) == -1:
        try:
            os.mkdir(devicedir)
        except:
            pass
        os.chdir(devicedir)
    key835 = di.get("key835").decode("hex")
    
    systembag = client.getSystemKeyBag()
    kbkeys = systembag["KeyBagKeys"].data
    kb = Keybag.createWithDataSignBlob(kbkeys, key835)
    keybags = di.setdefault("keybags", {})
    kbuuid = kb.uuid.encode("hex")
    print "Keybag UUID :", kbuuid
    if True and keybags.has_key(kbuuid) and keybags[kbuuid].has_key("passcodeKey"):
        print "We've already seen this keybag"
        passcodeKey = keybags[kbuuid].get("passcodeKey").decode("hex")
        print kb.unlockWithPasscodeKey(passcodeKey)
        kb.printClassKeys()
    else:
        keybags[kbuuid] = {"KeyBagKeys": systembag["KeyBagKeys"]}
        di["KeyBagKeys"] = systembag["KeyBagKeys"]
        di.save()
        print "Enter passcode or leave blank for bruteforce:"
        z = raw_input()
        res = client.getPasscodeKey(systembag["KeyBagKeys"].data, z)
        if kb.unlockWithPasscodeKey(res.get("passcodeKey").decode("hex")):
            print "Passcode \"%s\" OK" % z
            di.update(res)
            keybags[kbuuid].update(res)
            di.save()
            keychain_blob = client.downloadFile("/mnt2/Keychains/keychain-2.db")
            write_file("keychain-2.db", keychain_blob)
            print "Downloaded keychain database, use keychain_tool.py to decrypt secrets"
            return
        if z != "":
            print "Wrong passcode, trying to bruteforce !"
        if checkPasscodeComplexity(client) == 0:
            print "Trying all 4-digits passcodes..."
            bf = client.bruteforceKeyBag(systembag["KeyBagKeys"].data)
            if bf:
                di.update(bf)
                keybags[kbuuid].update(bf)
            print bf
            print kb.unlockWithPasscodeKey(bf.get("passcodeKey").decode("hex"))
            kb.printClassKeys()
            di["classKeys"] = kb.getClearClassKeysDict()
            di.save()
        else:
            print "Complex passcode used !"
            return
        
    #keychain_blob =    client.downloadFile("/private/var/Keychains/keychain-2.db")
    keychain_blob = client.downloadFile("/mnt2/Keychains/keychain-2.db")
    write_file("keychain-2.db", keychain_blob)
    print "Downloaded keychain database, use keychain_tool.py to decrypt secrets"
开发者ID:AbhinavBansal,项目名称:iOS-DataProtection-ToolKit,代码行数:62,代码来源:demo_bruteforce.py

示例2: escrow

# 需要导入模块: from keystore.keybag import Keybag [as 别名]
# 或者: from keystore.keybag.Keybag import createWithDataSignBlob [as 别名]
def escrow():
    client = RamdiskToolClient()
    di = client.getDeviceInfos()
    key835 = di.get("key835").decode("hex")
    
    plist = os.environ["ALLUSERSPROFILE"] + "/Apple/Lockdown/%s.plist" % di["udid"]
    lockdown = plistlib.readPlist(plist)    
    kb = Keybag.createWithDataSignBlob(lockdown["EscrowBag"].data, key835)
    
    keybags = di.setdefault("keybags", {})
    kbuuid = kb.uuid.encode("hex")
    if not keybags.has_key(kbuuid):
        print lockdown["HostID"]
        res = client.getEscrowRecord(lockdown["HostID"])
        bagkey = res.get("BagKey")
        print "Bag key" + bagkey.data.encode("hex")
        res = client.getPasscodeKey(lockdown["EscrowBag"].data, bagkey)
        print res
        passcodeKey = res["passcodeKey"].decode("hex")
        keybags[kbuuid] = {"KeyBagKeys": lockdown["EscrowBag"],
                            "passcode": bagkey,
                            "passcodeKey": passcodeKey.encode("hex")}
        pl.update(keybags[kbuuid])
    else:
        passcodeKey = keybags[kbuuid].get("passcodeKey").decode("hex")

    print kb.unlockWithPasscodeKey(passcodeKey)
    kb.printClassKeys()
开发者ID:yzx65,项目名称:AppParser,代码行数:30,代码来源:demo_escrow.py

示例3: bf_system

# 需要导入模块: from keystore.keybag import Keybag [as 别名]
# 或者: from keystore.keybag.Keybag import createWithDataSignBlob [as 别名]
def bf_system():
    curdir = os.path.dirname(os.path.abspath(__file__))
    client = RamdiskToolClient()
    di = client.getDeviceInfos()
    devicedir = di["udid"]
    if os.getcwd().find(devicedir) == -1:
        try:
            os.mkdir(devicedir)
        except:
            pass
        os.chdir(devicedir)
    key835 = di.get("key835").decode("hex")

    systembag = client.getSystemKeyBag()
    kbkeys = systembag["KeyBagKeys"].data
    kb = Keybag.createWithDataSignBlob(kbkeys, key835)
    keybags = di.setdefault("keybags", {})
    kbuuid = kb.uuid.encode("hex")
    print "Keybag UUID :", kbuuid
    if True and keybags.has_key(kbuuid) and keybags[kbuuid].has_key("passcodeKey"):
        print "We've already seen this keybag"
        passcodeKey = keybags[kbuuid].get("passcodeKey").decode("hex")
        print kb.unlockWithPasscodeKey(passcodeKey)
        kb.printClassKeys()
    else:
        keybags[kbuuid] = {"KeyBagKeys": systembag["KeyBagKeys"]}
        di["KeyBagKeys"] = systembag["KeyBagKeys"]
        di.save()
        print "Enter passcode or leave blank for bruteforce:"
        z = raw_input()
        res = client.getPasscodeKey(systembag["KeyBagKeys"].data, z)
        if kb.unlockWithPasscodeKey(res.get("passcodeKey").decode("hex")):
            print 'Passcode "%s" OK' % z
            di.update(res)
            keybags[kbuuid].update(res)
            di.save()
            keychain_blob = client.downloadFile("/mnt2/Keychains/keychain-2.db")
            write_file("keychain-2.db", keychain_blob)
            # to fix the keychain downloading on iOS 7
            keychain_shm = client.downloadFile("/mnt2/Keychains/keychain-2.db-shm")
            write_file("keychain-2.db-shm", keychain_shm)
            keychain_wal = client.downloadFile("/mnt2/Keychains/keychain-2.db-wal")
            write_file("keychain-2.db-wal", keychain_wal)
            print "Downloaded keychain database, use keychain_tool.py to decrypt secrets"
            return
        if z != "":
            print "Wrong passcode, trying to bruteforce !"
        if kb.passcodeComplexity == 0:
            print "Trying all 4-digits passcodes..."
            bf = client.bruteforceKeyBag(systembag["KeyBagKeys"].data)
            if bf:
                di.update(bf)
                keybags[kbuuid].update(bf)
            print bf
            print kb.unlockWithPasscodeKey(bf.get("passcodeKey").decode("hex"))
            kb.printClassKeys()
            di["classKeys"] = kb.getClearClassKeysDict()
            di.save()
        else:
            print "Complex passcode used, trying dictionary attack ..."
            dictfile = os.path.join(curdir, "wordlist.dict")
            try:
                wordlist = open(dictfile, "r").readlines()
            except (OSError, IOError), e:
                exit(e)
            for line in wordlist:
                res = client.getPasscodeKey(systembag["KeyBagKeys"].data, line.rstrip("\n"))
                if kb.unlockWithPasscodeKey(res.get("passcodeKey").decode("hex")):
                    print 'Passcode "%s" OK' % line.rstrip("\n")
                    di.update(res)
                    keybags[kbuuid].update(res)
                    di.save()
                    keychain_blob = client.downloadFile("/mnt2/Keychains/keychain-2.db")
                    write_file("keychain-2.db", keychain_blob)
                    # to fix the keychain downloading on iOS 7
                    keychain_shm = client.downloadFile("/mnt2/Keychains/keychain-2.db-shm")
                    write_file("keychain-2.db-shm", keychain_shm)
                    keychain_wal = client.downloadFile("/mnt2/Keychains/keychain-2.db-wal")
                    write_file("keychain-2.db-wal", keychain_wal)

                    print "Downloaded keychain database, use keychain_tool.py to decrypt secrets"
                    return
            print "Passcode not found!"
            return
开发者ID:pandazheng,项目名称:iphone-dataprotection,代码行数:86,代码来源:demo_bruteforce.py


注:本文中的keystore.keybag.Keybag.createWithDataSignBlob方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。