mirror of
https://github.com/NohamR/pyzule-rw.git
synced 2026-10-11 10:15:35 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
06a2ea8dad | ||
|
|
55b2ec9d07 | ||
|
|
52b3b11a1a | ||
|
|
4375b7f880 |
32
README.md
32
README.md
@@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
a rewrite of [pyzule](https://github.com/asdfzxcvbn/pyzule) that doesn't (completely) suck !!
|
a rewrite of [pyzule](https://github.com/asdfzxcvbn/pyzule) that doesn't (completely) suck !!
|
||||||
|
|
||||||
cyan supports **linux, macOS, WSL, and jailbroken iOS!** all either x86_64 or arm64/aarch64 !!
|
|
||||||
|
|
||||||
## features
|
## features
|
||||||
|
|
||||||
you can open an issue to request a feature :D !!
|
you can open an issue to request a feature :D !!
|
||||||
@@ -22,17 +20,33 @@ you can open an issue to request a feature :D !!
|
|||||||
|
|
||||||
## install instructions
|
## install instructions
|
||||||
|
|
||||||
|
cyan supports **linux, macOS, WSL, and jailbroken iOS!** all either x86_64 or arm64/aarch64 !!
|
||||||
|
|
||||||
first, make sure you have [ar](https://command-not-found.com/ar) and [tar](https://command-not-found.com/tar) installed
|
first, make sure you have [ar](https://command-not-found.com/ar) and [tar](https://command-not-found.com/tar) installed
|
||||||
|
|
||||||
also obviously install python, version 3.9 or greater is required (the version available on the procursus repo for iOS)
|
also obviously install python, version 3.9 or greater is required
|
||||||
|
|
||||||
1. install [pipx](https://github.com/pypa/pipx?tab=readme-ov-file#install-pipx)
|
<details>
|
||||||
2. install cyan: `pipx install --force https://github.com/asdfzxcvbn/pyzule-rw/archive/main.zip`
|
<summary><b>linux/WSL/macOS instructions</b></summary>
|
||||||
3. follow any instructions `pipx` may have given you, like `pipx ensurepath`
|
<br/>
|
||||||
4. **if you want to inject dylibs and ARE NOT ON iOS**: `pipx inject cyan lief`
|
<ol>
|
||||||
5. **if you want to change app icons (iOS NOT supported)**: `pipx inject cyan Pillow`
|
<li>install <a href="https://github.com/pypa/pipx?tab=readme-ov-file#install-pipx">pipx</a></li>
|
||||||
|
<li>install OR update cyan: <code>pipx install --force https://github.com/asdfzxcvbn/pyzule-rw/archive/main.zip</code></li>
|
||||||
|
<li>add cyan to PATH: <code>pipx ensurepath</code></li>
|
||||||
|
<li><b>if you want to inject dylibs ON AARCH64 LINUX</b>: <code>pipx inject cyan lief</code></li>
|
||||||
|
<li><b>if you want to change app icons (iOS NOT supported)</b>: <code>pipx inject cyan Pillow</code></li>
|
||||||
|
</ol>
|
||||||
|
</details>
|
||||||
|
|
||||||
to *update*, just run step 2 again !
|
<details>
|
||||||
|
<summary><b>jailbroken iOS instructions</b></summary>
|
||||||
|
<br/>
|
||||||
|
<ol>
|
||||||
|
<li>install OR update cyan: <code>pip install --force-reinstall https://github.com/asdfzxcvbn/pyzule-rw/archive/main.zip</code></li>
|
||||||
|
</ol>
|
||||||
|
</details>
|
||||||
|
|
||||||
|
note: if you installed cyan before v1.1.3 using `pip`, make sure you `pip uninstall cyan`, then verify you have the latest version with `cyan --version`
|
||||||
|
|
||||||
## making cyan files
|
## making cyan files
|
||||||
|
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ def main() -> None:
|
|||||||
)
|
)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--version", action="version", version="cyan v1.1.3"
|
"--version", action="version", version="cyan v1.1.4"
|
||||||
)
|
)
|
||||||
|
|
||||||
from cyan import logic
|
from cyan import logic
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ class Executable:
|
|||||||
ldid = f"{specific}/ldid"
|
ldid = f"{specific}/ldid"
|
||||||
lipo = f"{specific}/lipo"
|
lipo = f"{specific}/lipo"
|
||||||
otool = f"{specific}/otool"
|
otool = f"{specific}/otool"
|
||||||
|
idylib = f"{specific}/insert_dylib"
|
||||||
|
|
||||||
starters = ("\t/Library/", "\t@rpath", "\t@executable_path")
|
starters = ("\t/Library/", "\t@rpath", "\t@executable_path")
|
||||||
common = {
|
common = {
|
||||||
@@ -42,10 +43,10 @@ class Executable:
|
|||||||
self.bn = os.path.basename(path)
|
self.bn = os.path.basename(path)
|
||||||
self.inj: Optional = None # type: ignore
|
self.inj: Optional = None # type: ignore
|
||||||
|
|
||||||
if self.specific.endswith("iOS"):
|
if os.path.isfile(self.idylib):
|
||||||
self.inj_func = self.ios_inject
|
self.inj_func = self.idyl_inject
|
||||||
else:
|
else:
|
||||||
self.inj_func = self.insert_cmd
|
self.inj_func = self.lief_inj
|
||||||
|
|
||||||
def is_encrypted(self) -> bool:
|
def is_encrypted(self) -> bool:
|
||||||
proc = subprocess.run(
|
proc = subprocess.run(
|
||||||
@@ -177,7 +178,7 @@ class Executable:
|
|||||||
stderr=subprocess.DEVNULL
|
stderr=subprocess.DEVNULL
|
||||||
)
|
)
|
||||||
|
|
||||||
def insert_cmd(self, cmd: str) -> None:
|
def lief_inj(self, cmd: str) -> None:
|
||||||
if self.inj is None: # type: ignore
|
if self.inj is None: # type: ignore
|
||||||
try:
|
try:
|
||||||
lief.logging.disable() # type: ignore
|
lief.logging.disable() # type: ignore
|
||||||
@@ -186,17 +187,22 @@ class Executable:
|
|||||||
|
|
||||||
self.inj = lief.parse(self.path) # type: ignore
|
self.inj = lief.parse(self.path) # type: ignore
|
||||||
|
|
||||||
self.inj.add(lief.MachO.DylibCommand.weak_lib(cmd)) # type: ignore
|
try:
|
||||||
|
self.inj.add(lief.MachO.DylibCommand.weak_lib(cmd)) # type: ignore
|
||||||
|
except AttributeError:
|
||||||
|
sys.exit("[!] couldn't add LC (lief), did you use a valid app?")
|
||||||
|
|
||||||
def ios_inject(self, cmd: str) -> None:
|
def idyl_inject(self, cmd: str) -> None:
|
||||||
subprocess.run(
|
proc = subprocess.run(
|
||||||
[
|
[
|
||||||
f"{self.specific}/insert_dylib",
|
self.idylib, "--weak", "--inplace", "--strip-codesig", "--all-yes",
|
||||||
"--weak", "--inplace", "--no-strip-codesig", "--all-yes",
|
|
||||||
cmd, self.path
|
cmd, self.path
|
||||||
], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL
|
], capture_output=True, text=True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if proc.returncode != 0:
|
||||||
|
sys.exit(f"[!] couldn't add LC (insert_dylib), error:\n{proc.stderr}")
|
||||||
|
|
||||||
def fix_dependencies(self, tweaks: dict[str, str], need: set[str]) -> None:
|
def fix_dependencies(self, tweaks: dict[str, str], need: set[str]) -> None:
|
||||||
self.remove_signature()
|
self.remove_signature()
|
||||||
|
|
||||||
|
|||||||
@@ -39,15 +39,19 @@ def validate_inputs(args: Namespace) -> Optional[str]:
|
|||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
if args.f is not None:
|
if args.f is not None:
|
||||||
# dictionary ensures unique names
|
new: dict[str, str] = {} # dictionary ensures unique names
|
||||||
args.f = {os.path.basename(f): os.path.realpath(f) for f in args.f}
|
|
||||||
nonexistent = [f for f in args.f.values() if not os.path.exists(f)]
|
|
||||||
|
|
||||||
if len(nonexistent) != 0:
|
for f in list(args.f):
|
||||||
print("[!] please ensure the following file(s) exist:")
|
if f[-1] == "/": # yeah this is stupid
|
||||||
for ne in nonexistent:
|
f = f[:-1]
|
||||||
print(f"[?] - {ne}")
|
|
||||||
sys.exit(1)
|
if not os.path.exists(f):
|
||||||
|
sys.exit(f"[!] \"{f}\" does not exist")
|
||||||
|
|
||||||
|
new[os.path.basename(f)] = os.path.realpath(f)
|
||||||
|
|
||||||
|
# i would've modified args.f directly, but it causes type-hinting error :(
|
||||||
|
args.f = new
|
||||||
|
|
||||||
if (
|
if (
|
||||||
args.m is not None
|
args.m is not None
|
||||||
@@ -106,11 +110,12 @@ def get_tools_dir() -> tuple[str, str]:
|
|||||||
# thank god i dont have to use importlib,
|
# thank god i dont have to use importlib,
|
||||||
# it's the WORST standard library package prior to 3.12
|
# it's the WORST standard library package prior to 3.12
|
||||||
install_dir = os.path.dirname(__file__)
|
install_dir = os.path.dirname(__file__)
|
||||||
|
specific_dir = f"{install_dir}/tools/{system}/{mach}"
|
||||||
|
|
||||||
return (
|
if not os.path.isdir(specific_dir):
|
||||||
install_dir,
|
sys.exit(f"[!] cyan is not supported on: {system} {mach}")
|
||||||
f"{install_dir}/tools/{system}/{mach}"
|
|
||||||
)
|
return (install_dir, specific_dir)
|
||||||
|
|
||||||
|
|
||||||
def delete_if_exists(path: str, bn: str) -> bool:
|
def delete_if_exists(path: str, bn: str) -> bool:
|
||||||
|
|||||||
BIN
cyan/tools/Darwin/arm64/insert_dylib
Executable file
BIN
cyan/tools/Darwin/arm64/insert_dylib
Executable file
Binary file not shown.
BIN
cyan/tools/Darwin/x86_64/insert_dylib
Executable file
BIN
cyan/tools/Darwin/x86_64/insert_dylib
Executable file
Binary file not shown.
BIN
cyan/tools/Linux/x86_64/insert_dylib
Executable file
BIN
cyan/tools/Linux/x86_64/insert_dylib
Executable file
Binary file not shown.
2
setup.py
2
setup.py
@@ -4,7 +4,7 @@ from setuptools import setup
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="cyan",
|
name="cyan",
|
||||||
version="1.1.3",
|
version="1.1.4",
|
||||||
description="finally, pyzule doesn't suck",
|
description="finally, pyzule doesn't suck",
|
||||||
author="zx",
|
author="zx",
|
||||||
author_email="zx@hrzn.email",
|
author_email="zx@hrzn.email",
|
||||||
|
|||||||
Reference in New Issue
Block a user