5 Commits
v1.3 ... v1.4.1

Author SHA1 Message Date
zx
403e5d65a5 chore: bump version to v1.4.1 2024-11-07 22:32:58 -05:00
zx
354a1d9ac5 fix: not auto-injecting already fixed dependency names
whoops
2024-11-07 22:31:43 -05:00
zx
73d1495eff chore: bump version to v1.4 (stable) 2024-11-02 10:43:45 -04:00
zx
31169d6c65 refactor: move orion check out of loop 2024-11-02 10:42:47 -04:00
zx
0808fd8c1b feat: manually modified dylib support (#6) 2024-10-31 14:35:22 -04:00
4 changed files with 53 additions and 21 deletions

View File

@@ -99,7 +99,7 @@ def main() -> None:
)
parser.add_argument(
"--version", action="version", version="cyan v1.3"
"--version", action="version", version="cyan v1.4.1"
)
from cyan import logic

View File

@@ -14,16 +14,31 @@ class Executable:
idylib = f"{specific}/insert_dylib"
starters = ("\t/Library/", "\t@rpath", "\t@executable_path")
common = {
# substrate could show up as
# CydiaSubstrate.framework, libsubstrate.dylib, EVEN CydiaSubstrate.dylib
# AND PROBABLY EVEN MORE !!!! IT'S CRAZY.
"CydiaSubstrate.framework": "CydiaSubstrate.framework",
"Orion.framework": "Orion.framework",
"Cephei.framework": "Cephei.framework",
"CepheiUI.framework": "CepheiUI.framework",
"CepheiPrefs.framework": "CepheiPrefs.framework"
# substrate could show up as
# CydiaSubstrate.framework, libsubstrate.dylib, EVEN CydiaSubstrate.dylib
# AND PROBABLY EVEN MORE !!!! IT'S CRAZY.
common = {
"substrate.": {
"name": "CydiaSubstrate.framework",
"path": "@rpath/CydiaSubstrate.framework/CydiaSubstrate"
},
"orion.": {
"name": "Orion.framework",
"path": "@rpath/Orion.framework/Orion"
},
"cephei.": {
"name": "Cephei.framework",
"path": "@rpath/Cephei.framework/Cephei"
},
"cepheiui.": {
"name": "CepheiUI.framework",
"path": "@rpath/CepheiUI.framework/CepheiUI"
},
"cepheiprefs.": {
"name": "CepheiPrefs.framework",
"path": "@rpath/CepheiPrefs.framework/CepheiPrefs"
}
}
def __init__(self, path: str):
@@ -64,14 +79,29 @@ class Executable:
stderr=subprocess.DEVNULL
)
def fix_dependencies(self, tweaks: dict[str, str], need: set[str]) -> None:
def fix_common_dependencies(self, needed: set[str]) -> None:
self.remove_signature()
for dep in self.get_dependencies():
for cname in (tweaks | self.common):
for common, info in self.common.items():
if common in dep.lower():
needed.add(common)
if dep != info["path"]:
self.change_dependency(dep, info["path"])
print(
f"[*] fixed common dependency in {self.bn}: "
f"{dep} -> {info['path']}"
)
def fix_dependencies(self, tweaks: dict[str, str]) -> None:
for dep in self.get_dependencies():
for cname in tweaks:
if cname in dep:
# i wonder if there's a better way to do this?
if cname.endswith(".framework"):
# nah, not gonna parse the plist,
# i've never seen a framework with a "mismatched" name
npath = f"@rpath/{cname}/{cname[:-10]}"
else:
npath = f"@rpath/{cname}"
@@ -80,9 +110,6 @@ class Executable:
self.change_dependency(dep, npath)
print(f"[*] fixed dependency in {self.bn}: {dep} -> {npath}")
if cname in self.common:
need.add(cname)
def get_dependencies(self) -> list[str]:
proc = subprocess.run(
[self.otool, "-L", self.path],

View File

@@ -5,7 +5,7 @@ import subprocess
from typing import Optional
try:
import lief
import lief # type: ignore
except Exception:
pass
@@ -58,6 +58,8 @@ class MainExecutable(Executable):
os.chdir(cwd) # i fucking hate jailbroken iOS utils.
needed: set[str] = set()
# inject/fix user things
for bn, path in tweaks.items():
if bn.endswith(".appex"):
fpath = f"{PLUGINS_DIR}/{bn}"
@@ -65,7 +67,10 @@ class MainExecutable(Executable):
shutil.copytree(path, fpath)
elif bn.endswith(".dylib"):
path = shutil.copy2(path, tmpdir)
Executable(path).fix_dependencies(tweaks, needed)
e = Executable(path)
e.fix_common_dependencies(needed)
e.fix_dependencies(tweaks)
fpath = f"{FRAMEWORKS_DIR}/{bn}"
existed = tbhutils.delete_if_exists(fpath, bn)
@@ -89,11 +94,11 @@ class MainExecutable(Executable):
# orion has a *weak* dependency to substrate,
# but will still crash without it. nice !!!!!!!!!!!
if "Orion.framework" in needed:
needed.add("CydiaSubstrate.framework")
if "orion." in needed:
needed.add("substrate.")
for missing in needed:
real = self.common[missing] # "real" name, thanks substrate!
real = self.common[missing]["name"] # e.g. "Orion.framework"
ip = f"{FRAMEWORKS_DIR}/{real}"
existed = tbhutils.delete_if_exists(ip, real)
shutil.copytree(f"{self.install_dir}/extras/{real}", ip)

View File

@@ -4,7 +4,7 @@ from setuptools import setup
setup(
name="cyan",
version="1.3",
version="1.4.1",
description="finally, pyzule doesn't suck",
author="zx",
author_email="zx@hrzn.email",