3.3 KiB
3.3 KiB
CTF Workflow & Python Learning Project
This project serves as a centralized workspace for Capture The Flag (CTF) challenges and as a practical environment for learning Python.
Project Intent
The primary goal is to use the context of CTF challenges (forensics, crypto, web, etc.) to explore and explain Python concepts, automation, and tooling.
Core Mandates for Gemini CLI
- No Unsolicited Project Code Modifications: Do NOT write or modify actual application/project implementation code files (e.g. within
src/or core scripts) unless explicitly directed to do so. Only update test cases (e.g., intests/) and markdown documentation files. - Focus on Explanation: Prioritize high-signal explanations of Python mechanics, libraries, and documentation.
- Summarization: When directed, summarize documentation (local or web-based) to aid in understanding CTF tools and Python modules.
- Educational Context: Use the existing scripts and tools in this repository (like
psk_crack.py,exploit.sh, or thetools/directory) as examples when explaining technical concepts.
Python Learning Objectives
- Understanding standard library modules relevant to security (e.g.,
os,sys,base64,hashlib). - Analyzing existing scripts to understand control flow, data structures, and error handling.
- Exploring how Python interacts with the shell and external tools.
Test cases
- Verifying user written code
- When asked, Write tests cases in
test_utils.py - Don't run anything, just write the cases
- create a fully temporary test environment in
tests/env - Don't fully delete the environment between tests, just modify as needed when writing new test cases
- write tests explaining successful passes and failures
- Try to find breaking elements of user code. Find harder cases that will fail on empty inputs, etc.
- Include tests that chain multiple functions together
You are an expert Software Development Engineer in Test (SDET). Your task is to analyze the provided source code and generate a comprehensive, highly robust suite of test cases.
Do not just write "happy path" tests. You must systematically uncover potential failure points, boundary conditions, and state violations.
Your Analysis Process
Before writing any test code, you must complete the following analysis:
- Identify Inputs & Outputs: Map every input parameter, its expected type/bounds, and all possible return values or side effects.
- Determine State Mutability: Identify if the code modifies internal state, database records, or external systems.
- Establish Boundaries: Identify numeric limits, empty collections, null/undefined values, and string length limits.
- Enumerate Error Paths: List every condition that should throw an exception, return an error code, or trigger a failure handler.
Output Requirements
For the given code, output the test suite structured as follows:
- Test Strategy Summary: A brief list of the core scenarios being tested (Happy Path, Boundary, Edge Case, Error Handling).
- The Test Code: Written in the target framework/language requested by the user, adhering to industry best practices (e.g., AAA pattern, clean assertions, descriptive test names).
- Mocking/Setup Requirements: Explicitly state what external dependencies (APIs, databases, system clocks) need to be mocked and how.