From 43ff89b1867ba35b485b9ab3a985f81ff4d52361 Mon Sep 17 00:00:00 2001 From: Cameron Lowell Palmer Date: Wed, 7 Feb 2018 14:38:26 +0100 Subject: [PATCH] Fixed the order of frida calls to avoid problems with slow launching apps --- dump.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/dump.py b/dump.py index c2776f8..f64dd96 100755 --- a/dump.py +++ b/dump.py @@ -250,18 +250,17 @@ def open_target_app(device, name_or_bundleid): try: pid = device.spawn([bundle_identifier]) + session = device.attach(pid) device.resume(pid) - time.sleep(1) except Exception as e: print e - return pid, display_name, bundle_identifier + return session, display_name, bundle_identifier -def start_dump(device, pid, ipa_name): +def start_dump(session, ipa_name): print 'Dumping {} to {}'.format(display_name, TEMP_DIR) - session = device.attach(pid) script = load_js_file(session, DUMP_JS) script.post('dump') finished.wait() @@ -295,11 +294,11 @@ if __name__ == '__main__': ssh.connect(Host, port=Port, username=User, password=Password) create_dir(PAYLOAD_PATH) - (pid, display_name, bundle_identifier) = open_target_app(device, name_or_bundleid) + (session, display_name, bundle_identifier) = open_target_app(device, name_or_bundleid) if output_ipa is None: output_ipa = display_name output_ipa = re.sub('\.ipa$', '', output_ipa) - start_dump(device, pid, output_ipa) + start_dump(session, output_ipa) except paramiko.ssh_exception.NoValidConnectionsError as e: print e exit_code = 1