4 Commits

Author SHA1 Message Date
zx
06a2ea8dad chore: bump version to v1.1.4 2024-09-13 18:28:35 -04:00
zx
55b2ec9d07 fix: folders ending in / 2024-09-13 18:27:45 -04:00
zx
52b3b11a1a chore: use insert_dylib on more platforms 2024-09-13 18:07:00 -04:00
zx
4375b7f880 docs: update install instructions 2024-09-11 17:33:40 -04:00
8 changed files with 58 additions and 33 deletions

View File

@@ -2,8 +2,6 @@
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
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
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
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)
2. install cyan: `pipx install --force https://github.com/asdfzxcvbn/pyzule-rw/archive/main.zip`
3. follow any instructions `pipx` may have given you, like `pipx ensurepath`
4. **if you want to inject dylibs and ARE NOT ON iOS**: `pipx inject cyan lief`
5. **if you want to change app icons (iOS NOT supported)**: `pipx inject cyan Pillow`
<details>
<summary><b>linux/WSL/macOS instructions</b></summary>
<br/>
<ol>
<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

View File

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

View File

@@ -18,6 +18,7 @@ class Executable:
ldid = f"{specific}/ldid"
lipo = f"{specific}/lipo"
otool = f"{specific}/otool"
idylib = f"{specific}/insert_dylib"
starters = ("\t/Library/", "\t@rpath", "\t@executable_path")
common = {
@@ -42,10 +43,10 @@ class Executable:
self.bn = os.path.basename(path)
self.inj: Optional = None # type: ignore
if self.specific.endswith("iOS"):
self.inj_func = self.ios_inject
if os.path.isfile(self.idylib):
self.inj_func = self.idyl_inject
else:
self.inj_func = self.insert_cmd
self.inj_func = self.lief_inj
def is_encrypted(self) -> bool:
proc = subprocess.run(
@@ -177,7 +178,7 @@ class Executable:
stderr=subprocess.DEVNULL
)
def insert_cmd(self, cmd: str) -> None:
def lief_inj(self, cmd: str) -> None:
if self.inj is None: # type: ignore
try:
lief.logging.disable() # type: ignore
@@ -186,17 +187,22 @@ class Executable:
self.inj = lief.parse(self.path) # 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:
subprocess.run(
def idyl_inject(self, cmd: str) -> None:
proc = subprocess.run(
[
f"{self.specific}/insert_dylib",
"--weak", "--inplace", "--no-strip-codesig", "--all-yes",
self.idylib, "--weak", "--inplace", "--strip-codesig", "--all-yes",
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:
self.remove_signature()

View File

@@ -39,15 +39,19 @@ def validate_inputs(args: Namespace) -> Optional[str]:
sys.exit(0)
if args.f is not None:
# 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)]
new: dict[str, str] = {} # dictionary ensures unique names
if len(nonexistent) != 0:
print("[!] please ensure the following file(s) exist:")
for ne in nonexistent:
print(f"[?] - {ne}")
sys.exit(1)
for f in list(args.f):
if f[-1] == "/": # yeah this is stupid
f = f[:-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 (
args.m is not None
@@ -106,11 +110,12 @@ def get_tools_dir() -> tuple[str, str]:
# thank god i dont have to use importlib,
# it's the WORST standard library package prior to 3.12
install_dir = os.path.dirname(__file__)
specific_dir = f"{install_dir}/tools/{system}/{mach}"
return (
install_dir,
f"{install_dir}/tools/{system}/{mach}"
)
if not os.path.isdir(specific_dir):
sys.exit(f"[!] cyan is not supported on: {system} {mach}")
return (install_dir, specific_dir)
def delete_if_exists(path: str, bn: str) -> bool:

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

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