Skip to main content

flag_capturer

Point it at a file or a string and it digs out CTF flags, peeling off layers of encoding until something looks like flag{...}. Pure Python, no dependencies.

$ flag_capturer challenge.bin
[+] flag{x0r_1s_n0t_encrypt10n}
    challenge.bin  via  strings -> base64 -> xor(0x12)

Install

pip install --user git+https://github.com/icanseethejupiter/ctf_tool_kit
# no git on the machine? grab the zip instead:
pip install --user https://github.com/icanseethejupiter/ctf_tool_kit/archive/refs/heads/main.zip

Then run flag_capturer (or the short flagcap). If the command is not found, python -m flag_capturer always works.

Use

在 Windows 资源管理器打开题目文件夹,在地址栏输入 powershell 并回车。运行:

python -m flag_capturer .

点号表示扫描当前文件夹及其子文件夹。只扫一个文件可以用 python -m flag_capturer .\dist1.exe。默认识别 flag、CTF 类前缀、HTB 和 THM。自定义前缀只写名字,如 -p MYTEAM。PowerShell 出现 >> 时按 Ctrl+C 回到命令行。

The static scanner recognizes several MinGW x64 comparison layouts, including checks on separate slices of the input, repeating-key XOR with a known flag prefix, and small integer arrays. It also tries little-endian literals in Intel assembly listings. A hit is a candidate recovered from file contents.

flag_capturer                          # everything in the current folder
flag_capturer file.bin                 # a 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
flag_capturer file -r "SECRET-[0-9]{6}"  # your own regex
flag_capturer file --json              # for scripts

What it tries

  • printable ASCII and UTF-16 strings inside binaries
  • base64 / base64url / base32 / base85 / ascii85, hex, binary, decimal, octal, URL encoding
  • rot13 plus every other Caesar shift, rot47, reversed text
  • single-byte XOR (all 255 keys, checked cheaply against known prefixes first)
  • PE data arrays following a short, zero-padded key on a 16-byte boundary. The scanner tries repeating-key XOR on Base64 text and byte subtraction on flag-shaped text.
  • gzip / zlib / bz2 / lzma streams and zip archives
  • cutting base64/hex/binary-looking chunks out of longer text and trying them alone

Layers stack (default depth 5), and each hit shows the path it took.

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.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flag-capturer 0.1.6
File Size Uploaded Provenance Actions
flag_capturer-0.1.6.tar.gz 16.1 kB Without provenance Details for flag_capturer-0.1.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for flag-capturer 0.1.6
File Interpreter ABI Platform Actions
flag_capturer-0.1.6-py3-none-any.whl Python 3 none any Details for flag_capturer-0.1.6-py3-none-any.whl

Total release size: 31.5 kB

Release files / flag_capturer-0.1.6.tar.gz

Download URL flag_capturer-0.1.6.tar.gz
Size 16.1 kB
Tags Source
SHA-256 checksum
How to use checksums
7dd50eadf25c3334c89ad7f8b2f15ba2e8f57f795c4278d2ecab2cc24b8c723d
BLAKE2b-256 checksum
How to use checksums
18a13e8bf65ea592494017455854dd68867616de8d20134cb51b16ffcf0bfe03
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.1.6-py3-none-any.whl

Download URL flag_capturer-0.1.6-py3-none-any.whl
Size 15.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a25cc0ca14d53ac7b06fc406e3436ee9c9ee1e6a020cb0a5c978e9e8d262ca0b
BLAKE2b-256 checksum
How to use checksums
e6f5e0fccaa920e7151bd461aa3b97ca9958c4bf18eeea066b7e5ff5fe6ae696
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.1.6

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page