Windows-compatible version.
Requires 7z to be present in PATH
This commit is contained in:
parent
56e99b2138
commit
9a3ce60629
25
dump.py
25
dump.py
|
@ -11,7 +11,6 @@ import codecs
|
||||||
import frida
|
import frida
|
||||||
import threading
|
import threading
|
||||||
import os
|
import os
|
||||||
import shutil
|
|
||||||
import time
|
import time
|
||||||
import argparse
|
import argparse
|
||||||
import tempfile
|
import tempfile
|
||||||
|
@ -78,19 +77,22 @@ def generate_ipa(path, display_name):
|
||||||
print('Generating "{}"'.format(ipa_filename))
|
print('Generating "{}"'.format(ipa_filename))
|
||||||
try:
|
try:
|
||||||
app_name = file_dict['app']
|
app_name = file_dict['app']
|
||||||
|
|
||||||
for key, value in file_dict.items():
|
for key, value in file_dict.items():
|
||||||
from_dir = os.path.join(path, key)
|
from_dir = os.path.join(path, key)
|
||||||
to_dir = os.path.join(path, app_name, value)
|
to_dir = os.path.join(path, app_name, value)
|
||||||
if key != 'app':
|
if key != 'app':
|
||||||
shutil.move(from_dir, to_dir)
|
try:
|
||||||
|
os.rename(from_dir, to_dir)
|
||||||
|
except FileExistsError:
|
||||||
|
os.remove(to_dir)
|
||||||
|
os.rename(from_dir, to_dir)
|
||||||
target_dir = './' + PAYLOAD_DIR
|
target_dir = './' + PAYLOAD_DIR
|
||||||
zip_args = ('zip', '-qr', os.path.join(os.getcwd(), ipa_filename), target_dir)
|
zip_args = ("7z", "a", "-r", f"{os.getcwd()}/{ipa_filename}.zip", "-w", f"{target_dir}", "-mem=AES256")
|
||||||
subprocess.check_call(zip_args, cwd=TEMP_DIR)
|
subprocess.check_call(zip_args, cwd=TEMP_DIR)
|
||||||
shutil.rmtree(PAYLOAD_PATH)
|
os.rename(f"{os.getcwd()}/{ipa_filename}.zip", f"{os.getcwd()}/{ipa_filename}")
|
||||||
|
os.system('rmdir /S /Q "{}"'.format(PAYLOAD_PATH))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(f"{type(e)}: {e}")
|
||||||
finished.set()
|
finished.set()
|
||||||
|
|
||||||
def on_message(message, data):
|
def on_message(message, data):
|
||||||
|
@ -121,10 +123,12 @@ def on_message(message, data):
|
||||||
|
|
||||||
chmod_dir = os.path.join(PAYLOAD_PATH, os.path.basename(dump_path))
|
chmod_dir = os.path.join(PAYLOAD_PATH, os.path.basename(dump_path))
|
||||||
chmod_args = ('chmod', '655', chmod_dir)
|
chmod_args = ('chmod', '655', chmod_dir)
|
||||||
|
"""
|
||||||
try:
|
try:
|
||||||
subprocess.check_call(chmod_args)
|
subprocess.check_call(chmod_args)
|
||||||
except subprocess.CalledProcessError as err:
|
except subprocess.CalledProcessError as err:
|
||||||
print(err)
|
print(err)
|
||||||
|
"""
|
||||||
|
|
||||||
index = origin_path.find('.app/')
|
index = origin_path.find('.app/')
|
||||||
file_dict[os.path.basename(dump_path)] = origin_path[index + 5:]
|
file_dict[os.path.basename(dump_path)] = origin_path[index + 5:]
|
||||||
|
@ -139,11 +143,12 @@ def on_message(message, data):
|
||||||
|
|
||||||
chmod_dir = os.path.join(PAYLOAD_PATH, os.path.basename(app_path))
|
chmod_dir = os.path.join(PAYLOAD_PATH, os.path.basename(app_path))
|
||||||
chmod_args = ('chmod', '755', chmod_dir)
|
chmod_args = ('chmod', '755', chmod_dir)
|
||||||
|
"""
|
||||||
try:
|
try:
|
||||||
subprocess.check_call(chmod_args)
|
subprocess.check_call(chmod_args)
|
||||||
except subprocess.CalledProcessError as err:
|
except subprocess.CalledProcessError as err:
|
||||||
print(err)
|
print(err)
|
||||||
|
"""
|
||||||
file_dict['app'] = os.path.basename(app_path)
|
file_dict['app'] = os.path.basename(app_path)
|
||||||
|
|
||||||
if 'done' in payload:
|
if 'done' in payload:
|
||||||
|
@ -243,7 +248,7 @@ def create_dir(path):
|
||||||
path = path.strip()
|
path = path.strip()
|
||||||
path = path.rstrip('\\')
|
path = path.rstrip('\\')
|
||||||
if os.path.exists(path):
|
if os.path.exists(path):
|
||||||
shutil.rmtree(path)
|
os.system('rmdir /S /Q "{}"'.format(path))
|
||||||
try:
|
try:
|
||||||
os.makedirs(path)
|
os.makedirs(path)
|
||||||
except os.error as err:
|
except os.error as err:
|
||||||
|
@ -357,6 +362,6 @@ if __name__ == '__main__':
|
||||||
ssh.close()
|
ssh.close()
|
||||||
|
|
||||||
if os.path.exists(PAYLOAD_PATH):
|
if os.path.exists(PAYLOAD_PATH):
|
||||||
shutil.rmtree(PAYLOAD_PATH)
|
os.system('rmdir /S /Q "{}"'.format(PAYLOAD_PATH))
|
||||||
|
|
||||||
sys.exit(exit_code)
|
sys.exit(exit_code)
|
||||||
|
|
Loading…
Reference in New Issue