

Rust 1.50以上でコンパイルおよびテスト済み。 プロジェクトディレクトリでターミナルを開き、リリースビルドをコンパイルするには次のように入力します。
cargo build --release
デバッグビルドは次のようにコンパイルできます。
cargo build
コンパイルされた実行ファイルはそれぞれ target/release/gargamel.exe または target/debug/gargamel.exe にあります。
ログレベルを変更する場合:
src/main.rs を開きます。LevelFilter::Info を (例) LevelFilter::Trace に変更すると、より詳細なログが記録されます。
LevelFilter::Trace はパスワードを含むすべてをログに記録することに注意してください。現在、このアプリはWindowsでのみ動作し、対象コンピュータはWindowsまたはLinuxを使用している必要があります。
Gargamelと同じディレクトリに以下のプログラムがあることを確認してください。
psexec、ダウンロードpaexec、PsExecのオープンソース代替、ダウンロードwinpmem、オープンソースのメモリイメージツール、ダウンロード。
plink および pscp、オープンソースのCLI 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はサポートされている5つの接続方法の1つです。
--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シェルコマンドを実行できます。
最初に、次の内容のファイル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
上記のコマンドの結果は、-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
-s, --search <search-files-path>
Optional: File with files names to be searched on remote computer. File names supports also `*` and `?`
wildcards on file names (but not yet parent directories).
--key <ssh-key> Optional: Name/path of SSH private key file. (Linux target only)
--timeout <timeout>
Optional: Timeout in seconds for long running operations.This option is a workaround for a bug in
WMImplant.ps1 amd SharpRDP.exe where finishing of a long running operation cannot sometimes properly close
the connection leaving the Gargamel in seemingly frozen state or executing the next operation with the
previous one unfinished on target site.Increasing this timeout may solve issues when acquiring registry or
memory image from target machine. [default: 300]
_ が含まれるファイルに出力を書き込めません。Copyright (C) 2020 LIFARS LLC
All Rights Reserved