Skip to content

fix: add missing imports to headless CLI case and extract modules#11

Open
gheylen wants to merge 1 commit into
ImKKingshuk:mainfrom
gheylen:fix/headless-cli-missing-imports
Open

fix: add missing imports to headless CLI case and extract modules#11
gheylen wants to merge 1 commit into
ImKKingshuk:mainfrom
gheylen:fix/headless-cli-missing-imports

Conversation

@gheylen

@gheylen gheylen commented May 5, 2026

Copy link
Copy Markdown

Problem

Both lockknife_headless_cli/case.py and lockknife_headless_cli/extract.py use a sys.modules[__name__] injection pattern — they pass themselves as cli to their register() sub-modules, which then call functions via cli.xxx. However, neither module imported the functions those sub-modules call, causing AttributeError at runtime.

Errors before this fix:

AttributeError: module 'lockknife_headless_cli.case' has no attribute 'create_case_workspace'
AttributeError: module 'lockknife_headless_cli.extract' has no attribute 'extract_sms'

This meant lockknife case init, lockknife extract all, and all dependent commands crashed immediately on invocation.

Fix

Added the missing imports to both modules:

case.py — imports from lockknife.core.case, lockknife.core.custody, lockknife.core.output, lockknife.core.serialize, lockknife.modules._case_enrichment_orchestrator, and lockknife_headless_cli._case_cli_helpers that _case_cli_core, _case_cli_queries, and _case_cli_enrichment all call via cli.xxx.

extract.py — imports from lockknife.core.case, lockknife.core.output, and all extraction modules (_browser_extract_chrome, _browser_extract_firefox, call_logs, contacts, location, media, messaging, sms) that _extract_basic, _extract_all, _extract_browser, _extract_messaging, and _extract_misc call via cli.xxx.

Testing

Verified lockknife case init, lockknife case enrich, lockknife extract all, lockknife extract sms, and related commands run without AttributeError after this fix.

Notes

The same pattern exists in apk.py, intel.py, and ai.py — those may need the same treatment if their sub-modules reference functions via cli.xxx.

Both lockknife_headless_cli/case.py and extract.py use sys.modules[__name__]
to inject themselves as 'cli' into their register() sub-modules, but were
missing all the imports those sub-modules call via cli.xxx. Adds the required
imports from lockknife.core and lockknife.modules so case init, extract all,
and all dependent commands work correctly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant