CTF Solver is an automated tool designed to assist in solving Capture The Flag (CTF) forensics challenges. It leverages a variety of tools and techniques to analyze files and directories, including archives, images, text files, and binary data. The tool applies multiple methods to extract hidden flags and provides a detailed trace of the analysis process.
- Recursive Analysis: Handles nested archives and analyzes files at multiple levels.
- Tool Integration: Utilizes popular forensic tools like Binwalk, Strings, Exiftool, Steghide, Zsteg, Foremost, Xxd, and Radare2.
- Image Analysis: Supports OCR and steganographic analysis for image files.
- Verbose Logging: Provides detailed logging of commands run and analysis results.
- Flexible: Works with various file types and structures.
- Python 3.x
- Required Python packages:
pillow
,pytesseract
- External tools:
binwalk
,strings
,exiftool
,steghide
,zsteg
,foremost
,xxd
,radare2
-
Clone the Repository
git clone https://github.com/yourusername/ctf_solver.git cd ctf_solver
-
Set Up the Python Environment
Create and activate a virtual environment (optional but recommended):
python -m venv ctfEnv source ctfEnv/bin/activate # On Windows, use `ctfEnv\Scripts\activate`
-
Install Required Python Packages
pip install -r requirements.txt
-
Install External Tools
Ensure the following tools are installed on your system. You can use package managers like
apt
for Ubuntu orbrew
for macOS to install them.sudo apt-get install binwalk exiftool steghide foremost xxd radare2 gem install zsteg # Ruby gem for zsteg
For OCR functionality, install Tesseract:
sudo apt-get install tesseract-ocr
To analyze a file or directory, use:
python main.py <target_file_or_directory>
-
Analyzing a Single File
python main.py example_file.tar
-
Analyzing a Directory
python main.py example_directory/
The tool will output the following:
- Command Execution Logs: Commands run during the analysis.
- Flags Found: List of detected flags.
- Trace: Detailed trace of the steps taken to find the flags.
Contributions are welcome! Please submit a pull request or open an issue for suggestions and improvements.
- Fork the Repository
- Create a Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit Your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Pillow for image processing
- Pytesseract for OCR
- Binwalk for firmware analysis
- Exiftool for metadata extraction
- Steghide for steganographic analysis
- Zsteg for PNG steganographic analysis
- Foremost for file carving
- Xxd for hexadecimal dumps
- Radare2 for binary analysis
For any questions or support, please contact [email protected].