The world's first agentic reverse engineer.
update imports
Amruthf1ef3e2eeac0
diff --git a/kong/__main__.py b/kong/__main__.pyindex 294e41f..9eb59df 100644--- a/kong/__main__.py+++ b/kong/__main__.py@@ -11,6 +11,8 @@ from rich.markup import escapefrom kong import __version__from kong.config import GhidraConfig, KongConfig, OutputConfig+from kong.ghidra.client import GhidraClient, GhidraClientError+from collections import Counterconsole = Console()@@ -79,8 +81,6 @@ def analyze()raise SystemExit(1)- from kong.ghidra.client import GhidraClient, GhidraClientError-try:with console.status("[bold green]Opening binary in Ghidra (this may take 30-60s on first run) ...",@@ -106,9 +106,8 @@ def analyze(f"{len(functions) - thunks} to analyze")- # TODO: Phase 2-4 — Agent loop (Session 2+)- console.print("\n[yellow]Agent loop not yet implemented.[/yellow]")- console.print("[dim]Session 1 complete — Ghidra integration verified.[/dim]")+ # TODO: agent loop+ console.print("\n[yellow]done")client.close()@@ -118,8 +117,7 @@ def analyze(@click.option("--ghidra-dir", default=None, help="Ghidra installation directory.")def info(binary: str, ghidra_dir: str | None) -> None:"""Show info about a binary."""- from kong.ghidra.client import GhidraClient, GhidraClientError-+ghidra_config = GhidraConfig(install_dir=ghidra_dir)if not ghidra_config.install_dir:console.print("[red]Ghidra is not installed or not found.[/red]")@@ -148,7 +146,6 @@ def info(binary: str, ghidra_dir: str | None) -> None:console.print(f"[bold]Functions:[/bold] {len(functions)}")# Classification breakdown- from collections import Countercounts = Counter(f.classification.value for f in functions if f.classification)for cls, count in sorted(counts.items()):console.print(f" {cls}: {count}")diff --git a/kong/config.py b/kong/config.pyindex 054b703..020a9b3 100644--- a/kong/config.py+++ b/kong/config.py@@ -4,6 +4,7 @@ from __future__ import annotationsfrom dataclasses import dataclass, fieldfrom pathlib import Path+from kong.ghidra.environment import find_ghidra_install@dataclass@@ -14,8 +15,6 @@ class GhidraConfig:def __post_init__(self) -> None:if self.install_dir is None:- from kong.ghidra.environment import find_ghidra_install-self.install_dir = find_ghidra_install()diff --git a/kong/ghidra/client.py b/kong/ghidra/client.pyindex 1c42fd3..c1b8c5b 100644--- a/kong/ghidra/client.py+++ b/kong/ghidra/client.py@@ -21,6 +21,8 @@ from kong.ghidra.types import (VariableInfo,XRef,)+from kong.ghidra.environment import find_ghidra_install+logger = logging.getLogger(__name__)@@ -54,7 +56,6 @@ class GhidraClient:def __init__(self, binary_path: str, install_dir: str | None = None) -> None:self.binary_path = str(Path(binary_path).resolve())if install_dir is None:- from kong.ghidra.environment import find_ghidra_installinstall_dir = find_ghidra_install()self.install_dir = install_dirself._program: Any = None