Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retrieve example binary files from the Internet #100

Merged
merged 2 commits into from
Nov 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ jobs:
- { name: Mac, python: '3.10', os: macos-latest }
- { name: '3.11', python: '3.11', os: ubuntu-latest }
- { name: '3.9', python: '3.9', os: ubuntu-latest }
- { name: '3.8', python: '3.8', os: ubuntu-latest }
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ from chomper.const import ARCH_ARM64, OS_IOS
emu = Chomper(
arch=ARCH_ARM64,
os_type=OS_IOS,
rootfs_path="examples/ios/rootfs",
rootfs_path="examples/rootfs/ios",
)

# Load main program
duapp = emu.load_module("examples/ios/apps/com.siwuai.duapp/DUApp")
duapp = emu.load_module("examples/binaries/ios/com.siwuai.duapp/DUApp")

s = "chomper"

Expand Down Expand Up @@ -69,12 +69,12 @@ from chomper.objc import ObjC
emu = Chomper(
arch=ARCH_ARM64,
os_type=OS_IOS,
rootfs_path="examples/ios/rootfs",
rootfs_path="examples/rootfs/ios",
)

objc = ObjC(emu)

emu.load_module("examples/ios/apps/cn.com.scal.sichuanair/zsch")
emu.load_module("examples/binaries/ios/cn.com.scal.sichuanair/zsch")

# Use this context manager to ensure that Objective-C objects can be automatically released
with objc.autorelease_pool():
Expand All @@ -98,11 +98,11 @@ from chomper.const import ARCH_ARM64, OS_ANDROID
emu = Chomper(arch=ARCH_ARM64, os_type=OS_ANDROID)

# Load C standard and other libraries
emu.load_module("examples/android/rootfs/system/lib64/libc.so")
emu.load_module("examples/android/rootfs/system/lib64/libz.so")
emu.load_module("examples/rootfs/android/system/lib64/libc.so")
emu.load_module("examples/rootfs/android/system/lib64/libz.so")

libszstone = emu.load_module(
"examples/android/apps/com.shizhuang.duapp/libszstone.so",
"examples/binaries/android/com.shizhuang.duapp/libszstone.so",
exec_init_array=True,
)

Expand Down
Binary file not shown.
Binary file not shown.
Binary file removed examples/android/apps/com.xingin.xhs/libtiny.so
Binary file not shown.
23 changes: 21 additions & 2 deletions examples/example_ios_ali_vmp_sign.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import logging
import os
import urllib.request
import uuid
from pathlib import Path

from chomper import Chomper
from chomper.const import ARCH_ARM64, OS_IOS
Expand Down Expand Up @@ -43,19 +45,36 @@ def hook_ns_bundle(emu):
emu.add_interceptor("-[NSBundle infoDictionary]", hook_retval(pyobj2nsobj(emu, bundle_info)))


def retrieve_binary(url: str, filepath: str):
path = Path(filepath)
if path.exists():
return
if not path.parent.exists():
path.parent.mkdir(parents=True)
print(f"Retrieving binary: {url}")
urllib.request.urlretrieve(url, path)


def main():
# Download example binary file from the Internet
binary_path = "binaries/ios/com.csair.MBP/CSMBP-AppStore-Package"
retrieve_binary(
url=f"https://sourceforge.net/projects/chomper-emu/files/examples/{binary_path}/download",
filepath=os.path.join(base_path, binary_path),
)

emu = Chomper(
arch=ARCH_ARM64,
os_type=OS_IOS,
rootfs_path=os.path.join(base_path, "ios/rootfs"),
rootfs_path=os.path.join(base_path, "rootfs/ios"),
enable_ui_kit=True,
)

objc = ObjC(emu)

hook_ns_bundle(emu)

emu.load_module(os.path.join(base_path, "ios/apps/com.csair.MBP/CSMBP-AppStore-Package"))
emu.load_module(os.path.join(base_path, binary_path))

ali_tiger_tally_instance = objc.msg_send("AliTigerTally", "sharedInstance")

Expand Down
23 changes: 21 additions & 2 deletions examples/example_ios_bangbang.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import logging
import os
import urllib.request
from pathlib import Path

from chomper import Chomper
from chomper.const import ARCH_ARM64, OS_IOS
Expand All @@ -17,17 +19,34 @@
logger = logging.getLogger(__name__)


def retrieve_binary(url: str, filepath: str):
path = Path(filepath)
if path.exists():
return
if not path.parent.exists():
path.parent.mkdir(parents=True)
print(f"Retrieving binary: {url}")
urllib.request.urlretrieve(url, path)


def main():
# Download example binary file from the Internet
binary_path = "binaries/ios/com.ceair.b2m/ceair_iOS_branch"
retrieve_binary(
url=f"https://sourceforge.net/projects/chomper-emu/files/examples/{binary_path}/download",
filepath=os.path.join(base_path, binary_path),
)

emu = Chomper(
arch=ARCH_ARM64,
os_type=OS_IOS,
rootfs_path=os.path.join(base_path, "ios/rootfs"),
rootfs_path=os.path.join(base_path, "rootfs/ios"),
enable_ui_kit=True,
)

objc = ObjC(emu)

emu.load_module(os.path.join(base_path, "ios/apps/com.ceair.b2m/ceair_iOS_branch"))
emu.load_module(os.path.join(base_path, binary_path))

with objc.autorelease_pool():
# Encrypt
Expand Down
23 changes: 21 additions & 2 deletions examples/example_ios_ijm.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import logging
import os
import urllib.request
from pathlib import Path

from chomper import Chomper
from chomper.const import ARCH_ARM64, OS_IOS
Expand All @@ -24,17 +26,34 @@ def decorator(emu, *args):
return decorator


def retrieve_binary(url: str, filepath: str):
path = Path(filepath)
if path.exists():
return
if not path.parent.exists():
path.parent.mkdir(parents=True)
print(f"Retrieving binary: {url}")
urllib.request.urlretrieve(url, path)


def main():
# Download example binary file from the Internet
binary_path = "binaries/ios/com.csair.MBP/CSMBP-AppStore-Package"
retrieve_binary(
url=f"https://sourceforge.net/projects/chomper-emu/files/examples/{binary_path}/download",
filepath=os.path.join(base_path, binary_path),
)

emu = Chomper(
arch=ARCH_ARM64,
os_type=OS_IOS,
rootfs_path=os.path.join(base_path, "ios/rootfs"),
rootfs_path=os.path.join(base_path, "rootfs/ios"),
)

objc = ObjC(emu)

czair = emu.load_module(
module_file=os.path.join(base_path, "ios/apps/com.csair.MBP/CSMBP-AppStore-Package"),
module_file=os.path.join(base_path, binary_path),
exec_init_array=True,
)

Expand Down
Loading
Loading