rithinkrishnakv/GoShadow
GitHub: rithinkrishnakv/GoShadow
GoShadow 是一个基于 Discord Bot API 的隐蔽命令与控制框架,使用 Go 语言编写,通过 XOR 加密通信和跨平台编译实现远控指令的静默执行与结果回传。
Stars: 2 | Forks: 0
# 🎭 GoShadow C2
### 一个基于 Discord 的隐蔽命令与控制框架
[](https://golang.org)
[](LICENSE)
[](https://python.org)
**静默执行。即时结果。精炼的 Discord C2。**
## 📋 目录
- [⚠️ 免责声明](#️-disclaimer)
- [✨ 功能](#-features)
- [🏗️ 架构](#️-architecture)
- [📁 项目结构](#-project-structure)
- [🛠️ 前置条件](#️-prerequisites)
- [⚙️ 安装与 Bot 设置](#️-installation--bot-setup)
- [🚀 快速入门工作流](#-quick-start-workflow)
- [🔧 生产环境编译与优化](#-production-compiling--optimization)
- [📜 许可证](#-license)
## ⚠️ 免责声明
## ✨ 功能
| 能力 | 技术实现 | 战术优势 |
| :--- | :--- | :--- |
| **加密传输** | 封装在 Base64 payload 中的对称 XOR 流密码 | 绕过边界网络字符串匹配启发式检测与数据包检查 |
| **超时保护** | 动态强制执行 `context.WithTimeout`,上限为 60 秒 | 防止孤儿命令导致 agent 永久挂起或冻结 |
| **内存保护** | 在缓冲区读取序列之前进行高阈值文件检查(`10MB 限制`) | 消除数据外泄期间的宿主机崩溃遥测触发或内存尖峰 |
| **规避机制** | 集成的 Win32 API 运行时检查与子系统操纵 | 避开常规的调试部署附加工具及用户视觉感知 |
| **弹性控制** | 自动化的跨线程 `sync.Map` 跟踪与消息分块 | 在保持高 payload 完整性的同时,严格执行 API 速率合规性 |
## 🏗️ 架构
```
┌─────────────────────────────────────────────────────────────┐
│ OPERATOR WORKSTATION │
├─────────────────────────────────────────────────────────────┤
│ ┌──────────────┐ ┌──────────────┐ ┌───────────┐ │
│ │ builder.go │ ───▶ │ main.go │ ───▶ │ goshadow │ │
│ │ (Config Gen) │ │ (Agent Code) │ │ (.exe) │ │
│ └──────────────┘ └──────────────┘ └───────────┘ │
│ │ │ │
│ ▼ │ │
│ ┌──────────────┐ ┌──────────────┐ │ │
│ │goshadow-crypt│ ◀──▶ │ Discord │ ◀──────────┘ │
│ │ (Python CLI) │ │ Bot API │ HTTPS (TLS) │
│ └──────────────┘ └──────────────┘ │
└───────────────────────────────▲─────────────────────────────┘
│
│ Outbound Connection via TLS
▼
┌─────────────────────────────────────────────────────────────┐
│ TARGET MACHINE │
├─────────────────────────────────────────────────────────────┤
│ ┌───────────────────────────────────────────────────────┐ │
│ │ goshadow.exe (Persistent Background Process) │ │
│ │ • Decrypts encrypted credentials at initialization │ │
│ │ • Polls target Discord channel for inbound text │ │
│ │ • Executes sub-tasks under a strict 60s timeout │ │
│ │ • Chunks and encrypts outputs back to the panel │ │
│ └───────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
```
## 📁 项目结构
```
GoShadow/
├── main.go # Core execution loop, session handling, and command routing
├── config.example.go # Unpopulated reference placeholder for deployment setups
├── go.mod # Explicit compilation instructions and version pins
├── go.sum # cryptographically verified module dependencies tree
└── tools/
├── builder.go # Hardcoded cryptographic seed string injector tool
└── goshadow-crypt.py # Python handling interface for payload encoding/decryption
```
## 🛠️ 前置条件
### 开发环境
* **Go 编译器栈:** `Version 1.26+`(需要支持优化的运行时配置)。
* **Python 运行时:** `Version 3.6+`(用于操作员交互解析)。
### 外部依赖同步
在修改源码布局之前,从工作区根目录填充目标依赖树:
```
go mod download
go mod tidy
```
## ⚙️ 安装与 Bot 设置
### 1. 项目初始化
```
git clone
cd GoShadow
```
### 2. 基础设施配置
1. 登录 **[Discord Developer Portal](https://discord.com/developers/applications)**。
2. 选择 **New Application**,分配一个别名(例如 `WinUpdateService`),然后导航到 **Bot** 子菜单。
3. 通过 **Reset Token** 生成新的密钥字符串,并妥善保存。
4. 滚动到 **Privileged Gateway Intents** 面板,严格开启以下选项:
* ✅ **Message Content Intent**
* ✅ **Server Members Intent**
### 3. 公会访问授权
导航到 **OAuth2 URL Generator**,选择 `bot` 作用域,启用 `Send Messages` 和 `Read Message History` 权限,并使用生成的 URL 在目标测试服务器频道内为 daemon 授权。
## 🚀 快速入门工作流
### 步骤 1:加密基础设施坐标
从你的工作区目录运行独立的构建实用工具:
```
go run tools/builder.go
```
*在初始化引擎提示时提供精确的原始参数。*
该工具将返回编码后的静态常量字符串树布局:
```
const (
encToken = "" // YOUR ENCRYPTED TOKEN
encOwnerID = "" // YOUR ENCRYPTED OWNER ID
encChanID = "" // YOUR ENCRYPTED CHANNEL ID
)
```
### 步骤 2:将坐标注入上下文
打开 `main.go`,将生成的值直接映射到配置块中:
```
// ============================================================
// HARDCODED ENCRYPTED CONFIGURATION
// Generate these using: go run tools/builder.go
// ============================================================
const (
encToken = "" // Inject token here
encOwnerID = "" // Inject operator account ID
encChanID = "" // Inject interaction channel ID
)
```
### 步骤 3:为目标子系统编译
要在 Kali 等 Linux 框架中构建时静默针对 Windows 计算机,请强制执行交叉编译标志:
```
GOOS=windows GOARCH=amd64 go build -ldflags="-s -w -H=windowsgui" -o goshadow.exe main.go
```
## 🔧 生产环境编译与优化
### 通过剥离符号减小二进制文件体积
标准的 Go 二进制文件通常会保留显式的元数据映射。为了最小化最终的签名包络大小,在生成阶段请使用自定义标志:
* `-s`:完全禁用 DWARF 生成映射树。
* `-w`:禁用内部符号表生成跟踪向量。
### 部署编译矩阵
| 目标操作环境 | 目标 CPU 架构 | 命令执行字符串 |
| --- | --- | --- |
| **Windows 后台进程** | `x86_64 / 64-Bit` | `GOOS=windows GOARCH=amd64 go build -ldflags="-H=windowsgui -s -w" -o goshadow.exe main.go` |
| **Windows 调试 Shell** | `x86_64 / 64-Bit` | `GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -o goshadow_debug.exe main.go` |
| **Linux 无头独立运行** | `x86_64 / 64-Bit` | `GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o goshadow_linux main.go` |
| **macOS 原生架构** | `Apple Silicon` | `GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w" -o goshadow_mac main.go` |
## 📜 许可证
基于 MIT 许可证分发。请查看以下显式结构:
```
MIT License
Copyright (c) 2026 Rimu (GoShadow Contributors)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```
**专为专业的安全运营研究配置而构建。**标签:C2框架, Discord, DNS 反向解析, EVTX分析, Go, IP 地址批量处理, Linux, Ruby工具, 免杀与规避, 命令与控制, 安全学习资源, 日志审计, 网络信息收集, 逆向工具