# CTF Toolkit (offline)

> Offline CTF helpers: peel layered encodings, crack XOR and break classic ciphers in one call each, with ranked flag candidates.

CTF Toolkit (offline) is a free AI agent skill on Agensi by Kushagar garg, in Security. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: Free
- Creator: [Kushagar garg](https://www.agensi.io/creators/kushagar-garg-1)
- Category: [Security](https://www.agensi.io/skills/security)
- Uses: 2
- Version: 1.0
- Last updated: 2026-10-18
- Security: scan passed (2026-10-18); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/ctf-toolkit-offline
- Tags: security, education, python, cryptography, forensics, ctf-tools

## About this skill

Solve offline CTF challenges and cryptographic puzzles without manual trial and error. This skill automates the identification and extraction of flags from encoded blobs, ciphertexts, and obfuscated files. It eliminates the frustration of guessing encoding layers or brute-forcing XOR keys by hand.

### What it does
- **Multi-layer decoding** peels back up to N layers of base64, hex, binary, rot, and morse encodings to find hidden flags.
- **XOR analysis** cracks single-byte and repeating-key XOR encodings using brute-force, key length estimation, or crib-based attacks.
- **Classic cipher breaking** automates decryption for Caesar, Vigenere, Beaufort, Affine, Atbash, and substitution ciphers.
- **File checks** walks the agent through magic bytes, data after end markers and embedded PNG/ZIP signatures using standard tools (`xxd`, `file`, `strings`).
- **Automated verification** ranks flag candidates by readability and format matching to ensure the output is clean.

### How it works
1. **Identify** the data type using `xxd`, `file`, and entropy analysis to determine if it is text-like or binary.
2. **Execute** `decode_all.py` to recursively strip common encoding layers and locate strings matching the flag regex.
3. **Analyze** specialized encryption using `xor_tools.py` for binary data or `classic_cipher.py` for alphabet-preserving shifts.
4. **Extract** flags into the required output format, ensuring zero trailing newlines or extra whitespace via `printf`.

### Frameworks & tools
This skill uses Python 3 standard library scripts for decoding and cryptographic analysis. It utilizes standard Unix utilities like `xxd`, `file`, `strings`, and `grep` for initial reconnaissance.

### Why this beats prompting it yourself
Generic LLM prompts often fail at deep recursive encodings or produce flags with incorrect bytes. This skill uses deterministic scripts to peel layers and calculate XOR keys, ensuring accuracy that raw prompting cannot achieve on binary data.

### Use cases
- **CTF competition** practice involving layered encodings or classic ciphers.
- **Forensic analysis** of small, unknown binary blobs or obfuscated text files.
- **Cryptographic debugging** for developers testing XOR or simple cipher implementations.

### Known limitations
Designed for authorized offline use only. It does not support network-based attacks, large binary reverse engineering, or modern asymmetric encryption like RSA/AES without keys.

Free and open source (Apache-2.0), by the author of [rosetta-js](https://github.com/Dreamstick9/rosetta-js), a terminal coding agent for open-weight models.

## Requires

- Python 3
- xxd
- file
- strings

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the CTF Toolkit (offline) skill from Agensi" and describe your task.
3. Your agent loads the skill from Agensi when it needs it. Nothing is downloaded.

## Frequently asked questions

### How does this skill handle challenges with multiple layers of different encodings?

decode_all.py tries the common layers (base64/32/58/85, hex, binary, rot, XOR, gzip, morse and more) to depth 3 by default, or deeper with --depth, ranks the results, and prints the chain that produced each flag candidate.

### Can it break XOR-encrypted data if I don't know the key?

Yes, it includes specialized scripts for single-byte and repeating-key XOR analysis, using frequency estimation and crib-based attacks to recover keys without manual brute-forcing.

### What are the technical requirements for running this skill on my AI agent?

This skill is designed for any AI agent with a Python 3 environment and access to standard Unix utilities like xxd and strings, making it highly compatible with most developer-focused agent frameworks.

### What's included in the CTF Toolkit?

The SKILL.md workflow, three Python 3 standard-library scripts (decode_all.py, xor_tools.py, classic_cipher.py), a smoke test that checks them, and the Apache-2.0 license. It's free.

### Are there specific types of encryption that this skill cannot solve?

It's built for offline puzzles: layered encodings, XOR and classic ciphers. It can't break modern cryptography such as AES or RSA without the key, and it isn't meant for attacking networks or live systems.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
