A lightweight emulation framework for emulating security algorithms of iOS executables and libraries.
Project description
Chomper
Chomper is a lightweight emulation framework based on Unicorn. It is mainly used to emulate security algorithms in iOS executables and libraries. In addition, it also provides limited support for Android native libraries.
Features
- Emulation of ELF and Mach-O binaries
- Support for a subset of iOS system libraries (from iOS 14.4.0)
Requirements
- Python 3.9+
- Unicorn 2.0.0+
Installation
Install the stable version from PyPI:
$ pip install chomper
Or install the latest version from GitHub:
$ pip install git+https://github.com/sledgeh4w/chomper.git
Clone rootfs repository:
$ git clone https://github.com/sledgeh4w/rootfs.git
Usage
Emulate iOS executables.
from chomper import Chomper
from chomper.const import ARCH_ARM64, OS_IOS
# For iOS, system libraries will be automatically loaded from `rootfs_path`
emu = Chomper(
arch=ARCH_ARM64,
os_type=OS_IOS,
rootfs_path="rootfs/ios",
)
# Load program
discover = emu.load_module("examples/binaries/ios/com.xingin.discover/8.74/discover")
s = "chomper"
# Construct arguments
a1 = emu.create_string(s)
a2 = len(s)
a3 = emu.create_buffer(120)
a4 = 120
a5 = emu.create_buffer(8)
# Call function
emu.call_address(discover.base + 0x324ef10, a1, a2, a3, a4, a5)
result = emu.read_string(a3)
Working with Objective-C.
from chomper import Chomper
from chomper.const import ARCH_ARM64, OS_IOS
from chomper.objc import ObjcRuntime
emu = Chomper(
arch=ARCH_ARM64,
os_type=OS_IOS,
rootfs_path="rootfs/ios",
)
objc = ObjcRuntime(emu)
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():
# Find class
zsch_rsa_class = objc.find_class("ZSCHRSA")
# Create NSString object
a1 = objc.create_ns_string("chomper")
# Call Objective-C method
req_sign = zsch_rsa_class.call_method("getReqSign:", a1)
# Convert NSString object to C string
result_ptr = req_sign.call_method("UTF8String")
result = emu.read_string(result_ptr)
Emulate Android native libraries.
from chomper import Chomper
from chomper.const import ARCH_ARM64, OS_ANDROID
emu = Chomper(
arch=ARCH_ARM64,
os_type=OS_ANDROID,
rootfs_path="rootfs/android",
)
# Load dependency libraries
emu.load_module("rootfs/android/system/lib64/libz.so")
libszstone = emu.load_module("examples/binaries/android/com.shizhuang.duapp/libszstone.so")
s = "chomper"
a1 = emu.create_string(s)
a2 = len(s)
a3 = emu.create_buffer(1024)
result_size = emu.call_address(libszstone.base + 0x2F1C8, a1, a2, a3)
result = emu.read_bytes(a3, result_size)
Examples
There are some security algorithm emulation codes in algorithms.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file chomper-0.3.7.tar.gz.
File metadata
- Download URL: chomper-0.3.7.tar.gz
- Upload date:
- Size: 84.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6a9e65c7c9b88d4d747163caadfea6badf848238204f193b2c8742413c74d8ad
|
|
| MD5 |
da9a35fc122fa4200bde1661f9472d07
|
|
| BLAKE2b-256 |
de6f7e26f1591b60fd88de0786975b6bc3db4d6676b8189df344100d20d7caba
|
File details
Details for the file chomper-0.3.7-py3-none-any.whl.
File metadata
- Download URL: chomper-0.3.7-py3-none-any.whl
- Upload date:
- Size: 88.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26153e4e41ea6ecf7c033fb729443568c236df2445bdce758860e8061c453823
|
|
| MD5 |
2c986eab2eca8f31a2a8c257df1c01b9
|
|
| BLAKE2b-256 |
18f0603a284a773564c005dea5d81f0bf12c469f794a3f6040c5f1d694467b8e
|