Skip to content

stegoveritas-binwalk: capstone 5.x incompatibility (CS_ARCH_ARM64 renamed) + missing dependency #45

Open

Description

@blshkv

Problem

stegoveritas-binwalk (the bundled binwalk fork) fails to import on systems with capstone ≥ 5.0.

binwalk/modules/disasm.py references capstone.CS_ARCH_ARM64 as a class-level attribute, evaluated at import time:

Architecture(type=capstone.CS_ARCH_ARM64, ...)

In capstone 5.0, CS_ARCH_ARM64 was renamed to CS_ARCH_AARCH64. This causes an immediate AttributeError before any test or analysis runs:

AttributeError: module 'capstone' has no attribute 'CS_ARCH_ARM64'. Did you mean: 'CS_ARCH_ARM'?
  File "binwalk/modules/disasm.py", line 60

Additionally, capstone is not declared as a dependency of stegoveritas-binwalk, so it is not installed automatically.

Discovered while packaging stegoveritas for Gentoo Linux: pentoo/pentoo-overlay#2923

Fix

Add a compatibility shim at the top of binwalk/modules/disasm.py (after import capstone):

# capstone 5.x renamed CS_ARCH_ARM64 to CS_ARCH_AARCH64; support both.
_CS_ARCH_AARCH64 = getattr(capstone, 'CS_ARCH_AARCH64', None) or capstone.CS_ARCH_ARM64

Then replace both capstone.CS_ARCH_ARM64 references in ARCHITECTURES with _CS_ARCH_AARCH64.

Also add capstone to the stegoveritas-binwalk package dependencies.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions