Skip to content

命令执行

执行命令

基础执行

在目标系统中执行各类命令,获取输出或执行操作。

执行命令

Bash
run [cmdline]
执行本地可执行文件并返回输出结果,适用于需要获取执行反馈的场景。

示例:

Bash
# 执行简单命令
run whoami
# 执行带参数的命令
run gogo.exe -- -i 127.0.0.1 -p http

执行带参数命令

当插件参数以短横线(-)开头时,必须用 -- 分隔,否则控制台会误判参数归属,导致插件执行失败或功能异常。

静默执行

Bash
execute [cmdline]
执行本地可执行文件但不返回输出,适用于无需实时反馈的后台操作。

示例:

Bash
# 执行简单命令 
execute whoami  

# 执行带参数的命令
execute gogo.exe -- -i 127.0.0.1 -p http  

Shell 命令

Bash
shell [cmdline] [flags]
执行shell命令(等效于cmd /c),直接与目标系统的命令行交互。

选项:

  • -q, --quiet: 禁用输出信息

PowerShell

Bash
powershell [cmdline] [flags]
执行PowerShell命令,利用PowerShell的强大功能实现系统管理与信息收集。

选项:

  • -q, --quiet: 禁用输出信息

高级执行

通过自定义加载器或注入技术执行文件,提升隐蔽性与绕过防御机制。

执行 PE 文件

Bash
execute_exe [exe] [flags]
使用自定义Headless PE加载器在牺牲进程中加载EXE文件,减少对当前进程的影响。

选项:

  • --arch string: 目标架构(x64,x86)

  • -a, --argue string: 欺骗进程参数

  • -b, --block_dll: 阻止非微软DLL注入

  • --etw: 禁用ETW跟踪

  • -p, --ppid uint32: 伪造父进程ID

  • -n, --process string: 自定义进程路径

  • -q, --quiet: 禁用输出

  • -t, --timeout uint32: 超时时间(秒)

示例:

Bash
execute_exe gogo.exe -- -i 123.123.123.123 -p top2

执行带参数命令

当插件参数以短横线(-)开头时,必须用 -- 分隔,否则控制台会误判参数归属,导致插件执行失败或功能异常。

本地 PE 执行

Bash
execute_local [local_exe] [flags]
在牺牲进程中执行本地PE文件,适用于目标系统上已存在的可执行文件。

选项:

  • -a, --argue string: 欺骗进程参数

  • -b, --block_dll: 阻止非微软DLL注入

  • --etw: 禁用ETW跟踪

  • -o, --output: 禁用输出

  • -p, --ppid uint32: 伪造父进程ID

  • -n, --process string: 自定义进程路径

  • -q, --quiet: 禁用输出

示例:

Bash
execute_local local_exe --ppid 1234 --block_dll --etw --argue "argue"

执行 DLL

Bash
execute_dll [dll] [flags]
使用自定义Headless PE加载器在牺牲进程中加载DLL文件,支持指定入口点。

选项:

  • --arch string: 目标架构(x64,x86)

  • -a, --argue string: 欺骗进程参数

  • --binPath string: 自定义进程路径

  • -b, --block_dll: 阻止非微软DLL注入

  • -e, --entrypoint string: 自定义入口点函数

  • --etw: 禁用ETW跟踪

  • -p, --ppid uint32: 伪造父进程ID

  • -n, --process string: 自定义进程路径

  • -q, --quiet: 禁用输出

  • -t, --timeout uint32: 超时时间(秒)

示例:

Bash
# 使用默认入口点
execute_dll example.dll
# 指定入口点
execute_dll example.dll -e entrypoint -- arg1 arg2

执行 Shellcode

Bash
execute_shellcode [shellcode_file] [flags]
在牺牲进程中执行指定的shellcode,通过进程注入实现隐蔽执行。

选项:

  • --arch string: 目标架构(x64,x86)

  • -a, --argue string: 欺骗进程参数

  • -b, --block_dll: 阻止非微软DLL注入

  • --etw: 禁用ETW跟踪

  • -p, --ppid uint32: 伪造父进程ID

  • -n, --process string: 自定义进程路径

  • -q, --quiet: 禁用输出

  • -t, --timeout uint32: 超时时间(秒)

示例:

Bash
execute_shellcode example.bin

执行 .NET 程序集

Bash
execute_assembly [file] [flags]
在Implant进程中加载并执行.NET程序集,支持多种防御绕过机制。

选项:

  • --amsi: 绕过AMSI(Anti-Malware Scan Interface)

  • -a, --argue string: 欺骗进程参数

  • -b, --block_dll: 阻止非微软DLL注入

  • --bypass-all: 同时绕过AMSI、ETW、WLDP

  • --etw: 禁用ETW跟踪

  • -p, --ppid uint32: 伪造父进程ID

  • --wldp: 绕过WLDP(Windows Lockdown Policy)

示例:

Bash
execute_assembly potato.exe "whoami"

