mirror of
https://github.com/NohamR/pyzule-rw.git
synced 2026-10-10 18:39:41 +00:00
39 lines
1.1 KiB
Python
39 lines
1.1 KiB
Python
import os
|
|
import sys
|
|
from argparse import ArgumentParser
|
|
from tempfile import TemporaryDirectory
|
|
|
|
import tbhutils
|
|
import tbhtypes
|
|
|
|
|
|
def main(parser: ArgumentParser) -> None:
|
|
args = parser.parse_args()
|
|
args.i = os.path.normpath(args.input)
|
|
|
|
if args.output is not None:
|
|
args.o = os.path.normpath(args.output)
|
|
if not (args.o.endswith(".app") or args.o.endswith(".ipa")):
|
|
print("[?] output's file extension not specified; will create ipa")
|
|
args.o += ".ipa"
|
|
else:
|
|
args.o = args.i
|
|
|
|
arg_err = tbhutils.validate_inputs(args)
|
|
if arg_err is not None:
|
|
parser.error(arg_err)
|
|
|
|
INPUT_IS_IPA = True if args.i.endswith(".ipa") else False
|
|
# OUTPUT_IS_IPA = True if args.o.endswith(".ipa") else False
|
|
|
|
with TemporaryDirectory() as tmpdir:
|
|
app_path, plist_path = tbhutils.get_app(args.i, tmpdir, INPUT_IS_IPA)
|
|
app = tbhtypes.AppBundle(app_path, plist_path)
|
|
|
|
if app.executable.is_encrypted():
|
|
if args.ignore_encrypted:
|
|
print("[?] main binary is encrypted, ignoring")
|
|
else:
|
|
sys.exit("[!] main binary is encrypted; exiting")
|
|
|