TarzEH/MudaleTunnel

GitHub: TarzEH/MudaleTunnel

面向红队的SSH隧道管理工具,集成nmap服务发现,支持通过CLI和Web界面创建、监控和管理多种SSH隧道模式。

Stars: 0 | Forks: 0

MudaleTunnel

快速开始隧道模式架构CLIWeb UIDocker许可证

Version License Python FastAPI Docker nmap

## 什么是 MudaleTunnel? MudaleTunnel 是一个红队 SSH 隧道管理工具,可自动化服务发现和隧道创建。它使用 **nmap** 扫描目标,然后允许你通过 **CLI** 和 **web 界面** 创建、管理和监控 SSH 隧道 —— 具备实时 WebSocket 更新、健康监控和 proxychains 配置生成功能。 **无需手动输入 SSH 命令。** 指向目标,选择服务,选择隧道类型,即可开始连接。 ## 隧道模式 | 模式 | SSH 标志 | 使用场景 | |------|----------|----------| | **Static** | `ssh -L` | 本地端口转发 —— 直接访问远程服务 | | **Dynamic** | `ssh -D` | SOCKS 代理 —— 通过 SSH 服务器路由任何流量 | | **Remote** | `ssh -R` | 反向端口转发 —— 防火墙阻止入站连接,但你可以 SSH 出站 | | **Remote Dynamic** | `ssh -R port` | 反向 SOCKS 代理 —— 灵活的反向访问 (OpenSSH 7.6+) | ## 快速开始 ### 使用 uv (推荐) ``` # 1. Clone the repo git clone https://github.com/TarzEH/MudaleTunnel.git cd MudaleTunnel # 2. Install dependencies uv sync # 3. Run CLI mode uv run python main.py # 4. Or run web interface uv run python main.py web # Open http://localhost:8000 ``` ### 使用 pip ``` git clone https://github.com/TarzEH/MudaleTunnel.git cd MudaleTunnel pip install -r requirements.txt python main.py # CLI mode python main.py web # Web interface ``` ### 使用 Docker ``` docker compose up -d # Open http://localhost:8000 ``` ## 架构 ``` ┌────────────────────────────────────────────────────────────────┐ │ MudaleTunnel v2.0 │ │ │ │ ┌──────────────────────┐ ┌──────────────────────────────┐ │ │ │ CLI Interface │ │ Web Interface │ │ │ │ Typer + Rich Tables │ │ FastAPI + Jinja2 + WS │ │ │ └──────────┬───────────┘ └──────────────┬───────────────┘ │ │ │ │ │ │ └───────────┬───────────────────┘ │ │ │ │ │ ┌───────────────────────▼──────────────────────────────────┐ │ │ │ Tunnel Manager (Core Engine) │ │ │ │ │ │ │ │ create / list / stop / health-check / logs / metrics │ │ │ │ Thread-safe · UUID-tracked · Background processes │ │ │ └──────┬──────────────────────────────┬────────────────────┘ │ │ │ │ │ │ ┌──────▼──────────┐ ┌────────▼─────────────────┐ │ │ │ nmap Scanner │ │ SSH Subprocess │ │ │ │ Quick · Full │ │ ssh -L / -D / -R │ │ │ │ Stealth · UDP │ │ Background · Monitored │ │ │ │ Intense · Svc │ │ Health-checked │ │ │ └─────────────────┘ └──────────────────────────┘ │ └────────────────────────────────────────────────────────────────┘ ``` ### 工作原理 1. **扫描目标** — nmap 发现开放端口和服务 2. **选择服务** — 从发现的服务中选择或手动输入 3. **选择隧道类型** — static、dynamic、remote 或 remote dynamic 4. **创建隧道** — SSH 子进程在后台运行并进行监控 5. **管理隧道** — 列出、停止、健康检查、查看日志和指标 ## CLI 使用方法 ### 命令 ``` python main.py # Default: interactive CLI mode python main.py cli # Explicit CLI mode python main.py web # Web interface (default: localhost:8000) python main.py static ... # Create static tunnel directly python main.py dynamic ... # Create dynamic tunnel directly python main.py remote ... # Create remote tunnel directly python main.py remote-dynamic ... # Create remote dynamic tunnel ``` ### 直接创建隧道 ``` # Static tunnel: forward remote port 80 to local 8080 python main.py static --user admin --host jumpbox.com --target 192.168.1.100 --port 80 --local-port 8080 # Dynamic tunnel: SOCKS proxy on port 1080 python main.py dynamic --user admin --host jumpbox.com --port 1080 # Remote tunnel: reverse forward internal PostgreSQL to attacker python main.py remote --user kali --host 192.168.118.4 --bind-port 2345 --target 10.4.50.215 --target-port 5432 # Remote dynamic: reverse SOCKS proxy python main.py remote-dynamic --user kali --host 192.168.118.4 --socks-port 9998 ``` ### 交互式 CLI 工作流 ``` ┌─ Main Menu ─────────────────────────────────────┐ │ 1. Scan target and create tunnel │ │ 2. Manage existing tunnels │ │ 0. Exit │ └─────────────────────────────────────────────────┘ │ ▼ ┌─ Scan Results ──────────────────────────────────┐ │ ┏━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━┓ │ │ ┃ Port ┃ State ┃ Service ┃ │ │ ┡━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━┩ │ │ │ 22/tcp │ open │ ssh │ │ │ │ 80/tcp │ open │ http │ │ │ │ 443/tcp │ open │ https │ │ │ └──────────┴────────┴──────────┘ │ └─────────────────────────────────────────────────┘ │ ▼ ┌─ Select Tunnel Mode ────────────────────────────┐ │ 1. Static (ssh -L) — local port forwarding │ │ 2. Dynamic (ssh -D) — SOCKS proxy │ │ 3. Remote (ssh -R) — reverse forwarding │ │ 4. Remote Dynamic — reverse SOCKS proxy │ └─────────────────────────────────────────────────┘ ``` ## Web 界面 使用 `python main.py web` 启动并打开 `http://localhost:8000`。 ### 功能 | 功能 | 描述 | |---------|-------------| | **目标扫描** | 输入 IP/域名,选择扫描类型,查看发现的服务 | | **隧道创建** | 所有 4 种隧道类型的选项卡界面,带有表单验证 | | **活动隧道** | 通过 WebSocket 实时更新状态,颜色编码指示器 | | **隧道操作** | 查看详情、日志、指标或停止单个隧道 | | **Proxychains 生成器** | 为 SOCKS 隧道生成 proxychains 配置 | | **扫描历史** | 跟踪所有过去的扫描,包含类型、状态和服务计数 | ### Web 选项 ``` python main.py web # Default: localhost:8000 python main.py web --port 8080 # Custom port python main.py web --host 0.0.0.0 --port 9000 # Network-accessible ``` ## Proxychains 集成 创建 dynamic 或 remote dynamic 隧道后,生成 proxychains 配置: ``` # 1. Create SOCKS tunnel python main.py dynamic --user admin --host jumpbox.com --port 1080 # 2. Add to /etc/proxychains4.conf: socks5 127.0.0.1 1080 # 3. Route tools through the tunnel proxychains nmap -sT -Pn 172.16.50.217 proxychains smbclient -L //172.16.50.217/ -U user ``` Web UI 包含内置的 proxychains 配置生成器。 ## Docker ``` # Docker Compose docker compose up -d # Or build manually docker build -t mudaletunnel . docker run -d -p 8000:8000 mudaletunnel ``` 有关详细的 Docker 文档,包括网络模式和 SSH 密钥挂载,请参阅 [README_DOCKER.md](README_DOCKER.md)。 ## 项目结构 ``` MudaleTunnel/ ├── main.py # Entry point — Typer CLI + web server launcher ├── MudaleTunnelUI.py # CLI interface — Rich tables, menus, interactive flow ├── tunnel_manager.py # Core engine — create, list, stop, health-check tunnels ├── web_app.py # FastAPI web app — REST API + WebSocket + Jinja2 ├── config.py # Configuration defaults ├── templates/ # Jinja2 HTML templates (web UI) ├── static/ # CSS + JS assets (web UI) ├── Dockerfile # Container image ├── docker-compose.yml # Docker Compose config ├── pyproject.toml # Python project metadata + dependencies ├── requirements.txt # pip dependencies └── README_DOCKER.md # Docker-specific documentation ``` ## 依赖项 | 包 | 用途 | |---------|---------| | [Typer](https://typer.tiangolo.com/) | 带有类型提示的 CLI 框架 | | [Rich](https://rich.readthedocs.io/) | 终端 UI —— 表格、进度条、样式 | | [FastAPI](https://fastapi.tiangolo.com/) | Web 界面后端 | | [Uvicorn](https://www.uvicorn.org/) | ASGI 服务器 | | [Jinja2](https://jinja.palletsprojects.com/) | HTML 模板 | | [WebSockets](https://websockets.readthedocs.io/) | 实时隧道状态更新 | ## 先决条件 - **Python 3.9+** - **SSH client** (Linux/macOS 上预装) - **nmap** (如果缺失则自动安装) - **Docker** (可选 —— 用于容器化部署) ## 免责声明 MudaleTunnel 是一个安全研究和渗透测试工具。**请仅对你拥有或拥有明确测试授权的系统使用它。** 未经授权访问计算机系统是非法的。作者不对任何滥用行为负责。 ## 许可证 [MIT](LICENSE) © Ori Ashkenazi
标签:AV绕过, Beacon Object File, Docker, FastAPI, IP 地址批量处理, Nmap, Proxychains, Python, Red Teaming, SOCKS代理, SSH隧道, WebSocket, Web界面, 云存储安全, 依赖分析, 内网穿透, 动态端口转发, 反向代理, 安全防御评估, 恶意样本开发, 无后门, 服务发现, 本地端口转发, 横向移动, 流量转发, 端口转发, 编程规范, 网络安全, 网络扫描, 网络调试, 自动化, 虚拟驱动器, 请求拦截, 边界突破, 远程端口转发, 逆向工具, 隐私保护, 隐蔽通信, 隧道管理