内联执行

在当前Implant进程中直接执行文件(需注意稳定性风险)。

内联执行 PE

Bash
inline_exe [exe] [flags]
在当前进程中内联执行EXE文件,无需创建新进程但可能影响Implant稳定性。

Instability warning

内联执行EXE可能导致Implant崩溃,建议仅在必要时使用。

选项:

  • --arch string: 目标架构(x64,x86)

  • -n, --process string: 自定义进程路径

  • -q, --quiet: 禁用输出

  • -t, --timeout uint32: 超时时间(秒)

示例:

Bash
inline_exe hackbrowserdata.exe -- -h

内联本地执行

Bash
inline_local [local_exe]
在Implant进程中内联执行本地PE文件,直接使用目标系统上的可执行文件。

选项:

  • -a, --argue string: 欺骗进程参数

  • -b, --block_dll: 阻止非微软DLL注入

  • --etw: 禁用ETW跟踪

  • -p, --ppid uint32: 伪造父进程ID

  • -n, --process string: 自定义进程路径

示例:

Bash
inline_local whoami

内联执行 DLL

Bash
inline_dll [dll] [flags]
在当前进程中内联执行DLL文件,直接加载到Implant的内存空间。

Instability warning

内联执行DLL可能导致Implant崩溃,建议优先使用牺牲进程执行。

选项:

  • --arch string: 目标架构(x64,x86)

  • -e, --entrypoint string: 入口点函数

  • -n, --process string: 自定义进程路径

  • -q, --quiet: 禁用输出

  • -t, --timeout uint32: 超时时间(秒)

示例:

Bash
# 使用默认入口点
inline_dll example.dll
# 指定入口点
inline_dll example.dll -e RunFunction -- arg1 arg2

内联执行 Shellcode

Bash
inline_shellcode [shellcode_file] [flags]
在Implant进程中直接执行shellcode,无需创建新进程。

Instability warning

内联执行shellcode可能导致Implant崩溃,需谨慎使用。

选项:

  • --arch string: 目标架构(x64,x86)

  • -n, --process string: 自定义进程路径

  • -q, --quiet: 禁用输出

  • -t, --timeout uint32: 超时时间(秒)

示例:

Bash
inline_shellcode example.bin

内联执行 .NET 程序集

Bash
inline_assembly [file] [flags]
在Implant进程中内联执行.NET程序集,直接加载到当前进程空间。

选项:

  • --amsi: 绕过AMSI

  • --bypass-all: 绕过AMSI、ETW、WLDP

  • --etw: 绕过ETW

  • --wldp: 绕过WLDP

示例:

Bash
# 内联执行.NET程序集
inline_assembly --amsi potato.exe "whoami"
# 执行带参数的.NET程序集
inline_assembly --amsi potato.exe -- cmd /c whoami

特殊执行

针对特定场景的执行方式,如BOF、DLL 生成等。

BOF 执行

Bash
bof [bof]
在 Windows 环境的后渗透操作中,bof 命令借助 COFF Loader 执行 BOF(Beacon Object File )文件,实现轻量、隐蔽的功能扩展。该功能基于  https://github.com/hakaioffsec/coffee 重构,修复了 bundle 相关 bug,支持通过特定格式传递参数。

BOF 的参数需在 -- 分隔符之后传递,且每个参数必须以类型前缀加冒号(:)的形式开头。支持的参数类型如下:

  • str - 空终止字符串(ASCII 编码)

  • wstr - 宽字符空终止字符串(Unicode 编码)

  • int - 32 位有符号整数

  • short - 16 位有符号整数

  • bin - Base64 编码的二进制数据块

示例:

Bash
bof dir.x64.o -- wstr:"C:\\Windows\\System32"

DLL 生成

Bash
dllspawn [dll] [flags]
在牺牲进程中使用自定义Headless PE加载器加载DLL,与execute_dll功能类似但侧重动态生成执行环境。

选项:

  • --arch string: 目标架构(x64,x86)

  • -a, --argue string: 欺骗进程参数

  • --binPath string: 自定义进程路径

  • -b, --block_dll: 阻止非微软DLL注入

  • -e, --entrypoint string: 自定义入口点

  • --etw: 禁用ETW跟踪

  • -p, --ppid uint32: 伪造父进程ID

  • -n, --process string: 自定义进程路径

  • -q, --quiet: 禁用输出

  • -t, --timeout uint32: 超时时间(秒)

示例:

Bash
dllspawn example.dll

非托管 PowerShell

Bash
powerpick [args] [flags]
在Implant进程中执行非托管PowerShell(不依赖powershell.exe),仅限Windows系统。

选项:

  • --amsi: 绕过AMSI

  • --bypass-all: 绕过AMSI、ETW、WLDP

  • --etw: 绕过ETW

  • -s, --script string: PowerShell脚本路径

  • --wldp: 绕过WLDP

示例:

Bash
powerpick -s powerview.ps1 -- Get-NetUser