flag_capturer
Point it at a file, a folder or a string and it digs out CTF flags, peeling off
layers of encoding until something looks like flag{...}. Every hit shows the
path it took.
$ flag_capturer challenge.bin
[binary] challenge.bin
[+] flag{x0r_1s_n0t_encrypt10n}
challenge.bin via strings -> base64 -> xor(0x12)
Install
pip install flag-capturer
No admin rights? Use pip install --user flag-capturer. Then run
flag_capturer (or the short flagcap). If the command is not found,
python -m flag_capturer always works.
Use
flag_capturer # everything in the current folder
flag_capturer file.bin # one file
flag_capturer ./challenge_folder # every file in a folder
flag_capturer -s "ZmxhZ3toaX0=" # a string
cat dump.txt | flag_capturer # stdin
flag_capturer file -p DUCTF -p picoCTF # extra flag prefixes (name only)
flag_capturer file -r "SECRET-[0-9]{6}" # your own regex
flag_capturer file --loose # also show anything shaped like WORD{...}
flag_capturer file --json # for scripts
flag_capturer challenge.exe -e # Ghidra steps and a CyberChef recipe under each hit
-e / --explain records the winning path's byte ranges and known addresses.
Load the original input into CyberChef to apply the printed recipe. Specialized
steps include manual or Python instructions. With --json --explain, each hit
also has steps and cyberchef (null when the complete path needs manual work).
Built-in prefixes: flag, anything ending in CTF, HTB, THM. Flags with
other prefixes are still listed as [?] suggestions.
中文快速上手
在资源管理器打开题目文件夹,地址栏输入 powershell 回车,然后运行
python -m flag_capturer .(点号 = 当前文件夹)。flag 前缀不常见的话加
-p 前缀名。PowerShell 出现 >> 时按 Ctrl+C 退出。
What it handles
Encodings and layers (stacked up to depth 5)
- ASCII and UTF-16 strings inside binaries
- base64 / base64url / base32 / base85 / ascii85, hex, binary, decimal, octal, URL encoding
- rot13 and every other Caesar shift, rot47, reversed text
- single-byte XOR (all 255 keys, pre-filtered against known prefixes)
- gzip / zlib / bz2 / lzma streams and zip archives
- base64/hex/binary-looking chunks cut out of longer text
File formats (the detected format is printed before each scan)
- Windows PE (MinGW x64): constant arrays and split comparison fragments, repeating-key XOR on Base64 text, byte subtraction on flag-shaped text
- Dropped PowerShell IOC puzzles: recognizes an indexed-XOR decoder feeding
a script and a NUL-separated configuration. Tracks the buffer and byte count
passed to a
WriteFilewrapper and the configuration field passed to anInternetConnectAwrapper. Formats the first 16 SHA-256 hex digits of the written bytes, host and original assembly-load method spelling as a candidate. - Deterministic aim puzzles: recognizes a 64-bit linear congruential target generator, two coordinate ranges, a multiply-XOR coordinate hash (XOR before multiplication), and a three-shift XOR release loop. Replays the target centers using constants from the image and checks the resulting flag syntax.
- .NET assemblies: IL string literals, including adjacent literals joined by
String.Concat; read statically, never executed - PCAP / PCAPNG: UDP payloads and reassembled TCP streams per direction (no TLS decryption or IP fragment reassembly)
- Linux ELF x86-64: literal IPv4 addresses passed to
connect, built on the stack or read from read-only data; also from Ghidra text listings - Intel assembly listings: little-endian immediates
Limits
Runtime-derived candidates require a recognized computation and recoverable inputs. The two native rules above recognize specific MinGW x64 instruction patterns and use PE unwind information to locate functions. Compiler changes, different algorithms, or inputs supplied by a remote service can require manual analysis. Each result includes the extraction path.
Extending
Implement formats.base.Analyzer (identify and extract) and register the
instance in formats.FORMATS. Each extracted Part carries its bytes and
provenance; set nested=True for embedded files that should be identified again.
For an additional native PE puzzle family, implement recognizes(data) and
extract(image) and register the rule in formats.pe_rules.RULES. The rules
share a static image reader, import names and disassembled functions.
Play fair
Use it on CTFs and practice boxes that allow tools. If a competition or exam says no automated tools, leave it at home.
License
PolyForm Strict 1.0.0: free to install and use for noncommercial purposes, but
no redistribution and no modified versions. See LICENSE.
Metadata
Release files for flag-capturer 0.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| flag_capturer-0.5.1.tar.gz | 43.4 kB | Without provenance | Details for flag_capturer-0.5.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| flag_capturer-0.5.1-py3-none-any.whl | Python 3 | none | any | Details for flag_capturer-0.5.1-py3-none-any.whl |
Total release size: 83.0 kB
Release files / flag_capturer-0.5.1.tar.gz
| Download URL | flag_capturer-0.5.1.tar.gz |
|---|---|
| Size | 43.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d640612e143979e21eeefa045c8834c0299f375b2714d8f89792cdf95e1b2d40
|
|
BLAKE2b-256 checksum How to use checksums |
c87cbcd63e7fedd8d36b12f120ee530aedbaf6eb3d6d6ae014494cfdf3083399
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|
Release files / flag_capturer-0.5.1-py3-none-any.whl
| Download URL | flag_capturer-0.5.1-py3-none-any.whl |
|---|---|
| Size | 39.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c874f368e1f8dda70b96fcc31d334ec65893b747d47d26b3c50bc3e03f3825e5
|
|
BLAKE2b-256 checksum How to use checksums |
a8b5285669d80c789a4c342d92c0dde54ff476997f3d0869fa8625da550e494f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|
Security for flag-capturer 0.5.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.