|
1 | | -# packpeek |
2 | | - |
3 | | -**Static packer / loader fingerprinter (C)** — is this binary packed, and by what? |
4 | | - |
5 | | -[](https://github.com/cognis-digital/packpeek/actions/workflows/ci.yml) |
6 | | - |
7 | | - |
8 | | - |
9 | | -Part of the **[Cognis Neural Suite](https://github.com/cognis-digital)**. The classic first step in malware triage: `packpeek` searches a binary for the documented markers of common runtime packers/protectors — **UPX, ASPack, Themida, WinLicense, MPRESS, PECompact, Petite, FSG, MEW, NsPack, Enigma, VMProtect, Armadillo** — and measures **Shannon entropy**. A packer marker plus high entropy is a strong "this is packed, look closer" signal. |
10 | | - |
11 | | -Format-agnostic (PE / ELF / Mach-O / firmware blob), dependency-free, JSON-out. Pairs with [`entroc`](https://github.com/cognis-digital/entroc) for windowed entropy and emits **YARA + SARIF** via the bundled companion. |
12 | | - |
13 | | -> Defensive triage only — reads a file, makes no network calls, executes nothing. |
14 | | -
|
15 | | -## Build |
16 | | - |
17 | | -```bash |
18 | | -gcc -O2 -std=c99 -o packpeek packpeek.c -lm |
19 | | -``` |
20 | | - |
21 | | -## Usage |
22 | | - |
23 | | -``` |
24 | | -packpeek <file> [--threshold F] |
25 | | - --threshold entropy (bits, 0..8) above which a file is "high entropy" (default 7.2) |
26 | | -``` |
27 | | - |
28 | | -```bash |
29 | | -packpeek suspicious.exe |
30 | | -packpeek suspicious.exe | python sarif.py # -> SARIF for code scanning |
31 | | -packpeek suspicious.exe | python sarif.py --yara # -> deployable YARA rule |
32 | | -``` |
33 | | - |
34 | | -## Output |
35 | | - |
36 | | -```json |
37 | | -{"tool":"packpeek","file":"suspicious.exe","size":204800,"entropy":7.91, |
38 | | - "high_entropy":true,"threshold":7.20, |
39 | | - "packers":[{"name":"UPX","offset":336}],"packer_count":1,"verdict":"packed"} |
40 | | -``` |
41 | | - |
42 | | -Exit **2** if `packed`/`likely-packed`, **0** if `clean`, **1** on error — gate CI on it. |
43 | | - |
44 | | -## License |
45 | | - |
46 | | -COCL 1.0 — see [LICENSE](LICENSE). Commercial use → licensing@cognis.digital |
| 1 | +# packpeek |
| 2 | + |
| 3 | +**Static packer / loader fingerprinter (C)** — is this binary packed, and by what? |
| 4 | + |
| 5 | +[](https://github.com/cognis-digital/packpeek/actions/workflows/ci.yml) |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | +Part of the **[Cognis Neural Suite](https://github.com/cognis-digital)**. The classic first step in malware triage: `packpeek` searches a binary for the documented markers of common runtime packers/protectors — **UPX, ASPack, Themida, WinLicense, MPRESS, PECompact, Petite, FSG, MEW, NsPack, Enigma, VMProtect, Armadillo** — and measures **Shannon entropy**. A packer marker plus high entropy is a strong "this is packed, look closer" signal. |
| 10 | + |
| 11 | +Format-agnostic (PE / ELF / Mach-O / firmware blob), dependency-free, JSON-out. Pairs with [`entroc`](https://github.com/cognis-digital/entroc) for windowed entropy and emits **YARA + SARIF** via the bundled companion. |
| 12 | + |
| 13 | +> Defensive triage only — reads a file, makes no network calls, executes nothing. |
| 14 | +
|
| 15 | + |
| 16 | +<!-- cognis:example:start --> |
| 17 | +## 🔎 Example output |
| 18 | + |
| 19 | +**Sample result format** _(illustrative values — run on your own data for real findings):_ |
| 20 | + |
| 21 | +``` |
| 22 | +{ |
| 23 | +"packs": [ |
| 24 | + { |
| 25 | + "id": "1234567890", |
| 26 | + "name": "Pack 1", |
| 27 | + "size": 100, |
| 28 | + "weight": 5.2, |
| 29 | + "contents": [ |
| 30 | + {"item": "Item A", "quantity": 3}, |
| 31 | + {"item": "Item B", "quantity": 2} |
| 32 | + ] |
| 33 | + }, |
| 34 | + { |
| 35 | + "id": "2345678901", |
| 36 | + "name": "Pack 2", |
| 37 | + "size": 50, |
| 38 | + "weight": 2.8, |
| 39 | + "contents": [ |
| 40 | + {"item": "Item C", "quantity": 4}, |
| 41 | + {"item": "Item D", "quantity": 1} |
| 42 | + ] |
| 43 | + } |
| 44 | +] |
| 45 | +} |
| 46 | +``` |
| 47 | + |
| 48 | +<!-- cognis:example:end --> |
| 49 | + |
| 50 | +## Build |
| 51 | + |
| 52 | +```bash |
| 53 | +gcc -O2 -std=c99 -o packpeek packpeek.c -lm |
| 54 | +``` |
| 55 | + |
| 56 | +## Usage |
| 57 | + |
| 58 | +``` |
| 59 | +packpeek <file> [--threshold F] |
| 60 | + --threshold entropy (bits, 0..8) above which a file is "high entropy" (default 7.2) |
| 61 | +``` |
| 62 | + |
| 63 | +```bash |
| 64 | +packpeek suspicious.exe |
| 65 | +packpeek suspicious.exe | python sarif.py # -> SARIF for code scanning |
| 66 | +packpeek suspicious.exe | python sarif.py --yara # -> deployable YARA rule |
| 67 | +``` |
| 68 | + |
| 69 | +## Output |
| 70 | + |
| 71 | +```json |
| 72 | +{"tool":"packpeek","file":"suspicious.exe","size":204800,"entropy":7.91, |
| 73 | + "high_entropy":true,"threshold":7.20, |
| 74 | + "packers":[{"name":"UPX","offset":336}],"packer_count":1,"verdict":"packed"} |
| 75 | +``` |
| 76 | + |
| 77 | +Exit **2** if `packed`/`likely-packed`, **0** if `clean`, **1** on error — gate CI on it. |
| 78 | + |
| 79 | +## License |
| 80 | + |
| 81 | +COCL 1.0 — see [LICENSE](LICENSE). Commercial use → licensing@cognis.digital |
0 commit comments