fix: add missing imports to headless CLI case and extract modules#11
Open
gheylen wants to merge 1 commit into
Open
fix: add missing imports to headless CLI case and extract modules#11gheylen wants to merge 1 commit into
gheylen wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Both
lockknife_headless_cli/case.pyandlockknife_headless_cli/extract.pyuse asys.modules[__name__]injection pattern — they pass themselves asclito theirregister()sub-modules, which then call functions viacli.xxx. However, neither module imported the functions those sub-modules call, causingAttributeErrorat runtime.Errors before this fix:
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 fromlockknife.core.case,lockknife.core.custody,lockknife.core.output,lockknife.core.serialize,lockknife.modules._case_enrichment_orchestrator, andlockknife_headless_cli._case_cli_helpersthat_case_cli_core,_case_cli_queries, and_case_cli_enrichmentall call viacli.xxx.extract.py— imports fromlockknife.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_misccall viacli.xxx.Testing
Verified
lockknife case init,lockknife case enrich,lockknife extract all,lockknife extract sms, and related commands run withoutAttributeErrorafter this fix.Notes
The same pattern exists in
apk.py,intel.py, andai.py— those may need the same treatment if their sub-modules reference functions viacli.xxx.