Skip to content

Commit 90b701a

Browse files
authored
Rename project to Chomper (#41)
* Rename project to chomper * Update version * Update CHANGES.md * Update badges
1 parent 88222d7 commit 90b701a

18 files changed

+54
-48
lines changed

CHANGES.md

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1+
## v0.2.0
2+
3+
Released: 2022-11-26
4+
5+
- Rename project to Chomper.
6+
17
## v0.1.1
28

39
Released: 2022-11-21
410

5-
- Make ``add_hook`` return from ``hook_add`` of ``Unicorn`` and add ``del_hook`` method for ``Infernum``.
11+
- Make ``add_hook`` return from ``hook_add`` of ``Unicorn`` and add ``del_hook`` method for ``Chomper``.
612
- Close the library file after loading.
713
- Move default symbol hooks to ``arch`` module.
814

@@ -20,8 +26,8 @@ Released: 2022-09-10
2026
- Add ``user_data`` param for ``add_hook`` to customize params of callback.
2127
- Support trace symbol calls by using ``trace_symbol_calls`` param.
2228
- Raise ``EmulatorCrashedException`` with prompt message when missing symbol is required.
23-
- Add a default logger for ``Infernum``.
24-
- Add ``free`` method for ``Infernum``.
29+
- Add a default logger for ``Chomper``.
30+
- Add ``free`` method for ``Chomper``.
2531

2632
## v0.0.1
2733

README.md

+18-18
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
# Infernum
1+
# Chomper
22

3-
[![build](https://github.com/Sh4ww/infernum/actions/workflows/tests.yml/badge.svg)](https://github.com/Sh4ww/infernum/actions/workflows/tests.yml)
4-
![PyPI](https://img.shields.io/pypi/v/infernum)
5-
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/infernum)
6-
[![GitHub license](https://img.shields.io/github/license/Sh4ww/infernum)](https://github.com/Sh4ww/infernum/blob/main/LICENSE)
3+
[![build](https://github.com/sh4w1/chomper/actions/workflows/tests.yml/badge.svg)](https://github.com/sh4w1/chomper/actions/workflows/tests.yml)
4+
![PyPI](https://img.shields.io/pypi/v/chomper)
5+
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/chomper)
6+
[![GitHub license](https://img.shields.io/github/license/sh4w1/chomper)](https://github.com/sh4w1/chomper/blob/main/LICENSE)
77

8-
Infernum is a lightweight Android native library emulation framework based on [Unicorn](https://github.com/unicorn-engine/unicorn). It is mainly used to execute the encryption algorithm, so it doesn't provide JNI or file system support. It supports arch ARM and ARM64.
8+
Chomper is a lightweight Android native library emulation framework based on [Unicorn](https://github.com/unicorn-engine/unicorn). It is mainly used to execute the encryption algorithm, so it doesn't provide JNI or file system support. It supports arch ARM and ARM64.
99

1010
## Requirements
1111

@@ -15,25 +15,25 @@ Infernum is a lightweight Android native library emulation framework based on [U
1515
## Installation
1616

1717
```
18-
$ pip install infernum
18+
$ pip install chomper
1919
```
2020

2121
## Usage
2222

2323
Load modules and call functions.
2424

2525
```python
26-
from infernum import Infernum
27-
from infernum.const import ARCH_ARM64
26+
from chomper import Chomper
27+
from chomper.const import ARCH_ARM64
2828

2929
# Initialize emulator
30-
emulator = Infernum(ARCH_ARM64)
30+
emulator = Chomper(ARCH_ARM64)
3131

3232
# Load modules
3333
emulator.load_module("lib64/libz.so")
3434

3535
# Construct arguments
36-
data = b"infernum"
36+
data = b"chomper"
3737

3838
v1 = emulator.create_buffer(len(data))
3939
v2 = len(data)
@@ -51,23 +51,23 @@ emulator.call_address(symbol.address, 0, v1, v2)
5151
Emulate arch ARM.
5252

5353
```python
54-
from infernum import Infernum
55-
from infernum.const import ARCH_ARM
54+
from chomper import Chomper
55+
from chomper.const import ARCH_ARM
5656

57-
emulator = Infernum(ARCH_ARM)
57+
emulator = Chomper(ARCH_ARM)
5858
```
5959

6060
Read/Write data.
6161

6262
```python
6363
# Create buffer
6464
v1 = emulator.create_buffer(64)
65-
v2 = emulator.create_string("infernum")
65+
v2 = emulator.create_string("chomper")
6666

6767
# Write data
6868
emulator.write_int(v1, 1)
69-
emulator.write_bytes(v1, b"infernum")
70-
emulator.write_string(v2, "infernum")
69+
emulator.write_bytes(v1, b"chomper")
70+
emulator.write_string(v2, "chomper")
7171

7272
# Read data
7373
emulator.read_int(v1)
@@ -89,7 +89,7 @@ Trace instructions.
8989

9090
```python
9191
# Trace all instructions
92-
emulator = Infernum(ARCH_ARM64, trace_inst=True)
92+
emulator = Chomper(ARCH_ARM64, trace_inst=True)
9393

9494
# Trace instructions in this module
9595
emulator.load_module("lib64/libz.so", trace_inst=True)

setup.cfg

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
2-
name = infernum
3-
version = attr: infernum.__version__
2+
name = chomper
3+
version = attr: chomper.__version__
44
author = Sh4w
55
author_email = sh4w0911@gmail.com
66
description = A lightweight Android native library emulation framework for executing the encryption algorithm.
@@ -35,13 +35,13 @@ ignore =
3535
E203
3636
W503
3737
per-file-ignores =
38-
src/infernum/__init__.py: F401, F403
38+
src/chomper/__init__.py: F401, F403
3939
exclude =
4040
venv
4141
max-line-length = 88
4242

4343
[mypy]
44-
files = src/infernum
44+
files = src/chomper
4545
python_version = 3.7
4646
show_error_codes = True
4747
allow_redefinition = True

src/chomper/__init__.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from .core import Chomper
2+
3+
__version__ = "0.2.0"
File renamed without changes.
File renamed without changes.

src/infernum/core.py src/chomper/core.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
from typing_extensions import Literal
3636

3737

38-
class Infernum:
38+
class Chomper:
3939
"""Lightweight Android native library emulation framework.
4040
4141
Args:
File renamed without changes.

src/infernum/hooks.py src/chomper/hooks.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
from unicorn.unicorn import UC_HOOK_CODE_TYPE
88

99
if TYPE_CHECKING:
10-
from .core import Infernum
10+
from .core import Chomper
1111

1212

13-
def intercept(f: Callable[["Infernum"], Any]) -> UC_HOOK_CODE_TYPE:
13+
def intercept(f: Callable[["Chomper"], Any]) -> UC_HOOK_CODE_TYPE:
1414
"""Intercept function call."""
1515

1616
@wraps(f)
@@ -38,15 +38,15 @@ def hook_arc4random(_):
3838

3939

4040
@intercept
41-
def hook_free(emulator: "Infernum"):
41+
def hook_free(emulator: "Chomper"):
4242
"""Intercept ``free`` of ``libc.so``."""
4343
addr = emulator.get_argument(0)
4444

4545
emulator.memory_manager.free(addr)
4646

4747

4848
@intercept
49-
def hook_getcwd(emulator: "Infernum"):
49+
def hook_getcwd(emulator: "Chomper"):
5050
"""Intercept ``getcwd`` of ``libc.so``."""
5151
buf = emulator.get_argument(0)
5252
cwd = os.getcwd()
@@ -62,19 +62,19 @@ def hook_getcwd(emulator: "Infernum"):
6262

6363

6464
@intercept
65-
def hook_getpid(emulator: "Infernum"):
65+
def hook_getpid(emulator: "Chomper"):
6666
"""Intercept ``getpid`` of ``libc.so``."""
6767
emulator.set_retval(os.getpid())
6868

6969

7070
@intercept
71-
def hook_gettid(emulator: "Infernum"):
71+
def hook_gettid(emulator: "Chomper"):
7272
"""Intercept ``gettid`` of ``libc.so``."""
7373
emulator.set_retval(threading.get_ident())
7474

7575

7676
@intercept
77-
def hook_malloc(emulator: "Infernum"):
77+
def hook_malloc(emulator: "Chomper"):
7878
"""Intercept ``malloc`` of ``libc.so``."""
7979
size = emulator.get_argument(0)
8080
addr = emulator.memory_manager.alloc(size)
@@ -83,7 +83,7 @@ def hook_malloc(emulator: "Infernum"):
8383

8484

8585
@intercept
86-
def hook_memcpy(emulator: "Infernum"):
86+
def hook_memcpy(emulator: "Chomper"):
8787
"""Intercept ``memcpy`` of ``libc.so``."""
8888
dst = emulator.get_argument(0)
8989
src = emulator.get_argument(1)
@@ -95,7 +95,7 @@ def hook_memcpy(emulator: "Infernum"):
9595

9696

9797
@intercept
98-
def hook_memset(emulator: "Infernum"):
98+
def hook_memset(emulator: "Chomper"):
9999
"""Intercept ``memset`` of ``libc.so``."""
100100
addr = emulator.get_argument(0)
101101
char = emulator.get_argument(1)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/infernum/__init__.py

-3
This file was deleted.

tests/conftest.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
import pytest
44

5-
from infernum import Infernum
6-
from infernum.const import ARCH_ARM, ARCH_ARM64
5+
from chomper import Chomper
6+
from chomper.const import ARCH_ARM, ARCH_ARM64
77

88
base_path = os.path.abspath(os.path.dirname(__file__))
99

@@ -23,7 +23,7 @@ def sample_bytes(sample_str):
2323

2424
@pytest.fixture(scope="module")
2525
def emu_arm():
26-
yield Infernum(arch=ARCH_ARM)
26+
yield Chomper(arch=ARCH_ARM)
2727

2828

2929
@pytest.fixture(scope="module")
@@ -46,7 +46,7 @@ def dusanwalib_v4856_arm(emu_arm):
4646

4747
@pytest.fixture(scope="module")
4848
def emu_arm64():
49-
yield Infernum(arch=ARCH_ARM64)
49+
yield Chomper(arch=ARCH_ARM64)
5050

5151

5252
@pytest.fixture(scope="module")

tests/test_emulator.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def test_write_and_read_bytes(emu_arm64, sample_bytes):
130130

131131
def test_write_and_read_string(emu_arm64):
132132
buffer = emu_arm64.create_buffer(1024)
133-
string = "infernum"
133+
string = "chomper"
134134

135135
emu_arm64.write_string(buffer, string)
136136
result = emu_arm64.read_string(buffer)

tests/test_exceptions.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44

55
from .conftest import lib64_path
66

7-
from infernum import Infernum
8-
from infernum.const import ARCH_ARM64
9-
from infernum.exceptions import EmulatorCrashedException
7+
from chomper import Chomper
8+
from chomper.const import ARCH_ARM64
9+
from chomper.exceptions import EmulatorCrashedException
1010

1111

1212
def test_unhandled_system_call_exception():
1313
with pytest.raises(EmulatorCrashedException, match=r"Unhandled system call.*"):
14-
emulator = Infernum(arch=ARCH_ARM64)
14+
emulator = Chomper(arch=ARCH_ARM64)
1515
emulator._symbol_hooks.pop("malloc")
1616

1717
emulator.load_module(os.path.join(lib64_path, "libc.so"))
@@ -21,7 +21,7 @@ def test_unhandled_system_call_exception():
2121

2222
def test_missing_symbol_required_exception(sample_bytes):
2323
with pytest.raises(EmulatorCrashedException, match=r"Missing symbol.*"):
24-
emulator = Infernum(arch=ARCH_ARM64)
24+
emulator = Chomper(arch=ARCH_ARM64)
2525
szstonelib = emulator.load_module(
2626
os.path.join(lib64_path, "com.shizhuang.duapp_v4.94.5_libszstone.so")
2727
)

0 commit comments

Comments
 (0)