codevanta 0.1.0__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.
- codevanta/__init__.py +1 -0
- codevanta/analysis/__init__.py +1 -0
- codevanta/analysis/binary_diff.py +1168 -0
- codevanta/analysis/callgraph.py +542 -0
- codevanta/analysis/cfg.py +1201 -0
- codevanta/analysis/dataflow.py +762 -0
- codevanta/analysis/debugger.py +289 -0
- codevanta/analysis/debuginfo.py +304 -0
- codevanta/analysis/decompile.py +1094 -0
- codevanta/analysis/decompilers/__init__.py +250 -0
- codevanta/analysis/decompilers/angr_backend.py +251 -0
- codevanta/analysis/decompilers/base.py +278 -0
- codevanta/analysis/decompilers/ghidra_backend.py +316 -0
- codevanta/analysis/dynamic.py +756 -0
- codevanta/analysis/emulate.py +1349 -0
- codevanta/analysis/evidence_bundle.py +736 -0
- codevanta/analysis/function_hash.py +562 -0
- codevanta/analysis/graph_export.py +441 -0
- codevanta/analysis/html_view.py +695 -0
- codevanta/analysis/jump_tables.py +546 -0
- codevanta/analysis/solver.py +715 -0
- codevanta/analysis/symbolic.py +1809 -0
- codevanta/analysis/trace.py +646 -0
- codevanta/analysis/type_propagation.py +1055 -0
- codevanta/analysis/type_recovery.py +1214 -0
- codevanta/analysis/vtables.py +572 -0
- codevanta/analysis/xrefs.py +434 -0
- codevanta/api/__init__.py +1 -0
- codevanta/cli/__init__.py +1 -0
- codevanta/cli/main.py +3038 -0
- codevanta/core/__init__.py +31 -0
- codevanta/core/disassembler.py +121 -0
- codevanta/core/entropy.py +237 -0
- codevanta/core/functions.py +176 -0
- codevanta/core/loader.py +1351 -0
- codevanta/core/report.py +306 -0
- codevanta/core/strings.py +109 -0
- codevanta/evidence/__init__.py +7 -0
- codevanta/evidence/confidence.py +36 -0
- codevanta/evidence/models.py +43 -0
- codevanta/evidence/provenance.py +37 -0
- codevanta/gui/__init__.py +46 -0
- codevanta/gui/layout.py +1384 -0
- codevanta/gui/server.py +1305 -0
- codevanta/ir/__init__.py +6 -0
- codevanta/ir/adapters/__init__.py +31 -0
- codevanta/ir/base.py +31 -0
- codevanta/ir/instruction.py +42 -0
- codevanta/mcp_server/__init__.py +5 -0
- codevanta/mcp_server/server.py +710 -0
- codevanta/mcp_server/tools.py +1364 -0
- codevanta/plugins/__init__.py +748 -0
- codevanta/setup/__init__.py +28 -0
- codevanta/setup/apply.py +22 -0
- codevanta/setup/clients.py +285 -0
- codevanta/setup/plan.py +79 -0
- codevanta/setup/verify.py +43 -0
- codevanta/storage/__init__.py +1 -0
- codevanta/storage/session.py +514 -0
- codevanta-0.1.0.dist-info/METADATA +688 -0
- codevanta-0.1.0.dist-info/RECORD +65 -0
- codevanta-0.1.0.dist-info/WHEEL +5 -0
- codevanta-0.1.0.dist-info/entry_points.txt +2 -0
- codevanta-0.1.0.dist-info/licenses/LICENSE +21 -0
- codevanta-0.1.0.dist-info/top_level.txt +1 -0
codevanta/ir/__init__.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"""Registry for IR adapters. Concrete adapters arrive in phase 4."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from ..base import IRAdapter
|
|
6
|
+
|
|
7
|
+
_ADAPTERS: dict[str, type[IRAdapter]] = {}
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def register_adapter(adapter_cls: type[IRAdapter]) -> type[IRAdapter]:
|
|
11
|
+
"""Register an adapter class under its ``name`` attribute."""
|
|
12
|
+
if not adapter_cls.name or adapter_cls.name == "base":
|
|
13
|
+
raise ValueError("adapter must define a unique non-'base' name")
|
|
14
|
+
_ADAPTERS[adapter_cls.name] = adapter_cls
|
|
15
|
+
return adapter_cls
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def available_adapters() -> list[str]:
|
|
19
|
+
"""Return the names of all registered adapters."""
|
|
20
|
+
return sorted(_ADAPTERS)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def get_adapter(name: str) -> IRAdapter:
|
|
24
|
+
"""Instantiate a registered adapter by name."""
|
|
25
|
+
try:
|
|
26
|
+
return _ADAPTERS[name]()
|
|
27
|
+
except KeyError as exc:
|
|
28
|
+
raise KeyError(f"Unknown IR adapter: {name!r}") from exc
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
__all__ = ["register_adapter", "available_adapters", "get_adapter"]
|
codevanta/ir/base.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"""IR adapter contract for future lifting backends (VEX, P-Code, ...)."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from abc import ABC, abstractmethod
|
|
6
|
+
from collections.abc import Iterable, Sequence
|
|
7
|
+
from typing import Any
|
|
8
|
+
|
|
9
|
+
from .instruction import IRInstruction
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class IRAdapter(ABC):
|
|
13
|
+
"""Base class for instruction lifting backends.
|
|
14
|
+
|
|
15
|
+
Adapters convert structural instructions into an intermediate
|
|
16
|
+
representation. Phase 1 ships no concrete adapter; the contract keeps the
|
|
17
|
+
core engine independent from any specific IR.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
name: str = "base"
|
|
21
|
+
|
|
22
|
+
@abstractmethod
|
|
23
|
+
def lift(self, instruction: IRInstruction) -> Sequence[dict[str, Any]]:
|
|
24
|
+
"""Lift one instruction into IR operations."""
|
|
25
|
+
|
|
26
|
+
def lift_many(self, instructions: Iterable[IRInstruction]) -> list[dict[str, Any]]:
|
|
27
|
+
"""Lift several instructions, preserving their order."""
|
|
28
|
+
lifted: list[dict[str, Any]] = []
|
|
29
|
+
for instruction in instructions:
|
|
30
|
+
lifted.extend(self.lift(instruction))
|
|
31
|
+
return lifted
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"""Normalized instruction model shared by all IR adapters."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from dataclasses import dataclass, field
|
|
6
|
+
from typing import Any
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@dataclass(frozen=True)
|
|
10
|
+
class IRInstruction:
|
|
11
|
+
"""A single decoded instruction in a backend-neutral form.
|
|
12
|
+
|
|
13
|
+
Phase 1 fills the structural fields only (address, size, mnemonic,
|
|
14
|
+
operands, raw bytes). ``ir_ops`` stays empty until an adapter (VEX,
|
|
15
|
+
P-Code, custom) lifts the instruction in a later phase.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
address: int
|
|
19
|
+
size: int
|
|
20
|
+
mnemonic: str
|
|
21
|
+
operands: str
|
|
22
|
+
raw_bytes: bytes
|
|
23
|
+
section: str | None = None
|
|
24
|
+
ir_ops: tuple[dict[str, Any], ...] = field(default_factory=tuple)
|
|
25
|
+
|
|
26
|
+
@property
|
|
27
|
+
def text(self) -> str:
|
|
28
|
+
"""Return ``"mnemonic operands"`` (or just the mnemonic)."""
|
|
29
|
+
return f"{self.mnemonic} {self.operands}".strip()
|
|
30
|
+
|
|
31
|
+
def to_dict(self) -> dict[str, Any]:
|
|
32
|
+
data: dict[str, Any] = {
|
|
33
|
+
"address": f"0x{self.address:x}",
|
|
34
|
+
"size": self.size,
|
|
35
|
+
"bytes": self.raw_bytes.hex(),
|
|
36
|
+
"mnemonic": self.mnemonic,
|
|
37
|
+
"operands": self.operands,
|
|
38
|
+
"text": self.text,
|
|
39
|
+
}
|
|
40
|
+
if self.section:
|
|
41
|
+
data["section"] = self.section
|
|
42
|
+
return data
|