def dump_binary():
    try:
        target_doc_path = data.metadata['data_directory'] + '/Documents'
        target_doc_file = target_doc_path + '/dumpdecrypted.dylib'
        Utils.sftp_put(ip=config.mobile_ip,
                       port=config.ssh_port,
                       username=config.mobile_user,
                       password=config.mobile_password,
                       remote_path=target_doc_file,
                       local_file='./tools/dumpdecrypted.dylib')

        target_bin_path = data.metadata['binary_path']
        dump_cmd = 'DYLD_INSERT_LIBRARIES={} {}'.format(
            target_doc_file, target_bin_path)
        Utils.cmd_block(data.client, dump_cmd)
        # get decrypted file from iphone
        remote_file = './{}.decrypted'.format(data.metadata['binary_name'])
        data.static_file_path = bin_get.via_sftp(remote_file)

        return True
    except Exception:
        return False
def install_ipa_from_local(ipa_path):
    if ipa_path:  # 从平台下发的任务,经由这个方法,ipa_path有值
        ipa = zipfile.ZipFile(ipa_path)
        pat = re.compile("Payload[/\\\][\w.]+[/\\\]Info.plist")
        for name in ipa.namelist():
            if pat.search(name):
                plist_path = name
                break
                # plist_path = ipa.extract(name)
                # plist = plistlib.readPlist(plist_path)
                # data.app_bundleID = plistlib.readPlist(plist_path)["CFBundleIdentifier"]
                # print data.app_bundleID

    else:  # 从单机版入口,ipa_path为空,需要实时要求用户输入
        while True:
            ipa_path = raw_input(clint.textui.colored.yellow("> >> >>> Input the Path: > ")).strip()
            if not os.path.exists(ipa_path):
                Utils.printy_result('No such file ', 0)
            elif not ipa_path.endswith("ipa"):
                Utils.printy_result('Not ipa file ', 0)
            else:
                break

    # sftp to iPhone
    Utils.sftp_put(config.mobile_ip, config.ssh_port, config.mobile_user, config.mobile_password,
                   '/tmp/detect/temp.ipa', ipa_path)
    if ipa_path:
        ipa = zipfile.ZipFile(ipa_path)
        pat = re.compile("Payload[/\\\][\w.]+[/\\\]Info.plist")
        for name in ipa.namelist():
            if pat.search(name):
                break
        plist_path = ipa.extract(name)
        tmp = plist_path + '.tmp'
        data.app_bundleID = commands.getstatusoutput(
            'plutil -extract CFBundleIdentifier xml1 {} -o {}; plutil -p {}'.
            format(plist_path, tmp, tmp))[1].strip('"')
        Utils.cmd_block(data.client, 'ipainstaller {}'.format('/tmp/detect/temp.ipa'))
        return True
示例#3
0
 def send_tool(self):
     Utils.sftp_put(ip=config.mobile_ip, port=config.ssh_port,
                    username=config.mobile_user, password=config.mobile_password,
                    local_file="./tools/keychain_dumper", remote_path='./keychain_dumper')