threatexpress/random_c2_profile
GitHub: threatexpress/random_c2_profile
基于 Jinja 模板的 Cobalt Strike 随机 C2 配置文件生成器,帮助红队快速创建差异化的流量伪装配置。
Stars: 685 | Forks: 88
# 随机 C2 配置生成器
Cobalt Strike 随机 C2 配置生成器
作者:Joe Vest (@joevest)
## 概述
该项目旨在快速生成随机 c2 配置。它本质上是一个包含随机变量的 Jinja 模板。其核心思想是关注随机化,而不是支持特定威胁行为者的一组连贯值。
关于 Malleable C2 配置的详细信息可在 https://github.com/threatexpress/malleable-c2/ 找到。
!! 使用默认配置的 OPSEC 警告 !!
默认模板可能无法满足您的 OPSEC 需求。配置应始终根据您的具体需求进行调整。您可以创建自己的配置模板进行自定义。自定义模板可以保存在 templates 目录中。复制默认模板并根据需要进行修改。
### OPSEC 警告:使用前您应该了解的默认配置要点
- 默认启用 Staging。您应该禁用它。
- 默认设置不支持配置变体(参见 Profile Variants - https://www.cobaltstrike.com/help-malleable-c2)
- URI 和 DNS 主机并不花哨,它们是使用词表中的随机单词构建的。
- 进程注入设置可能不适合您的 OPSEC 需求
## 设置
本项目基于 python3 设计并测试
### 方法 1:独立管理您的 python 环境并使用 pipenv(推荐) - https://pipenv-fork.readthedocs.io/en/latest/basics.html
- 第一步,在您的环境中安装 pipenv
- 第二步,设置 pipenv 环境
```
pipenv --python 3.10
pipenv install
pipenv shell
python random_c2profile.py
```
### 方法 2:通过 pip3 和 Pipfile 安装
```
git clone https://github.com/threatexpress/random_c2_profile
cd random_c2_profile
pip3 install -p Pipfile
python3 random_c2profile.py
```
## 生成一些配置
#### 从默认模板生成配置
```
python random_c2profile.py
===================================================================
___ _ ___ ___ ___ __ _ _
| _ \__ _ _ _ __| |___ _ __ / __|_ ) | _ \_ _ ___ / _(_) |___
| / _` | ' \/ _` / _ \ ' \ | (__ / / | _/ '_/ _ \ _| | / -_)
|_|_\__,_|_||_\__,_\___/_|_|_| \___/___| |_| |_| \___/_| |_|_\___|
Cobalt Strike random C2 Profile generator
Joe Vest (@joevest) - 2021
===================================================================
[*] Generating Cobalt Strike Malleable C2 Profile
Version : 4.7
template: templates/default_c2profile_template.jinja
[*] Done. Don't forget to validate with c2lint.
[*] Profile saved to output/UBVOTUIW.profile
```
#### 从自定义模板生成配置
```
python random_c2profile.py --template templates/my_template.jinja
===================================================================
___ _ ___ ___ ___ __ _ _
| _ \__ _ _ _ __| |___ _ __ / __|_ ) | _ \_ _ ___ / _(_) |___
| / _` | ' \/ _` / _ \ ' \ | (__ / / | _/ '_/ _ \ _| | / -_)
|_|_\__,_|_||_\__,_\___/_|_|_| \___/___| |_| |_| \___/_| |_|_\___|
Cobalt Strike random C2 Profile generator
Joe Vest (@joevest) - 2021
===================================================================
[*] Generating Cobalt Strike Malleable C2 Profile
Version : 4.7
template: templates/my_template.jinja
[*] Done. Don't forget to validate with c2lint.
[*] Profile saved to output/NSJOTVMN.profile
```
## 文件说明
文件 | 描述
-------------------------|------------
c2profile_template.jinja | c2 配置的基础模板
variable.py | 将 python 变量映射到 jinja 模板中使用的变量。根据需要修改这些内容。
functions.py | 包含生成配置数据的逻辑。可以添加额外的函数并在自定义配置模板中使用。
html_contents.py | 包含一组用于向配置中注入“随机”数据的 html 代码
## 参考资料
- http://threatexpress.com/blogs/2018/a-deep-dive-into-cobalt-strike-malleable-c2/
- https://bluescreenofjeff.com/2017-01-24-how-to-write-malleable-c2-profiles-for-cobalt-strike/
- https://github.com/threatexpress/malleable-c2/
- https://github.com/FortyNorthSecurity/C2concealer/
### Magic MZ
- https://www.redteam.cafe/red-team/shellcode-injection/magic_mz_x86-and-magic_mz_x64
### 词表来源
- https://raw.githubusercontent.com/chrislockard/api_wordlist/master/objects.txt
- https://raw.githubusercontent.com/chrislockard/api_wordlist/master/actions.txt
## 更新日志
注意:使用 `git log --pretty=format:" - %cd - %cn : %s"` 从 git 获取更改日志
- Thu Jan 5 15:14:34 2023 -0600 - vestjoe : Update readme
- Thu Jan 5 15:11:23 2023 -0600 - vestjoe : fix for issue https://github.com/threatexpress/random_c2_profile/issu
es/12
- Sat Dec 10 17:01:14 2022 -0600 - GitHub : Merge pull request #11 from threatexpress/custom_profile
- Sat Dec 10 16:57:34 2022 -0600 - vestjoe : update readme
- Sat Dec 10 16:54:22 2022 -0600 - vestjoe : add ability to load custom profile template
- Sat Dec 10 15:43:19 2022 -0600 - vestjoe : updated readme about OPSEC, fixed dependency versions, updated pipenv
usage instructions
- Tue Dec 6 13:24:00 2022 -0600 - vestjoe : update readme
- Tue Dec 6 13:20:54 2022 -0600 - GitHub : Merge pull request #10 from threatexpress/4.7
- Tue Dec 6 13:17:17 2022 -0600 - vestjoe : Added 4.7 profile settings, Removed old HTML content template, Added new HTML content template to html_content.py
- Wed Jun 22 11:58:22 2022 -0500 - GitHub : Merge pull request #6 from Maleick/main
- Wed Jun 22 11:57:47 2022 -0500 - GitHub : Merge pull request #5 from ceramic-skate0/patch-1
- Wed Jun 22 11:43:07 2022 -0500 - Maleick : Add Cobalt Strike version variable
- Mon May 23 13:03:28 2022 -0400 - GitHub : Update readme.md
- Wed Apr 20 18:44:19 2022 -0500 - GitHub : Merge pull request #4 from threatexpress/cs4.6
- Wed Apr 20 18:36:29 2022 -0500 - vestjoe : cs4.6 updates
- Fri Dec 17 13:44:45 2021 -0600 - vestjoe : update for CS 4.5
- Fri Dec 17 13:26:30 2021 -0600 - GitHub : Merge pull request #2 from Pernat1y/patch-1
- Sat Sep 11 14:43:27 2021 +0300 - GitHub : Updated readme
- Mon Aug 30 06:07:18 2021 -0500 - vestjoe : added 4.4 tweaks
- Mon Aug 30 06:01:47 2021 -0500 - vestjoe : silly bug
- Thu Aug 26 12:06:33 2021 -0500 - vestjoe : tweaks to DNS settings, host must be lowercase, adjusted dns_sleep options
- Mon Aug 23 12:50:47 2021 -0500 - vestjoe : Updated for CS 4.4 and added magic mz options
- Thu May 6 20:05:33 2021 -0500 - vestjoe : fix
- Thu Apr 29 11:47:00 2021 -0500 - vestjoe : update spawnto to better match x64 and x86 across mutiple version of Windows
- Wed Apr 28 13:55:57 2021 -0500 - vestjoe : better compatibility
- Sat Apr 3 15:51:24 2021 -0500 - vestjoe : updated
- Sat Apr 3 15:49:52 2021 -0500 - vestjoe : updated
- Sat Apr 3 15:26:49 2021 -0500 - vestjoe : initial
标签:C2 Profile, Cobalt Strike, IP 地址批量处理, Jinja2, Malleable C2, OPSEC, Python, 命令与控制, 攻击诱捕, 无后门, 流量混淆, 网络信息收集, 网络安全, 行为混淆, 随机生成器, 隐私保护