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


Python Keybag.createWithPlist方法代码示例

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


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

示例1: __init__

# 需要导入模块: from keystore.keybag import Keybag [as 别名]
# 或者: from keystore.keybag.Keybag import createWithPlist [as 别名]
    def __init__(self, bdev, device_infos, **kwargs):
        super(EMFVolume,self).__init__(bdev, **kwargs)
        volumeid = self.volumeID().encode("hex")

        if not device_infos:
            dirname = os.path.dirname(bdev.filename)
            device_infos = search_plist(dirname, {"dataVolumeUUID":volumeid})
            if not device_infos:
                raise Exception("Missing keyfile")
        try:
            self.emfkey = None
            if device_infos.has_key("EMF"):
                self.emfkey = device_infos["EMF"].decode("hex")
            self.lbaoffset = device_infos["dataVolumeOffset"]
            self.keybag = Keybag.createWithPlist(device_infos)
        except:
            raise #Exception("Invalid keyfile")
        
        self.decrypted = (self.header.finderInfo[3] == FLAG_DECRYPTED) 
        rootxattr =  self.getXattr(kHFSRootParentID, "com.apple.system.cprotect")
        self.cp_major_version = None
        self.cp_root = None
        if rootxattr == None:
            print "(No root com.apple.system.cprotect xattr)"
        else:
            self.cp_root = cp_root_xattr.parse(rootxattr)
            ver = self.cp_root.major_version
            print "cprotect version : %d" % ver
            assert self.cp_root.major_version == 2 or self.cp_root.major_version == 4
            self.cp_major_version = self.cp_root.major_version
        self.keybag = loadKeybagFromVolume(self, device_infos)
开发者ID:0bj3ct1veC,项目名称:iphone-dataprotection,代码行数:33,代码来源:emf.py

示例2: main

# 需要导入模块: from keystore.keybag import Keybag [as 别名]
# 或者: from keystore.keybag.Keybag import createWithPlist [as 别名]
def main():
    parser = OptionParser(usage="%prog keychain.db keyfile.plist")
    parser.add_option("-d", "--display", dest="display", action="store_true", default=False,
                  help="Show keychain items on stdout")
    parser.add_option("-s", "--sanitize", dest="sanitize", action="store_true", default=False,
                  help="Hide secrets on stdout with ***")
    parser.add_option("-p", "--passwords", dest="passwords", action="store_true", default=False,
                  help="Save generic & internet passwords as CSV file")
    parser.add_option("-c", "--certs", dest="certs", action="store_true", default=False,
                  help="Extract certificates and keys")
    parser.add_option("-o", "--old", dest="oldpass", action="store_true", default=False,
                  help="Bruteforce old passcodes")
    
    (options, args) = parser.parse_args()
    if len(args) < 2:
        parser.print_help()
        return
    
    p = plistlib.readPlist(args[1])
    kb = Keybag.createWithPlist(p)
    k = keychain_load(args[0], kb, p["key835"].decode("hex"))
    
    if options.display:
        k.print_all(options.sanitize)
    if options.passwords:
        k.save_passwords()
    if options.certs:
        k.save_certs_keys()

    if options.oldpass:
        mc = k.get_managed_configuration()
        if not mc:
            print "Managed configuration not found"
            return
        print "Bruteforcing %d old passcodes" % len(mc.get("history",[]))
        for h in mc["history"]:
            p = bruteforce_old_pass(h)
            if p:
                print "Found : %s" % p
            else:
                print "Not Found"
开发者ID:WilhelmTell1337,项目名称:wilhelmtell-iosplayground,代码行数:43,代码来源:keychain_tool.py

示例3: __init__

# 需要导入模块: from keystore.keybag import Keybag [as 别名]
# 或者: from keystore.keybag.Keybag import createWithPlist [as 别名]
 def __init__(self, file, **kwargs):
     super(EMFVolume,self).__init__(file, **kwargs)
     pl = "%s.plist" % self.volumeID().encode("hex")
     dirname = os.path.dirname(file)
     if dirname != "":
         pl = dirname + "/" + pl
     if not os.path.exists(pl):
         raise Exception("Missing keyfile %s" % pl)
     try:
         pldict = plistlib.readPlist(pl)
         self.emfkey = pldict["EMF"].decode("hex")
         self.lbaoffset = pldict["dataVolumeOffset"]
         self.keystore = Keybag.createWithPlist(pldict)
     except:
         raise #Exception("Invalid keyfile")
     
     rootxattr =  self.getXattr(kHFSRootParentID, "com.apple.system.cprotect")
     if rootxattr == None:
         print "Not an EMF image, no root com.apple.system.cprotec xattr"
     else:
         self.cp_root = cp_root_xattr.parse(rootxattr)
         print "cprotect version :", self.cp_root.major_version
         assert self.cp_root.major_version == 2 or self.cp_root.major_version == 4
开发者ID:WilhelmTell1337,项目名称:wilhelmtell-iosplayground,代码行数:25,代码来源:emf.py

示例4: main

# 需要导入模块: from keystore.keybag import Keybag [as 别名]
# 或者: from keystore.keybag.Keybag import createWithPlist [as 别名]
def main():
    parser = OptionParser(usage="%prog keychain.db/keychain-backup.plist keyfile.plist/Manifest.plist")
    parser.add_option("-d", "--display", dest="display", action="store_true", default=False,
                  help="Show keychain items on stdout")
    parser.add_option("-s", "--sanitize", dest="sanitize", action="store_true", default=False,
                  help="Hide secrets on stdout with ***")
    parser.add_option("-p", "--passwords", dest="passwords", action="store_true", default=False,
                  help="Save generic & internet passwords as CSV file")
    parser.add_option("-c", "--certs", dest="certs", action="store_true", default=False,
                  help="Extract certificates and keys")
    parser.add_option("-o", "--old", dest="oldpass", action="store_true", default=False,
                  help="Bruteforce old passcodes")
    
    (options, args) = parser.parse_args()
    if len(args) < 2:
        parser.print_help()
        return
    
    p = readPlist(args[1])
    
    if p.has_key("BackupKeyBag"):
        deviceKey = None
        if p.has_key("key835"):
            deviceKey = p["key835"].decode("hex")
        else:
            if not p["IsEncrypted"]:
                print "This backup is not encrypted, without key 835 nothing in the keychain can be decrypted"
            print "If you have key835 for device %s enter it (in hex)" % p["Lockdown"]["UniqueDeviceID"]
            d = raw_input()
            if len(d) == 32:
                p["key835"] = d
                deviceKey = d.decode("hex")
                plistlib.writePlist(p, args[1])
        
        kb = Keybag.createWithBackupManifest(p, p.get("password",""), deviceKey)
        if not kb:
            return
        k = Keychain4(args[0], kb)
    else:
        kb = Keybag.createWithPlist(p)
        k = keychain_load(args[0], kb, p["key835"].decode("hex"))
    
    if options.display:
        k.print_all(options.sanitize)
    if options.passwords:
        k.save_passwords()
    if options.certs:
        k.save_certs_keys()

    if options.oldpass:
        mc = k.get_managed_configuration()
        if not mc:
            print "Managed configuration not found"
            return
        print "Bruteforcing %d old passcodes" % len(mc.get("history",[]))
        for h in mc["history"]:
            p = bruteforce_old_pass(h)
            if p:
                print "Found : %s" % p
            else:
                print "Not Found"
开发者ID:AbhinavBansal,项目名称:iOS-DataProtection-ToolKit,代码行数:63,代码来源:keychain_tool.py


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