mirror of
https://github.com/NohamR/pyzule-rw.git
synced 2026-10-11 02:49:40 +00:00
refactor: use python zipfile
this might cause some issues with some specific apps bc of that stupid 1980 error thingy, but idc
This commit is contained in:
@@ -10,6 +10,8 @@ this is pretty much just a hobby project that i'll work on when i'm bored. pyzul
|
|||||||
|
|
||||||
cyan is pretty much "v1.0" now i guess. injection works and is stable, and iOS (should..) have all the right fixes for running cyan, however a bug in python3.9 from procursus prevents it from running.
|
cyan is pretty much "v1.0" now i guess. injection works and is stable, and iOS (should..) have all the right fixes for running cyan, however a bug in python3.9 from procursus prevents it from running.
|
||||||
|
|
||||||
|
so to reaffirm this, **iOS is currently not supported until an updated python for iOS gets released**
|
||||||
|
|
||||||
to install on linux + macos, make sure you have python 3.9 or later, `bash`, `zip`, and `lief`
|
to install on linux + macos, make sure you have python 3.9 or later, `bash`, `zip`, and `lief`
|
||||||
|
|
||||||
to install lief: `pip install lief`
|
to install lief: `pip install lief`
|
||||||
|
|||||||
@@ -27,11 +27,20 @@ def main() -> None:
|
|||||||
help="a tweak to inject/item to be added to the bundle"
|
help="a tweak to inject/item to be added to the bundle"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
"-c", "--compress", metavar="level", type=int, default=6,
|
||||||
|
help="the compression level of the ipa (0-9, defaults to 6)",
|
||||||
|
action="store", choices=range(0, 10)
|
||||||
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--ignore-encrypted", action="store_true",
|
"--ignore-encrypted", action="store_true",
|
||||||
help="skip main binary encryption check"
|
help="skip main binary encryption check"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
"-v", "--version", action="version", version="cyan v1.0b"
|
||||||
|
)
|
||||||
|
|
||||||
from cyan import logic
|
from cyan import logic
|
||||||
logic.main(parser)
|
logic.main(parser)
|
||||||
|
|
||||||
|
|||||||
@@ -42,24 +42,16 @@ def main(parser: ArgumentParser) -> None:
|
|||||||
if args.f is not None:
|
if args.f is not None:
|
||||||
app.executable.inject(args.f, tmpdir)
|
app.executable.inject(args.f, tmpdir)
|
||||||
|
|
||||||
# done!
|
# create subdirectories if necessary
|
||||||
if OUTPUT_IS_IPA:
|
if "/" in args.o:
|
||||||
print("[*] generating ipa..")
|
|
||||||
|
|
||||||
run(
|
|
||||||
["bash", f"{tbhtypes.Executable.install_dir}/tools/compressIPA.sh"],
|
|
||||||
env={
|
|
||||||
"TMPDIR": tmpdir,
|
|
||||||
"OUTPUT": args.o
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
print(f"[*] generated ipa at {args.o}")
|
|
||||||
else:
|
|
||||||
# create subdirectories if necessary
|
|
||||||
if "/" in args.o:
|
|
||||||
os.makedirs(os.path.dirname(args.o), exist_ok=True)
|
os.makedirs(os.path.dirname(args.o), exist_ok=True)
|
||||||
|
|
||||||
|
# done !
|
||||||
|
if OUTPUT_IS_IPA:
|
||||||
|
print("[*] generating ipa..")
|
||||||
|
tbhutils.make_ipa(tmpdir, args.o, args.compress)
|
||||||
|
print(f"[*] generated ipa at {args.o}")
|
||||||
|
else:
|
||||||
if os.path.isdir(args.o):
|
if os.path.isdir(args.o):
|
||||||
shutil.rmtree(args.o)
|
shutil.rmtree(args.o)
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import zipfile
|
|||||||
import platform
|
import platform
|
||||||
import plistlib
|
import plistlib
|
||||||
import subprocess
|
import subprocess
|
||||||
from glob import glob
|
from glob import glob, iglob
|
||||||
from argparse import Namespace
|
from argparse import Namespace
|
||||||
from importlib import resources # type: ignore
|
from importlib import resources # type: ignore
|
||||||
from typing import Optional, Any
|
from typing import Optional, Any
|
||||||
@@ -150,3 +150,14 @@ def extract_deb(deb: str, tweaks: dict[str, str], tmpdir: str) -> None:
|
|||||||
print(f"[*] extracted {os.path.basename(deb)}")
|
print(f"[*] extracted {os.path.basename(deb)}")
|
||||||
del tweaks[os.path.basename(deb)]
|
del tweaks[os.path.basename(deb)]
|
||||||
|
|
||||||
|
|
||||||
|
def make_ipa(tmpdir: str, output: str, level: int) -> None:
|
||||||
|
# ensure names are written as Payload/...
|
||||||
|
os.chdir(tmpdir)
|
||||||
|
|
||||||
|
with zipfile.ZipFile(
|
||||||
|
output, "w", zipfile.ZIP_DEFLATED, compresslevel=level
|
||||||
|
) as zf:
|
||||||
|
for f in iglob("Payload/**", recursive=True):
|
||||||
|
zf.write(f)
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
cd $TMPDIR
|
|
||||||
mkdir -p `dirname $OUTPUT`
|
|
||||||
rm $OUTPUT &> /dev/null
|
|
||||||
zip -r $OUTPUT Payload > /dev/null
|
|
||||||
|
|
||||||
4
setup.py
4
setup.py
@@ -7,8 +7,8 @@ setup(
|
|||||||
author="zx",
|
author="zx",
|
||||||
author_email="hi@zxcvbn.fyi",
|
author_email="hi@zxcvbn.fyi",
|
||||||
packages=["cyan", "cyan.tbhtypes"],
|
packages=["cyan", "cyan.tbhtypes"],
|
||||||
# install_requires=["lief"],
|
install_requires=["lief"],
|
||||||
python_requires=">=3.9",
|
python_requires=">=3.10",
|
||||||
include_package_data=True,
|
include_package_data=True,
|
||||||
entry_points={
|
entry_points={
|
||||||
"console_scripts": ["cyan=cyan.__main__:main"],
|
"console_scripts": ["cyan=cyan.__main__:main"],
|
||||||
|
|||||||
Reference in New Issue
Block a user