Skip to content

meltedinhex/analyst-ai-pack / skills/extracting-encryption-keys-from-binaries

extracting-encryption-keys-from-binaries

Verified

Locates candidate encryption keys in a binary by finding high-entropy fixed-size regions (16/24/32 bytes) near cryptographic constants or crypto API references, and surfacing printable key/passphrase strings. Activates for requests to extract encryption keys, find an AES key in a sample, or recover hardcoded crypto material.

FileKindSize
LICENSEother340 B
SKILL.mdskill md2.8 KB
references/api-reference.mdmarkdown1.3 KB
scripts/analyst.pyscript2.5 KB

references/api-reference.md

View on GitHub
# API Reference: Extracting Encryption Keys From Binaries

## Overview

`scripts/analyst.py` surfaces candidate encryption keys: it finds key-sized (16/24/32-byte)
high-entropy, high-diversity regions and extracts printable hex (32–64 chars) and base64 (24–44
chars) strings matching common key lengths. It reads bytes statically and executes nothing.
Entropy is a heuristic — confirm by decryption.

## Dependencies

| Package | Version | Purpose |
|---------|---------|---------|
| (stdlib) | — | math, regex, Counter, JSON |

## Core functions

### `keys(path)`
Returns high-entropy key candidates (offset/size/entropy/hex), hex-string keys, and base64-string
keys.

### `_high_entropy_regions(data)`
Sliding-window search requiring near-maximal byte diversity to reduce false positives.

## Tuning

- `KEY_SIZES = (16, 24, 32)` for AES-128/192/256.
- `ENTROPY_THRESHOLD` over short windows; raise to reduce noise on packed binaries.

## Usage

```bash
python scripts/analyst.py keys sample.bin
```

## Sources

- FIPS 197 (AES key sizes 128/192/256) — https://csrc.nist.gov/publications/detail/fips/197/final
- MITRE ATT&CK T1573 Encrypted Channel — https://attack.mitre.org/techniques/T1573/
- High-entropy key-region heuristic from public key-recovery research; confirm by decryption
receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementationStars: 322kUpdated Claude CodeCodexVerifiedInstall
requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirementsStars: 322kUpdated Claude CodeCodexVerifiedInstall
using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallbackStars: 322kUpdated Claude CodeCodexVerifiedInstall
verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions alwaysStars: 322kUpdated Claude CodeCodexVerifiedInstall