rikune 2.3.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rikune/__init__.py +7 -0
- rikune/backends/__init__.py +14 -0
- rikune/backends/base.py +92 -0
- rikune/backends/bridge.py +702 -0
- rikune/backends/fast_native.py +436 -0
- rikune/backends/ghidra.py +297 -0
- rikune/backends/ghidra_scripts/AnalyzeCrossReferences.java +644 -0
- rikune/backends/ghidra_scripts/DecompileFunction.java +487 -0
- rikune/backends/ghidra_scripts/ExtractCFG.java +256 -0
- rikune/backends/ghidra_scripts/ExtractFunctions.java +442 -0
- rikune/backends/ghidra_scripts/SearchFunctionReferences.java +380 -0
- rikune/backends/rizin.py +799 -0
- rikune/cli.py +1043 -0
- rikune/config.py +91 -0
- rikune/core/__init__.py +8 -0
- rikune/core/guard.py +306 -0
- rikune/core/jobs.py +66 -0
- rikune/core/models.py +305 -0
- rikune/core/store.py +509 -0
- rikune/core/workspace.py +179 -0
- rikune/engine.py +1504 -0
- rikune/graph/__init__.py +36 -0
- rikune/graph/export.py +539 -0
- rikune/graph/lifter.py +1000 -0
- rikune/graph/overlay.py +127 -0
- rikune/graph/slicer.py +1303 -0
- rikune/mcp_server.py +1022 -0
- rikune/static/__init__.py +94 -0
- rikune/static/axml.py +518 -0
- rikune/static/crypto_ops.py +502 -0
- rikune/static/crypto_scan.py +1044 -0
- rikune/static/dex_disasm.py +1063 -0
- rikune/static/disasm.py +422 -0
- rikune/static/dotnet_il.py +904 -0
- rikune/static/firmware.py +188 -0
- rikune/static/formats.py +532 -0
- rikune/static/heuristics.py +469 -0
- rikune/static/js_deobf.py +2473 -0
- rikune/static/lang_symbols.py +770 -0
- rikune/static/managed.py +653 -0
- rikune/static/memory.py +234 -0
- rikune/static/patcher.py +317 -0
- rikune/static/pattern.py +929 -0
- rikune/static/protocol.py +916 -0
- rikune/static/rtti.py +988 -0
- rikune/static/strings.py +115 -0
- rikune/static/unpacker.py +303 -0
- rikune/static/wasm_parser.py +386 -0
- rikune/static/yara_scanner.py +77 -0
- rikune/verify/__init__.py +60 -0
- rikune/verify/api_hash.py +862 -0
- rikune/verify/batch_decrypt.py +1172 -0
- rikune/verify/data/api_names.txt +575 -0
- rikune/verify/peb.py +1284 -0
- rikune/verify/stubs.py +1216 -0
- rikune/verify/symbolic.py +363 -0
- rikune/verify/syscall.py +384 -0
- rikune/verify/trace.py +803 -0
- rikune/verify/unicorn_emu.py +1827 -0
- rikune-2.3.3.dist-info/METADATA +314 -0
- rikune-2.3.3.dist-info/RECORD +64 -0
- rikune-2.3.3.dist-info/WHEEL +4 -0
- rikune-2.3.3.dist-info/entry_points.txt +2 -0
- rikune-2.3.3.dist-info/licenses/LICENSE +21 -0
rikune/__init__.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"""Decompiler backend protocol, registry, and Rizin/Ghidra/Bridge implementations."""
|
|
2
|
+
|
|
3
|
+
from rikune.backends.base import BackendRegistry, DecompilerBackend
|
|
4
|
+
from rikune.backends.bridge import ExternalBridgeBackend
|
|
5
|
+
from rikune.backends.ghidra import GhidraBackend
|
|
6
|
+
from rikune.backends.rizin import RizinBackend
|
|
7
|
+
|
|
8
|
+
__all__ = [
|
|
9
|
+
"BackendRegistry",
|
|
10
|
+
"DecompilerBackend",
|
|
11
|
+
"ExternalBridgeBackend",
|
|
12
|
+
"GhidraBackend",
|
|
13
|
+
"RizinBackend",
|
|
14
|
+
]
|
rikune/backends/base.py
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"""Decompiler backend protocol and pluggable registry."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
from typing import Protocol, runtime_checkable
|
|
7
|
+
|
|
8
|
+
from rikune.core.models import (
|
|
9
|
+
BinaryDiffResult,
|
|
10
|
+
CfgResult,
|
|
11
|
+
DecompileResult,
|
|
12
|
+
FunctionInfo,
|
|
13
|
+
XrefEntry,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@runtime_checkable
|
|
18
|
+
class DecompilerBackend(Protocol):
|
|
19
|
+
"""Unified contract implemented by all reverse-engineering backends (Rizin, Ghidra, etc.)."""
|
|
20
|
+
|
|
21
|
+
name: str
|
|
22
|
+
|
|
23
|
+
def is_available(self) -> bool: ...
|
|
24
|
+
|
|
25
|
+
def list_functions(self, sample_path: Path, sample_sha256: str) -> list[FunctionInfo]: ...
|
|
26
|
+
|
|
27
|
+
def decompile(
|
|
28
|
+
self,
|
|
29
|
+
sample_path: Path,
|
|
30
|
+
sample_sha256: str,
|
|
31
|
+
target: str,
|
|
32
|
+
*,
|
|
33
|
+
include_disasm: bool = False,
|
|
34
|
+
) -> DecompileResult: ...
|
|
35
|
+
|
|
36
|
+
def disassemble_function(
|
|
37
|
+
self,
|
|
38
|
+
sample_path: Path,
|
|
39
|
+
sample_sha256: str,
|
|
40
|
+
target: str,
|
|
41
|
+
) -> str: ...
|
|
42
|
+
|
|
43
|
+
def xrefs(
|
|
44
|
+
self,
|
|
45
|
+
sample_path: Path,
|
|
46
|
+
sample_sha256: str,
|
|
47
|
+
target: str,
|
|
48
|
+
) -> dict[str, list[XrefEntry]]: ...
|
|
49
|
+
|
|
50
|
+
def cfg(
|
|
51
|
+
self,
|
|
52
|
+
sample_path: Path,
|
|
53
|
+
sample_sha256: str,
|
|
54
|
+
target: str,
|
|
55
|
+
) -> CfgResult: ...
|
|
56
|
+
|
|
57
|
+
def diff(
|
|
58
|
+
self,
|
|
59
|
+
sample_a_path: Path,
|
|
60
|
+
sample_a_sha256: str,
|
|
61
|
+
sample_b_path: Path,
|
|
62
|
+
sample_b_sha256: str,
|
|
63
|
+
) -> BinaryDiffResult: ...
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class BackendRegistry:
|
|
67
|
+
"""Ordered registry of decompiler backends with graceful capability discovery."""
|
|
68
|
+
|
|
69
|
+
def __init__(self) -> None:
|
|
70
|
+
self._backends: dict[str, DecompilerBackend] = {}
|
|
71
|
+
|
|
72
|
+
def register(self, backend: DecompilerBackend) -> None:
|
|
73
|
+
self._backends[backend.name] = backend
|
|
74
|
+
|
|
75
|
+
def get(self, name: str | None = None) -> DecompilerBackend:
|
|
76
|
+
if name and name != "auto":
|
|
77
|
+
backend = self._backends.get(name)
|
|
78
|
+
if backend is None:
|
|
79
|
+
raise KeyError(f"Unknown backend '{name}'. Registered: {list(self._backends)}")
|
|
80
|
+
if not backend.is_available():
|
|
81
|
+
raise RuntimeError(f"Backend '{name}' is registered but not available on this host.")
|
|
82
|
+
return backend
|
|
83
|
+
|
|
84
|
+
for backend in self._backends.values():
|
|
85
|
+
if backend.is_available():
|
|
86
|
+
return backend
|
|
87
|
+
raise RuntimeError(
|
|
88
|
+
"No decompiler backend is available. Install 'rizin' or configure GHIDRA_HOME."
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
def status(self) -> dict[str, bool]:
|
|
92
|
+
return {name: backend.is_available() for name, backend in self._backends.items()}
|