Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:416rehman DeepZero HashExclude

From Leeroopedia
Knowledge Sources
Domains Filtering, Map
Last Updated 2026-10-27 00:00 GMT

Overview

Built-in MapProcessor that excludes samples whose hash matches a known exclusion set, with optional deduplication to remove duplicate hashes within a single run.

Description

The HashExclude class is a built-in MapProcessor (registered as hash_exclude) that filters samples based on cryptographic hashes. During setup, it loads the exclusion hash set from two sources:

  • inline hashes: a list of hash strings directly in the config.
  • hash_file: a file with one hash per line (lines starting with # are comments).

All hashes are normalized to lowercase. During process, the stage reads the configured hash_field (default sha256) from upstream stage output data. If dedup is enabled, it also tracks seen hashes and filters duplicates within the run.

Samples whose hash is in the exclusion set return ProcessorResult.filter("hash in exclusion list"); duplicates return ProcessorResult.filter("duplicate {hash_field}"); all others return ProcessorResult.ok().

Usage

  • Skipping known-benign drivers: load the loldrivers.io hash list via hash_file.
  • Deduplicating a corpus by SHA-256: dedup: true.
  • Inline exclusion of specific hashes: hashes: ["abc123...", "def456..."].
  • Custom hash field: hash_field: "md5".

Code Reference

Source Location

Signature

class HashExclude(MapProcessor):
    description = "hash-based exclusion filter - skips samples whose hash matches a known set"

    def __init__(self, spec: StageSpec): ...

    def setup(self, global_config: dict[str, Any]) -> None: ...

    def process(self, ctx: ProcessorContext, entry: ProcessorEntry) -> ProcessorResult: ...

Import

from deepzero.stages.hash_filter import HashExclude

I/O Contract

Inputs

Name Type Required Description
hashes list[str] No (config) Inline exclusion hashes
hash_file str No (config) Path to file with one hash per line
hash_field str No (config) Upstream data key holding the hash (default "sha256")
dedup bool No (config) Also filter duplicate hashes within the run
entry.history dict Yes (runtime) Upstream stage outputs containing the hash field

Outputs

Name Type Description
returns ProcessorResult ok() if hash not excluded and not a duplicate, filter(reason) otherwise

Usage Examples

Exclude Known-Benign Drivers

stages:
  - name: file_discovery
    processor: file_discovery
    config:
      extensions: ["sys"]
  - name: exclude_known
    processor: hash_exclude
    config:
      hash_file: "./known_benign_hashes.txt"
      hash_field: sha256

Dedup by SHA-256

# Remove duplicate samples by hash within a single run
stages:
  - name: dedup
    processor: hash_exclude
    config:
      dedup: true
      hash_field: sha256

Inline Exclusion with Dedup

stages:
  - name: filter_hashes
    processor: hash_exclude
    config:
      hashes:
        - "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
        - "abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890"
      dedup: true
      hash_field: sha256

Hash File Format

# known_benign_hashes.txt
# Lines starting with # are comments
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890

Related Pages

Implements Principle

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment