The-Z-Labs/bof-launcher
GitHub: The-Z-Labs/bof-launcher
一个开源的跨平台 BOF 加载执行库,无需 Cobalt Strike 即可在 Windows 和 Linux(含 ARM 架构)上加载运行 Beacon Object Files。
Stars: 301 | Forks: 28
# Beacon Object File (BOF) 启动器
#include "beacon.h"
NTSYSAPI NTSTATUS NTAPI NTDLL$RtlGetVersion(OSVERSIONINFOW* lpVersionInformation);
unsigned char go(unsigned char* arg_data, int arg_len) {
OSVERSIONINFOW version_info;
version_info.dwOSVersionInfoSize = sizeof(version_info);
if (NTDLL$RtlGetVersion(&version_info) != 0)
return 1;
BeaconPrintf(
CALLBACK_OUTPUT,
"Windows version: %d.%d, OS build number: %d\n",
version_info.dwMajorVersion,
version_info.dwMinorVersion,
version_info.dwBuildNumber
);
return 0;
}
```
## 为您的 BOF 编写文档
我们还引入了一种通过 BOF 源代码文件中的简单 yaml 语法来编写 BOF 文档的方法。要为 BOF 编写文档,可以在 BOF 源代码文件顶部的每一行文档前加上 `///` 前缀。默认情况下,在使用 `zig build` 构建库时,每个 BOF 文件中的文档将被连接到一个公共文件 `BOF-collection.yaml` 中。此文件可直接用于我们的 [cli4bofs 工具](https://github.com/The-Z-Labs/cli4bofs)。用于 BOF 文档编写的 yaml 语法如下所示。带有完整文档的 BOF 示例可以在[这里](https://github.com/The-Z-Labs/bof-launcher/blob/main/bofs/src/udpScanner.zig)和[这里](https://github.com/The-Z-Labs/bof-launcher/blob/main/bofs/src/kmodLoader.zig)(针对导出 API 的 BOF 示例)看到。
```
name: BOFname
description: string:"short description of a BOF"
author: BOFauthor
tags: list of tags
OS: string:linux|windows|cross
sources: list of URLs
entrypoint: optional:"go"
api: optional:list of signatures of exported functions
examples: string:"usage examples of a BOF"
- arguments:
- name: string:argName
desc: string:"short description of an argument"
type: string:"short|integer|string|stringW"
required: bool
api: optional:string:"api function name"
- errors:
- name: errorName
code: int
message: string:"short description of the error"
```
## 示例使用场景
### 使用 bof-launcher 的最小基于 Windows 的 C 应用程序
*bof-launcher 的“Hello world”程序*
[bof-minimal_win_x64](https://github.com/The-Z-Labs/bof-minimal_win_x64) - 如果您是 `bof-launcher` 的新手,请务必查看此仓库并阅读这篇[博客文章](https://blog.z-labs.eu/2024/02/08/bof-launcher.html)。
### z-beac0n - 开源对手模拟工具包
*实现自定义、跨平台植入物(implants)*
[z-beac0n implant](examples/implant) - 用于构建自定义植入物的开放且灵活的架构解决方案,遵循:*(几乎)一切都作为 BOF 实现*的概念。
### 从磁盘运行 BOF
*快速启动、原型设计和测试 BOF*
[cli4bofs](https://github.com/The-Z-Labs/cli4bofs) - 用于直接从文件系统运行 BOF 的独立命令行程序。在测试/验证第三方 BOF 或开发 BOF 期间也非常方便。不需要 [Cobalt Strike's Beacon](https://www.cobaltstrike.com/) 及其 aggressor 脚本即可运行。
### 在其他编程语言中使用 bof-launcher 的示例
*将 bof-launcher 集成到用 C、Rust 和 Go 编写的程序中*
[integration-with-c](examples/integration-with-c) - 简单示例,展示如何将 bof-launcher 集成到用 `C` 编写的应用程序中。
[integration-with-rust](examples/integration-with-rust) - 简单示例,展示如何将 bof-launcher 集成到用 `Rust` 编写的应用程序中。
[integration-with-go](examples/integration-with-go) - 简单示例,展示如何将 bof-launcher 集成到用 `Go` 编写的应用程序中。
标签:adversary simulation, ARM架构, BOF, C++, Cobalt Strike, DAST, DNS 反向解析, Go, Implant开发, Ruby工具, Rust, XML 请求, Zig, 内存加载, 内存掩码, 动态执行, 可视化界面, 安全开发, 恶意软件分析, 攻击模拟, 攻击诱捕, 数据擦除, 日志审计, 欺骗防御, 系统底层, 网络流量审计, 驱动签名利用