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:2akouwu Reverify Verifier

From Leeroopedia
Knowledge Sources
Domains Verification, Binary_Analysis, Scoring
Last Updated 2026-10-24 12:00 GMT

Overview

Concrete tool for verifying claims about a binary against deterministic tools and scoring results with information-weighted anti-gaming metrics provided by the Reverify library.

Description

The Verifier class is the heart of Reverify. It takes binary bytes, dispatches each Claim to a deterministic checker (one per claim kind), and returns a structured verdict with evidence. It supports 20+ claim kinds: bytes_at, u16/u32/u64_at, pattern_present, string_present, instructions, emulate_result, behavior_equiv, prove_equiv, exebench, functions_equiv, protobuf_field, import_present, export_present, section_present, function_at, calls, references, reachable_from_entry.

The verify_all method verifies a batch of claims, applies dependency ordering, and calls summarize to produce the information-weighted report. The summarize function (module-level) computes per-claim weights (rarity × entropy, zeroed for trivial/duplicate/echoed/known), aggregate counts, and the grounded boolean.

The receipt method produces a replay record: binary SHA-256, engine versions, platform — everything a third party needs to reproduce the verdicts.

Usage

Import this class when you need to:

  • Verify a single claim or batch of claims about a binary (CLI verify subcommand).
  • Run the core verification in the closed reconstruction loop (called by ReconstructionAgent each round).
  • Expose verification over MCP (re_verify_claim tool).
  • Score results with information-weighted anti-gaming metrics.

Code Reference

Source Location

  • Repository: Reverify
  • File: reverify/verifier.py
  • Lines: Verifier class at L162-257; verify at L225-239; verify_all at L241-257; summarize at L1184-1235; receipt at L196-215

Signature

class Verifier:
    SUPPORTED = (
        "bytes_at", "u16_at", "u32_at", "u64_at",
        "pattern_present", "string_present", "instructions",
        "emulate_result", "behavior_equiv", "prove_equiv",
        "exebench", "functions_equiv", "protobuf_field",
        "import_present", "export_present", "section_present",
        "pe_import",  # alias of import_present
        "function_at", "calls", "references", "reachable_from_entry",
    )

    def __init__(self, data: bytes):
        ...

    def receipt(self) -> Dict[str, Any]:
        """Binary SHA-256, engine versions, platform — for replay."""

    def verify(self, claim: Claim) -> Dict[str, Any]:
        """Check a single claim and return a structured verdict."""

    def verify_all(
        self,
        claims: List[Claim],
        facts: Optional[Dict[str, Any]] = None,
        min_information: float = 1.0,
    ) -> Dict[str, Any]:
        """Check many claims, apply dependencies, and score how much they say."""


def summarize(
    results: List[Dict[str, Any]],
    facts: Optional[Dict[str, Any]] = None,
    min_information: float = 1.0,
) -> Dict[str, Any]:
    """Weight results (CORE-style) and build the report.

    Sets weight, trivial, duplicate on each result in place; the agent may
    set echoed beforehand to zero a claim that merely copied the tools'
    previous output.
    """

Import

from reverify.verifier import Verifier, Claim, summarize

I/O Contract

Inputs

Name Type Required Description
data bytes Yes Raw binary bytes (constructor)
claims List[Claim] Yes Claims to verify
facts Dict No Fact sheet the model was shown (for triviality scoring)
min_information float No Weight threshold for "informative". Default 1.0.

Outputs

Name Type Description
return Dict Report: total_claims, verified, refuted, inconclusive, observed, invalidated, grounded_ratio, information, grounded_score, trivial_verified, duplicates, echoed, known, trustworthy, informative, grounded, results (per-claim), receipt

Usage Examples

Verify a Single Claim

from reverify.verifier import Verifier, Claim

with open("target.dll", "rb") as f:
    data = f.read()

verifier = Verifier(data)
claim = Claim("bytes_at", {"offset": 0x28, "expected": "554889e5"})
result = verifier.verify(claim)
print(f"{result['verdict']}: {result['detail']}")
# VERIFIED: 4 bytes match at file offset 0x28

Verify a Batch with Scoring

from reverify.verifier import Verifier, Claim

verifier = Verifier(data)
claims = [
    Claim("bytes_at", {"offset": 0x28, "expected": "554889e5"}),
    Claim("import_present", {"name": "CreateFileW"}),
    Claim("instructions", {"offset": 0x1000, "space": "rva", "mnemonics": ["push", "mov"], "arch": "x86_64"}),
]
report = verifier.verify_all(claims, min_information=1.0)
print(f"Grounded: {report['grounded']}, Information: {report['information']}")
print(f"Verified: {report['verified']}, Refuted: {report['refuted']}")

Generate a Receipt

# The receipt is included in verify_all output; also available directly
receipt = verifier.receipt()
print(f"Binary SHA-256: {receipt['binary_sha256']}")
print(f"Engines: {receipt['engines']}")
# This can be handed to a third party to replay the verdicts

Related Pages

Implements Principle

Uses Heuristic

Requires Environment

Page Connections

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