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.
Files changed (64) hide show
  1. rikune/__init__.py +7 -0
  2. rikune/backends/__init__.py +14 -0
  3. rikune/backends/base.py +92 -0
  4. rikune/backends/bridge.py +702 -0
  5. rikune/backends/fast_native.py +436 -0
  6. rikune/backends/ghidra.py +297 -0
  7. rikune/backends/ghidra_scripts/AnalyzeCrossReferences.java +644 -0
  8. rikune/backends/ghidra_scripts/DecompileFunction.java +487 -0
  9. rikune/backends/ghidra_scripts/ExtractCFG.java +256 -0
  10. rikune/backends/ghidra_scripts/ExtractFunctions.java +442 -0
  11. rikune/backends/ghidra_scripts/SearchFunctionReferences.java +380 -0
  12. rikune/backends/rizin.py +799 -0
  13. rikune/cli.py +1043 -0
  14. rikune/config.py +91 -0
  15. rikune/core/__init__.py +8 -0
  16. rikune/core/guard.py +306 -0
  17. rikune/core/jobs.py +66 -0
  18. rikune/core/models.py +305 -0
  19. rikune/core/store.py +509 -0
  20. rikune/core/workspace.py +179 -0
  21. rikune/engine.py +1504 -0
  22. rikune/graph/__init__.py +36 -0
  23. rikune/graph/export.py +539 -0
  24. rikune/graph/lifter.py +1000 -0
  25. rikune/graph/overlay.py +127 -0
  26. rikune/graph/slicer.py +1303 -0
  27. rikune/mcp_server.py +1022 -0
  28. rikune/static/__init__.py +94 -0
  29. rikune/static/axml.py +518 -0
  30. rikune/static/crypto_ops.py +502 -0
  31. rikune/static/crypto_scan.py +1044 -0
  32. rikune/static/dex_disasm.py +1063 -0
  33. rikune/static/disasm.py +422 -0
  34. rikune/static/dotnet_il.py +904 -0
  35. rikune/static/firmware.py +188 -0
  36. rikune/static/formats.py +532 -0
  37. rikune/static/heuristics.py +469 -0
  38. rikune/static/js_deobf.py +2473 -0
  39. rikune/static/lang_symbols.py +770 -0
  40. rikune/static/managed.py +653 -0
  41. rikune/static/memory.py +234 -0
  42. rikune/static/patcher.py +317 -0
  43. rikune/static/pattern.py +929 -0
  44. rikune/static/protocol.py +916 -0
  45. rikune/static/rtti.py +988 -0
  46. rikune/static/strings.py +115 -0
  47. rikune/static/unpacker.py +303 -0
  48. rikune/static/wasm_parser.py +386 -0
  49. rikune/static/yara_scanner.py +77 -0
  50. rikune/verify/__init__.py +60 -0
  51. rikune/verify/api_hash.py +862 -0
  52. rikune/verify/batch_decrypt.py +1172 -0
  53. rikune/verify/data/api_names.txt +575 -0
  54. rikune/verify/peb.py +1284 -0
  55. rikune/verify/stubs.py +1216 -0
  56. rikune/verify/symbolic.py +363 -0
  57. rikune/verify/syscall.py +384 -0
  58. rikune/verify/trace.py +803 -0
  59. rikune/verify/unicorn_emu.py +1827 -0
  60. rikune-2.3.3.dist-info/METADATA +314 -0
  61. rikune-2.3.3.dist-info/RECORD +64 -0
  62. rikune-2.3.3.dist-info/WHEEL +4 -0
  63. rikune-2.3.3.dist-info/entry_points.txt +2 -0
  64. rikune-2.3.3.dist-info/licenses/LICENSE +21 -0
rikune/__init__.py ADDED
@@ -0,0 +1,7 @@
1
+ """Rikune v2 — Verified reverse-engineering core engine."""
2
+
3
+ from __future__ import annotations
4
+
5
+ __version__ = "2.3.3"
6
+
7
+ __all__ = ["__version__"]
@@ -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
+ ]
@@ -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()}