cli4bofs是一个用于运行和维护BOF文件的多功能工具,支持从目标文件系统运行任何BOF文件,而且还可以方便地向其传递参数。除此之外,该工具还可以为相关BOF文件的基本信息定义简单的YAML模式,例如描述、源代码URL、参数和使用示例等。而且cli4bofs还可以方便地帮助我们开发和测试BOF文件。
功能介绍
该工具能够使用bof-launcher库来完成下列任务:
1、直接在Windows(x86、x64)平台从文件系统读取并运行BOF文件;
2、直接在Linux/UNIX(x86、x64、ARM、AARCH64)平台从文件系统读取并运行BOF文件;
工具安装
广大研究人员可以直接访问该项目的【Releases页面:https://github.com/The-Z-Labs/cli4bofs/releases】下载对应操作系统平台的cli4bofs版本:
工具使用
Usage: ./zig-out/bin/cli4bofs command [options]
Commands:
help <COMMAND> 显示给定命令的帮助信息
exec <BOF> 从文件系统执行给定的BOF文件
info <BOF> 显示BOF描述和使用样例
usage <BOF> 查看调用详细信息和参数类型
examples <BOF> 查看BOF使用样例
General Options:
-c, --collection 提供自定义BOF YAML集合
-h, --help 查看工具帮助信息
exec子命令允许我们从文件系统直接执行BOF文件,还可以使用sizZb(后跟:)字符串作为前缀来标识参数的类型,从而方便我们将参数传递给BOF:
Usage: cli4bofs <BOF> [[prefix:]ARGUMENT]...
Execute given BOF from filesystem with provided ARGUMENTs.
ARGUMENTS:
ARGUMENT's data type can be specified using one of following prefix:
short OR s - 16位有符号整数
int OR i - 32位有符号整数
str OR z - 以零结尾的字符串
wstr OR Z - 以零结尾的宽字符字符串
file OR b - 特殊类型,后跟文件路径,标识将指针(指向用文件内容填充的缓冲区)将传递给BOF
If prefix is ommited then ARGUMENT is treated as a zero-terminated characters string (str / z).
使用样例如下:
cli4bofs uname -a
cli4bofs udpScanner 192.168.2.2-10:427
cli4bofs udpScanner z:192.168.2.2-10:427
cli4bofs udpScanner 192.168.2.2-10:427 file:/tmp/udpProbes
我们可以使用简单的YAML规则来标记BOF,并对BOF文件进行定义,下面给出的是一个YAML样例:
name: "udpScanner"
description: "Universal UDP port sweeper."
author: "Z-Labs"
tags: ['net-recon']
OS: "cross"
header: ['thread', 'zib']
sources:
- 'https://raw.githubusercontent.com/The-Z-Labs/bof-launcher/main/bofs/src/udpScanner.zig'
usage: '
udpScanner str:IPSpec[:portSpec] [int:BUF_LEN str:BUF_MEMORY_ADDR]
Arguments:
str:IPSpec[:portSpec] ex: 192.168.0.1; 10.0.0-255.1-254; 192.168.0.1:161,427,10-15
[int:BUF_LEN] length of UDP probes buffer
[str:BUF_MEMORY_ADDR] pointer to the buffer containing one or more UDP probe(s). One probe per line is allowed.
UDP probe syntax (with example):
<portSpec> <probeName> <hexadecimal encoded probe data>\n
53,69,135,1761 dnsReq 000010000000000000000000'
examples: '
Scanning provided IP range on most common UDP ports with builtin UDP probes:
udpScanner str:192.168.0.1-32
Scanning only cherry-picked ports (if no builtin UDP probe for the chosen port is available then length and content of the packet payload will be randomly generated:
udpScanner str:192.168.0.1:123,161
udpScanner str:102.168.1.1-128:53,427,137
udpScanner str:192.168.0.1:100-200
UDP探针执行样例:
udpScanner str:192.168.0.1-32 int:BUF_LEN str:BUF_MEMORY_ADDRESS
下列命令可以使用cli4bofs工具运行udpScanner(BOF),并运行文件中的UDP探针:
cli4bofs exec udpScanner 102.168.1.1-4:161,427 file:/tmp/udpPayloads'
下列命令可以查看可用的BOF并显示使用详情:
$ cli4bofs list
uname
udpScanner
zerologon
arp
下面给出的是给定BOF的参数定义和使用解释:
$ cli4bofs usage udpScannerUsage:udpScanner str:IPSpec[:portSpec] [int:BUF_LEN str:BUF_MEMORY_ADDR]Arguments:str:IPSpec[:portSpec] ex: 192.168.0.1; 10.0.0-255.1-254; 192.168.0.1:161,427,10-15[int:BUF_LEN] UDP探测缓冲区长度[str:BUF_MEMORY_ADDR] 指向包含一个或多个UDP探针的缓冲区
UDP探测语句样例:
<portSpec> <probeName> <hexadecimal encoded probe data>\n
53,69,135,1761 dnsReq 000010000000000000000000
许可证协议
本项目的开发与发布遵循BSD-3-Clause开源许可证协议。
项目地址
cli4bofs:
https://github.com/The-Z-Labs/cli4bofs
https://hstechdocs.helpsystems.com/manuals/cobaltstrike/current/userguide/content/topics/beacon-object-files_main.htm https://hstechdocs.helpsystems.com/manuals/cobaltstrike/current/userguide/content/topics/welcome_main.htm https://github.com/The-Z-Labs/bof-launcher