From 9ef72771dc0b5162829847288763bf79bfba3081 Mon Sep 17 00:00:00 2001 From: Eun0us Date: Thu, 15 Jan 2026 00:04:00 +0100 Subject: [PATCH] =?UTF-8?q?=CE=B5=20-=20Init=20Sources?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 103 + CONTRIBUTING.md | 634 ++++++ LICENSE | 61 + README.en.md | 487 +++++ README.md | 359 ++++ assets/images/espilon-firmware-conception.png | Bin 0 -> 208137 bytes assets/images/logo-01.jpg | Bin 0 -> 131765 bytes assets/images/menuconfig-wifi.png | Bin 0 -> 9880 bytes assets/images/menuconfig1.png | Bin 0 -> 12890 bytes assets/images/source-code_schema.png | Bin 0 -> 87181 bytes espilon_bot/CMakeLists.txt | 8 + espilon_bot/README.md | 9 + espilon_bot/components/command/CMakeLists.txt | 7 + espilon_bot/components/command/command.c | 65 + espilon_bot/components/command/command.h | 56 + .../components/command/command_async.c | 101 + espilon_bot/components/core/CMakeLists.txt | 22 + espilon_bot/components/core/WiFi.c | 152 ++ espilon_bot/components/core/com.c | 51 + espilon_bot/components/core/crypto.c | 206 ++ espilon_bot/components/core/gprs.c | 326 +++ espilon_bot/components/core/messages.c | 185 ++ espilon_bot/components/core/nanoPB/c2.pb.c | 17 + espilon_bot/components/core/nanoPB/c2.pb.h | 107 + .../components/core/nanoPB/nanopb.proto | 213 ++ espilon_bot/components/core/nanoPB/pb.h | 942 +++++++++ .../components/core/nanoPB/pb_common.c | 388 ++++ .../components/core/nanoPB/pb_common.h | 49 + .../components/core/nanoPB/pb_decode.c | 1763 +++++++++++++++++ .../components/core/nanoPB/pb_decode.h | 204 ++ .../components/core/nanoPB/pb_encode.c | 1006 ++++++++++ .../components/core/nanoPB/pb_encode.h | 195 ++ espilon_bot/components/core/process.c | 47 + espilon_bot/components/core/utils.h | 147 ++ .../components/mod_fakeAP/CMakeLists.txt | 4 + .../components/mod_fakeAP/cmd_fakeAP.c | 287 +++ .../components/mod_fakeAP/cmd_fakeAP.h | 2 + .../components/mod_fakeAP/fakeAP_utils.h | 19 + .../components/mod_fakeAP/mod_fakeAP.c | 219 ++ .../components/mod_fakeAP/mod_netsniff.c | 123 ++ .../components/mod_fakeAP/mod_web_server.c | 208 ++ .../components/mod_network/CMakeLists.txt | 3 + .../components/mod_network/cmd_network.c | 168 ++ .../components/mod_network/cmd_network.h | 3 + espilon_bot/components/mod_network/mod_arp.c | 160 ++ espilon_bot/components/mod_network/mod_dos.c | 102 + espilon_bot/components/mod_network/mod_ping.c | 182 ++ .../components/mod_network/mod_proxy.c | 200 ++ .../components/mod_network/net_utils.h | 12 + .../components/mod_recon/CMakeLists.txt | 13 + espilon_bot/components/mod_recon/cmd_recon.h | 4 + .../components/mod_recon/idf_component.yml | 5 + espilon_bot/components/mod_recon/mod_cam.c | 276 +++ espilon_bot/components/mod_recon/mod_trilat.c | 259 +++ .../components/mod_system/CMakeLists.txt | 6 + .../components/mod_system/cmd_system.c | 117 ++ .../components/mod_system/cmd_system.h | 3 + .../protocol_examples_common/CMakeLists.txt | 19 + .../Kconfig.projbuild | 425 ++++ .../protocol_examples_common/README.md | 58 + .../addr_from_stdin.c | 69 + .../include/addr_from_stdin.h | 44 + .../include/example_common_private.h | 56 + .../include/protocol_examples_common.h | 147 ++ .../include/protocol_examples_utils.h | 49 + .../protocol_examples_utils.c | 388 ++++ espilon_bot/main/CMakeLists.txt | 3 + espilon_bot/main/Kconfig | 126 ++ espilon_bot/main/bot-lwip.c | 68 + espilon_bot/sdkconfig.defaults | 16 + tools/README.md | 174 ++ tools/c2/README.md | 320 +++ tools/c2/c3po.py | 194 ++ tools/c2/cli/cli.py | 289 +++ tools/c2/cli/help.py | 78 + tools/c2/commands/base.py | 10 + tools/c2/commands/reboot.py | 27 + tools/c2/commands/registry.py | 12 + tools/c2/core/crypto.py | 31 + tools/c2/core/device.py | 33 + tools/c2/core/groups.py | 34 + tools/c2/core/registry.py | 78 + tools/c2/core/transport.py | 128 ++ tools/c2/proto/__init__.py | 0 tools/c2/proto/c2_pb2.py | 29 + tools/c2/utils/cli.py | 149 ++ tools/c2/utils/constant.py | 23 + tools/c2/utils/display.py | 65 + tools/c2/utils/manager.py | 57 + tools/c3po/README.md | 14 + tools/c3po/c3po.py | 162 ++ tools/c3po/core/device.py | 31 + tools/c3po/core/registry.py | 67 + tools/c3po/proxyficateur/commands.txt | 5 + tools/c3po/proxyficateur/proxyficateur.py | 64 + tools/c3po/proxyficateur/scan-net.txt | 254 +++ tools/c3po/proxyficateur/srv.py | 65 + tools/c3po/static/streams/record.avi | Bin 0 -> 97228 bytes tools/c3po/templates/index.html | 38 + tools/c3po/templates/login.html | 58 + tools/c3po/templates/trilateration.html | 153 ++ tools/c3po/test/test.py | 101 + tools/c3po/utils/cli.py | 149 ++ tools/c3po/utils/espilon_pb2.py | 29 + tools/c3po/utils/genhash.py | 13 + tools/c3po/utils/manager.py | 57 + tools/c3po/utils/message_process.py | 79 + tools/c3po/utils/reboot.py | 61 + tools/c3po/utils/sheldon.py | 36 + tools/c3po/utils/static/streams/record.avi | Bin 0 -> 5684916 bytes .../utils/static/streams/waiting_for_camera | Bin 0 -> 211603 bytes tools/c3po/utils/utils.py | 99 + tools/c3po/webserver.py | 266 +++ tools/flasher/README.md | 468 +++++ tools/flasher/flash.py | 522 +++++ tools/nanoPB/c2.options | 18 + tools/nanoPB/c2.proto | 38 + 117 files changed, 16331 insertions(+) create mode 100644 .gitignore create mode 100644 CONTRIBUTING.md create mode 100644 LICENSE create mode 100644 README.en.md create mode 100644 README.md create mode 100644 assets/images/espilon-firmware-conception.png create mode 100644 assets/images/logo-01.jpg create mode 100644 assets/images/menuconfig-wifi.png create mode 100644 assets/images/menuconfig1.png create mode 100644 assets/images/source-code_schema.png create mode 100644 espilon_bot/CMakeLists.txt create mode 100644 espilon_bot/README.md create mode 100644 espilon_bot/components/command/CMakeLists.txt create mode 100644 espilon_bot/components/command/command.c create mode 100644 espilon_bot/components/command/command.h create mode 100644 espilon_bot/components/command/command_async.c create mode 100644 espilon_bot/components/core/CMakeLists.txt create mode 100644 espilon_bot/components/core/WiFi.c create mode 100644 espilon_bot/components/core/com.c create mode 100644 espilon_bot/components/core/crypto.c create mode 100644 espilon_bot/components/core/gprs.c create mode 100644 espilon_bot/components/core/messages.c create mode 100644 espilon_bot/components/core/nanoPB/c2.pb.c create mode 100644 espilon_bot/components/core/nanoPB/c2.pb.h create mode 100644 espilon_bot/components/core/nanoPB/nanopb.proto create mode 100644 espilon_bot/components/core/nanoPB/pb.h create mode 100644 espilon_bot/components/core/nanoPB/pb_common.c create mode 100644 espilon_bot/components/core/nanoPB/pb_common.h create mode 100644 espilon_bot/components/core/nanoPB/pb_decode.c create mode 100644 espilon_bot/components/core/nanoPB/pb_decode.h create mode 100644 espilon_bot/components/core/nanoPB/pb_encode.c create mode 100644 espilon_bot/components/core/nanoPB/pb_encode.h create mode 100644 espilon_bot/components/core/process.c create mode 100644 espilon_bot/components/core/utils.h create mode 100644 espilon_bot/components/mod_fakeAP/CMakeLists.txt create mode 100644 espilon_bot/components/mod_fakeAP/cmd_fakeAP.c create mode 100644 espilon_bot/components/mod_fakeAP/cmd_fakeAP.h create mode 100644 espilon_bot/components/mod_fakeAP/fakeAP_utils.h create mode 100644 espilon_bot/components/mod_fakeAP/mod_fakeAP.c create mode 100644 espilon_bot/components/mod_fakeAP/mod_netsniff.c create mode 100644 espilon_bot/components/mod_fakeAP/mod_web_server.c create mode 100644 espilon_bot/components/mod_network/CMakeLists.txt create mode 100644 espilon_bot/components/mod_network/cmd_network.c create mode 100644 espilon_bot/components/mod_network/cmd_network.h create mode 100644 espilon_bot/components/mod_network/mod_arp.c create mode 100644 espilon_bot/components/mod_network/mod_dos.c create mode 100644 espilon_bot/components/mod_network/mod_ping.c create mode 100644 espilon_bot/components/mod_network/mod_proxy.c create mode 100644 espilon_bot/components/mod_network/net_utils.h create mode 100644 espilon_bot/components/mod_recon/CMakeLists.txt create mode 100644 espilon_bot/components/mod_recon/cmd_recon.h create mode 100644 espilon_bot/components/mod_recon/idf_component.yml create mode 100644 espilon_bot/components/mod_recon/mod_cam.c create mode 100644 espilon_bot/components/mod_recon/mod_trilat.c create mode 100644 espilon_bot/components/mod_system/CMakeLists.txt create mode 100644 espilon_bot/components/mod_system/cmd_system.c create mode 100644 espilon_bot/components/mod_system/cmd_system.h create mode 100644 espilon_bot/components/protocol_examples_common/CMakeLists.txt create mode 100644 espilon_bot/components/protocol_examples_common/Kconfig.projbuild create mode 100644 espilon_bot/components/protocol_examples_common/README.md create mode 100644 espilon_bot/components/protocol_examples_common/addr_from_stdin.c create mode 100644 espilon_bot/components/protocol_examples_common/include/addr_from_stdin.h create mode 100644 espilon_bot/components/protocol_examples_common/include/example_common_private.h create mode 100644 espilon_bot/components/protocol_examples_common/include/protocol_examples_common.h create mode 100644 espilon_bot/components/protocol_examples_common/include/protocol_examples_utils.h create mode 100644 espilon_bot/components/protocol_examples_common/protocol_examples_utils.c create mode 100644 espilon_bot/main/CMakeLists.txt create mode 100644 espilon_bot/main/Kconfig create mode 100644 espilon_bot/main/bot-lwip.c create mode 100644 espilon_bot/sdkconfig.defaults create mode 100644 tools/README.md create mode 100644 tools/c2/README.md create mode 100644 tools/c2/c3po.py create mode 100644 tools/c2/cli/cli.py create mode 100644 tools/c2/cli/help.py create mode 100644 tools/c2/commands/base.py create mode 100644 tools/c2/commands/reboot.py create mode 100644 tools/c2/commands/registry.py create mode 100644 tools/c2/core/crypto.py create mode 100644 tools/c2/core/device.py create mode 100644 tools/c2/core/groups.py create mode 100644 tools/c2/core/registry.py create mode 100644 tools/c2/core/transport.py create mode 100644 tools/c2/proto/__init__.py create mode 100644 tools/c2/proto/c2_pb2.py create mode 100644 tools/c2/utils/cli.py create mode 100644 tools/c2/utils/constant.py create mode 100644 tools/c2/utils/display.py create mode 100644 tools/c2/utils/manager.py create mode 100644 tools/c3po/README.md create mode 100644 tools/c3po/c3po.py create mode 100644 tools/c3po/core/device.py create mode 100644 tools/c3po/core/registry.py create mode 100644 tools/c3po/proxyficateur/commands.txt create mode 100644 tools/c3po/proxyficateur/proxyficateur.py create mode 100644 tools/c3po/proxyficateur/scan-net.txt create mode 100644 tools/c3po/proxyficateur/srv.py create mode 100644 tools/c3po/static/streams/record.avi create mode 100644 tools/c3po/templates/index.html create mode 100644 tools/c3po/templates/login.html create mode 100644 tools/c3po/templates/trilateration.html create mode 100644 tools/c3po/test/test.py create mode 100644 tools/c3po/utils/cli.py create mode 100644 tools/c3po/utils/espilon_pb2.py create mode 100644 tools/c3po/utils/genhash.py create mode 100644 tools/c3po/utils/manager.py create mode 100644 tools/c3po/utils/message_process.py create mode 100644 tools/c3po/utils/reboot.py create mode 100644 tools/c3po/utils/sheldon.py create mode 100644 tools/c3po/utils/static/streams/record.avi create mode 100644 tools/c3po/utils/static/streams/waiting_for_camera create mode 100644 tools/c3po/utils/utils.py create mode 100644 tools/c3po/webserver.py create mode 100644 tools/flasher/README.md create mode 100644 tools/flasher/flash.py create mode 100644 tools/nanoPB/c2.options create mode 100644 tools/nanoPB/c2.proto diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5e162c2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,103 @@ +# ESP-IDF Build System +espilon_bot/build/ +espilon_bot/sdkconfig +espilon_bot/sdkconfig.old +espilon_bot/.config +espilon_bot/.config.old + +# Managed Components (downloaded dependencies) +espilon_bot/managed_components/ +espilon_bot/dependencies.lock + +# Firmware binaries +espilon_bot/firmware/ +*.bin +*.elf +*.map + +# Python +__pycache__/ +*.py[cod] +*$py.class +*.so +.Python +*.egg-info/ +dist/ +build/ +venv/ +env/ +ENV/ +.venv + +# Tools - Python dependencies +tools/c2/__pycache__/ +tools/c3po/__pycache__/ +tools/flasher/__pycache__/ +*.pyc + +# Configuration files with secrets +tools/flasher/devices.json +tools/flasher/devices.*.json +tools/c2/config.json +tools/c3po/config.json +**/config.local.json + +# Logs +*.log +logs/ +espilon_bot/logs/ + +# IDE and Editor +.vscode/ +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +.idea/ +*.swp +*.swo +*~ +.DS_Store + +# OS +Thumbs.db +.DS_Store +*.bak + +# Credentials and Secrets +*.pem +*.key +*.crt +*.p12 +secrets/ +credentials/ +.env +.env.local + +# Temporary files +*.tmp +*.temp +.cache/ + +# Documentation build +docs/_build/ +docs/.doctrees/ +site/ + +# Test coverage +.coverage +htmlcov/ +.pytest_cache/ + +# nanoPB generated files (if you want to regenerate them) +# Uncomment if you want to track generated .pb.c/.pb.h files +# espilon_bot/components/core/nanoPB/*.pb.c +# espilon_bot/components/core/nanoPB/*.pb.h + +# Backup files +*.backup +*_backup + +# Hardware-specific configs (optional) +# Uncomment if you don't want to track these +# espilon_bot/partitions.csv diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..8e41d9f --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,634 @@ +# Contributing to Espilon + +Thank you for your interest in contributing to Espilon! This document provides guidelines and instructions for contributing to the project. + +--- + +## Table of Contents + +- [Code of Conduct](#code-of-conduct) +- [How Can I Contribute?](#how-can-i-contribute) +- [Development Setup](#development-setup) +- [Coding Standards](#coding-standards) +- [Commit Guidelines](#commit-guidelines) +- [Pull Request Process](#pull-request-process) +- [Security Contributions](#security-contributions) +- [Community](#community) + +--- + +## Code of Conduct + +### Our Standards + +- **Be respectful**: Treat everyone with respect and kindness +- **Be collaborative**: Work together to improve the project +- **Be responsible**: This is a security tool - use it ethically +- **Be professional**: Maintain professional communication +- **Be patient**: Help newcomers learn and grow + +### Unacceptable Behavior + +- Harassment, discrimination, or offensive comments +- Sharing malicious code or exploits for illegal purposes +- Unauthorized testing against third-party systems +- Trolling, insulting, or derogatory comments +- Publishing others' private information + +**Violations**: Please report to project maintainers. Serious violations may result in being banned from the project. + +--- + +## How Can I Contribute? + +### Reporting Bugs + +**Before submitting a bug report**: +1. Check the [documentation](docs/) for common issues +2. Search [existing issues](https://github.com/yourusername/epsilon/issues) to avoid duplicates +3. Try to reproduce with the latest version + +**Good bug reports include**: +- Clear, descriptive title +- Steps to reproduce the issue +- Expected vs actual behavior +- ESP32 variant and board type +- ESP-IDF version +- Configuration (`sdkconfig` relevant parts) +- Serial output/logs +- Screenshots (if applicable) + +**Bug Report Template**: +```markdown +## Description +[Clear description of the bug] + +## Steps to Reproduce +1. Configure device with... +2. Execute command... +3. Observe error... + +## Expected Behavior +[What should happen] + +## Actual Behavior +[What actually happens] + +## Environment +- ESP32 Variant: ESP32/ESP32-S2/ESP32-S3/etc. +- Board: DevKit/ESP32-CAM/Custom +- ESP-IDF Version: v5.3.2 +- Espilon Version: commit hash or version + +## Logs +``` +[Paste relevant logs here] +``` + +## Additional Context +[Any other relevant information] +``` + +### Suggesting Features + +**Feature requests should**: +- Have a clear use case +- Align with project goals (security research/education) +- Consider resource constraints (ESP32 limitations) +- Include implementation ideas (if possible) + +**Feature Request Template**: +```markdown +## Feature Description +[Clear description of the proposed feature] + +## Use Case +[Why is this feature needed? What problem does it solve?] + +## Proposed Implementation +[How could this be implemented? Consider:] +- Memory requirements +- CPU usage +- Network bandwidth +- Module structure +- Configuration options + +## Alternatives Considered +[Other approaches you've thought about] + +## Additional Context +[Mockups, examples, references] +``` + +### Contributing Code + +**Types of contributions welcome**: + +- Bug fixes +- New modules or commands +- Documentation improvements +- Code quality improvements (refactoring, optimization) +- Tests and test infrastructure +- Security enhancements +- Translations +- Tool improvements (C2, flasher, etc.) + +**Getting started**: + +1. Fork the repository +2. Create a feature branch +3. Make your changes +4. Test thoroughly +5. Submit a pull request + +--- + +## Development Setup + +### Prerequisites + +- ESP-IDF v5.3.2 or compatible +- Python 3.8+ +- Git +- ESP32 development board (for testing) + +### Fork and Clone + +```bash +# Fork repository on GitHub, then: +git clone https://github.com/YOUR-USERNAME/epsilon.git +cd epsilon + +# Add upstream remote +git remote add upstream https://github.com/original-owner/epsilon.git +``` + +### Set Up Development Environment + +```bash +# Install ESP-IDF +cd ~/esp +git clone --recursive --branch v5.3.2 https://github.com/espressif/esp-idf.git +cd esp-idf +./install.sh esp32 +. ./export.sh + +# Install Python dependencies (for C2) +cd /path/to/epsilon/tools/c2 +pip3 install -r requirements.txt +``` + +### Create Feature Branch + +```bash +# Update your fork +git checkout main +git pull upstream main + +# Create feature branch +git checkout -b feature/your-feature-name +``` + +**Branch naming conventions**: +- `feature/feature-name` - New features +- `fix/bug-description` - Bug fixes +- `docs/topic` - Documentation updates +- `refactor/component-name` - Code refactoring +- `test/test-description` - Test additions + +--- + +## Coding Standards + +### C Code (ESP32 Firmware) + +**Style Guide**: +- **Indentation**: 4 spaces (NO tabs) +- **Braces**: K&R style (opening brace on same line) +- **Naming**: + - Functions: `snake_case` (e.g., `process_command`) + - Variables: `snake_case` (e.g., `device_id`) + - Constants: `UPPER_SNAKE_CASE` (e.g., `MAX_BUFFER_SIZE`) + - Macros: `UPPER_SNAKE_CASE` + - Structs: `snake_case_t` (e.g., `command_t`) + +**Example**: +```c +#include "esp_log.h" +#include "utils.h" + +#define TAG "MODULE" +#define MAX_RETRIES 3 + +typedef struct { + char name[32]; + int value; +} config_t; + +static int process_data(const uint8_t *data, size_t len) +{ + if (data == NULL || len == 0) { + ESP_LOGE(TAG, "Invalid parameters"); + return -1; + } + + for (size_t i = 0; i < len; i++) { + // Process data + } + + return 0; +} +``` + +**Best Practices**: +- Use ESP_LOG* macros for logging (not printf) +- Check return values and handle errors +- Free allocated memory (no leaks) +- Use const for read-only parameters +- Validate input parameters +- Document complex logic with comments +- Keep functions small and focused +- No global mutable state (use static or pass context) +- No magic numbers (use named constants) +- No commented-out code (use git history) + +### Python Code (C2 Server) + +**Style Guide**: [PEP 8](https://pep8.org/) +- **Indentation**: 4 spaces +- **Line length**: 100 characters max +- **Naming**: + - Functions: `snake_case` + - Classes: `PascalCase` + - Constants: `UPPER_SNAKE_CASE` + - Private: `_leading_underscore` + +**Example**: +```python +import logging +from typing import List, Optional + +logger = logging.getLogger(__name__) + +class DeviceManager: + """Manages connected ESP32 devices.""" + + def __init__(self): + self._devices = {} + + def add_device(self, device_id: str, connection) -> None: + """Add a new device to the registry.""" + if not device_id: + raise ValueError("device_id cannot be empty") + + self._devices[device_id] = connection + logger.info(f"Device added: {device_id}") + + def get_device(self, device_id: str) -> Optional[object]: + """Retrieve device by ID.""" + return self._devices.get(device_id) +``` + +**Best Practices**: +- Type hints for function signatures +- Docstrings for classes and public functions +- Use logging module (not print statements) +- Handle exceptions appropriately +- Use context managers (`with` statements) +- Run `black` for formatting +- Run `flake8` for linting + +**Tools**: +```bash +# Format code +black tools/c2/ + +# Check style +flake8 tools/c2/ + +# Type checking +mypy tools/c2/ +``` + +### Documentation + +**Markdown Style**: +- Use ATX-style headers (`#`, `##`, `###`) +- Code blocks with language specifiers +- Tables for structured data +- Lists for sequential or unordered items + +**Code Comments**: +- Explain **why**, not **what** (code shows what) +- Keep comments up-to-date with code +- Use TODO/FIXME/NOTE for temporary notes +- Remove obsolete comments + +--- + +## Commit Guidelines + +### Commit Message Format + +``` +(): + + + +