Skip to content

Latest commit

 

History

History
194 lines (166 loc) · 3.84 KB

ARCHITECTURE.md

File metadata and controls

194 lines (166 loc) · 3.84 KB

Architecture

hzltfw uses a small core with normalized artifacts. Plugins perform analysis but do not own persistence or UI.

Package Layout

src/hzltfw/
  cli.py
  app.py
  core/
    config.py
    database.py
    exceptions.py
    external_probe.py
    external_tools.py
    handoff.py
    models.py
    plugin.py
    records.py
    report.py
    runner.py
    scanner.py
    workspace.py
  plugins/
    archive_index.py
    external_forensics.py
    file_type.py
    hash_manifest.py
    keyword_search.py
    metadata_extract.py
  ui/
    artifact_views.py
    pages/
      analysis.py
      artifacts.py
      cases.py
      evidence.py
      reports.py
  utils/
    hashing.py
    i18n.py
    timestamps.py

Data Flow

  1. User creates a case.
  2. User adds evidence from a file or directory.
  3. Core scanner indexes files into evidence_files.
  4. Runner creates plugin_runs.
  5. Plugins receive normalized evidence and file records.
  6. Plugins return ArtifactCreate objects.
  7. Runner persists artifacts and marks plugin status.
  8. UI and reports read artifacts through common fields and data_json.

For Windows image or E01-based exercises, the Evidence page can call the handoff/intake helper to inspect an already exported directory and identify recognizable Windows evidence sources. It does not mount or parse disk images directly.

Tables

cases
- id
- case_no
- name
- investigator
- description
- created_at

evidence_items
- id
- case_id
- name
- source_path
- stored_path
- evidence_type
- size_bytes
- md5
- sha1
- sha256
- added_at
- operator
- metadata_json

evidence_files
- id
- evidence_id
- relative_path
- absolute_path
- virtual_path
- size_bytes
- mtime
- ctime
- sha256
- detected_type
- extension
- is_virtual
- parent_archive_path
- metadata_json

plugin_runs
- id
- case_id
- evidence_id
- plugin_name
- plugin_version
- status
- started_at
- finished_at
- error_message
- config_json

artifacts
- id
- case_id
- evidence_id
- plugin_run_id
- artifact_type
- title
- summary
- source_path
- timestamp
- severity
- is_key
- tags_json
- data_json
- created_at

Artifact Design

Artifacts have stable common columns for search, report generation, and timeline generation. Plugin-specific data belongs in data_json.

Example:

{
  "artifact_type": "hash.manifest",
  "title": "Evidence hash manifest",
  "summary": "Hashed 12 files",
  "source_path": null,
  "timestamp": null,
  "severity": "info",
  "data": {
    "file_count": 12,
    "total_size": 10240
  }
}

Plugin Contracts

There are two plugin kinds:

  • EvidencePlugin: analyzes an evidence item and the full indexed file list.
  • FilePlugin: declares supports(file) and analyzes matching files.

Plugins must return ArtifactCreate values. They must not write to the database or call the GUI.

The default built-in plugin run covers file hashes, extension mismatch warnings, regex-based keyword search, ZIP archive indexing, and image/PDF/DOCX metadata. External ALEAPP/iLEAPP/Hindsight adapters are launched manually from the Analysis page.

External adapters still follow the plugin contract: they do not persist directly or call the GUI. They run configured local commands, store outputs in the case workspace, and return normalized external.report / external.highlight artifacts.

Runner Behavior

  • Each selected plugin gets a plugin_runs row.
  • A plugin failure marks only that plugin run as failed.
  • Other plugins continue.
  • The runner is the only layer that persists artifacts.

Report Structure

Markdown reports use this fixed structure:

  1. Case information
  2. Evidence information
  3. Tool run records
  4. Key findings
  5. Timeline
  6. Detailed results
  7. Appendix

The full file manifest is optional because it can be large. Report bundles add a portable directory layout with report.md and copied external tool outputs under external/<tool>/<run-id>/.