
已使用 Rust 1.50+ 完成编译和测试。 在项目目录中打开终端,输入以下命令编译 release 版本:
cargo build --release
调试版本可使用以下命令编译:
cargo build
编译后的可执行文件分别位于 target/release/gargamel.exe 或 target/debug/gargamel.exe。
如果希望更改日志级别:
src/main.rsLevelFilter::Info 改为(例如)LevelFilter::Trace 以获得更详细的日志。
LevelFilter::Trace 会记录所有信息,包括密码。目前,此应用仅适用于 Windows,且目标计算机必须使用 Windows 或 Linux。
请确保在与 Gargamel 相同的目录中包含以下程序:
psexec,下载paexec,PsExec 的开源替代品,下载winpmem,开源内存映像工具,下载。
plink 和 pscp,开源命令行 SSH/SCP 客户端,下载SharpRDP,使用 RDP 的开源命令执行器,下载WMImplant,开源 PowerShell WMI 命令执行器,下载7za.exe,7zip 压缩器的独立控制台版本,下载注意:我们需要同时使用 psexec 和 paexec。尽管这两个应用程序在功能上应该是等价的,但在某些情况下它们的行为实际上有所不同。
Gargamel 需要从提升的终端启动才能完全发挥作用。 目前,当权限受限运行时,它不支持 UAC 对话框或任何类型的通知。 当以受限用户权限运行时,某些操作(如目标内存转储)将无法工作。
假设你想连接一台具有以下参数的计算机:
192.168.42.47Janonbusr123以下命令将使用 PsExec 方法获取防火墙状态、网络状态、已登录用户、正在运行的进程、活动网络连接、注册表、系统及应用程序事件日志。
证据将存储在 Gargamel 所在位置的相对目录 testResults 中。
gargamel.exe -c 192.168.42.47 -u Jano --psexec -o testResults
Gargamel 会询问远程用户的密码,在我们的示例中密码为 nbusr123。
请注意,输入密码时将被隐藏。
也可以直接将密码作为程序参数指定。
gargamel.exe -c 192.168.42.47 -u Jano --psexec -p nbusr123 -o testResults
假设你想连接域中的一台计算机,具有以下参数:
WORKSPACEJanovPCJanonbusr123以下命令将使用 PsExec 方法获取防火墙状态、网络状态、已登录用户、正在运行的进程、活动网络连接、注册表、系统及应用程序事件日志。
gargamel.exe -c JanovPC -u Jano -d WORKSPACE --psexec -o testResults
或者,直接指定密码以避免提示:
gargamel.exe -c JanovPC -u Jano -d WORKSPACE --psexec -p nbusr123 -o testResults
PsExec 是五种支持的连接方法之一。
你可以将 --psexec 替换为以下选项:
--psexec--psrem,如果目标计算机上配置了 PowerShell 远程管理。--rdp,如果目标计算机上启用了 RDP。--wmi--ssh,如果目标计算机使用 Linux。可以同时使用多种方法。 例如,要同时使用 PsExec 和 RDP,可以使用以下命令:
gargamel.exe -c 192.168.42.47 -u Jano --psexec --rdp -o testResults
还有一个特殊开关 --all,等同于指定 --psexec --rdp --psrem --wmi。
注意:启动参数顺序无关,即参数指定的顺序不影响结果。
要同时获取内存转储,只需在程序参数中添加 -m 标志,例如:
gargamel.exe -c 192.168.42.47 -u Jano --psexec -o testResults -m
如果只想获取内存转储而不采集其他证据,请使用以下命令:
gargamel.exe -c 192.168.42.47 -u Jano --psexec -o testResults -m --no-events-search --no-evidence-search --no-registry-search
此功能仅适用于 Windows 目标。
Gargamel 可以在远程计算机上运行自定义的 Windows CMD 或 Linux shell 命令。
首先创建一个包含以下内容的文件 custom-commands.txt:
# Will be run using any method
ipconfig
# Will run only when launching with at least one of --all, --psexec, --wmi methods
:psexec:wmi ipconfig -all
上述命令的结果将存储在由 -o 选项指定的目录中。
要运行 custom-commands.txt 中编写的上述命令,请使用 -e 开关,例如:
gargamel.exe -c 192.168.42.47 -u Jano --psexec -o testResults -e custom-commands.txt
Gargamel 能够下载远程文件。
首先创建一个包含以下内容的文件 custom-files.txt:
C:\Users\Public\sss*
C:\Users\Jano\danove.pdf
# This line and the next one will be ignored
# C:\Users\Jano\somBajecny.pptx
C:\Users\J*\danove.pdf 很可能无法工作。上述命令的结果将存储在由 -o 选项指定的目录中。
要运行 custom-files.txt 中编写的上述命令,请使用 -s 开关,例如:
gargamel.exe -c 192.168.42.47 -u Jano --psexec -o testResults -s custom-files.txt
下面描述了所有支持的开关。
USAGE:
gargamel.exe [FLAGS] [OPTIONS] --user <user>
FLAGS:
-a, --all Acquire evidence from Windows machine using all supported methods (PsExec, PsRemote,
WMI, RDP).
--no-events-search Disables Windows event logs acquisition.
--no-evidence-search Disables acquisition of evidence that can be usually downloaded quickly (like ipconfig,
firewall status etc..)
--no-registry-search Disables target registry acquisition.
-h, --help Prints help information
-m, --mem-image Optional: Memory dump of a target Windows machine.
--local Acquire evidence from local machine.
--nla Optional: Use network level authentication when using RDP. (Windows targets only)
--no-7z Optional: Disable 7zip compression for registry & memory images.This will significantly
decrease the running time, but WMI and RDP connections will probably not work properly.
(Windows targets only)
--psexec Acquire evidence from Windows machine using PsExec. Requires both PsExec64.exe and
paexec.exe in the current directory or in the path.
--psrem Acquire evidence from Windows machine using PowerShell. Requires both PsExec64.exe and
paexec.exe in the current directory or in the path.
--rdp Acquire evidence from Windows machine using RDP. Requires SharpRDP.exe in the current
directory or in the path.
--ssh Acquire evidence from Linux machine using SSH. Requires both plink.exe and pscp.exe in
the current directory or in the path.
-V, --version Prints version information
--wmi Acquire evidence from Windows machine using WMI. Requires WMImplant.ps1 in the current
directory or in the path and PowerShell 3.0+ on the host machine.Note: It is necessary
to disable Windows Defender real-time protection (other AVs not tested).
OPTIONS:
-c, --computer <computer> Remote computer address/name. [default: 127.0.0.1]
-u, --user <user> Remote user name
-d, --domain <domain> Optional: Remote Windows domain
-o, --output <local-store-directory>
Name of local directory to store the evidence [default: evidence-output]
-p, --password <password>
Optional: Remote user password. Skipping this option will prompt a possibility to put a password in hidden
way.To specify an empty password use `-p ""`
--redownload <re-download>
Optional: Download and DELETE specified file from target computer. Use this in case of previous failed
partially completed operation. For just downloading a file (without deleting it) please use a `search`
switch. If you specify a 7zip chunk (.7z.[chunk-number], e.g. .7z.004), then it will also automatically try to
download subsequent chunks.Use also with --psexec --psrem, --rdp, --wmi, --all
-r, --remote-storage <remote-store-directory>
Name of remote directory to be used as a temporary storage. (Windows targets only) [default:
C:\Users\Public]
-e, --commands <custom-command-path> Optional: File with custom commands to execute on remote computer