Closed hach1yon closed 2 years ago
Velociraptor等のツールから実行すると、カレントディレクトリではないディレクトリからの実行になるので、config
ディレクトリが見つからないというエラーで失敗するというクレームが来ていたので、カレントディレクトリじゃなくても実行できるようにHayabusa.exeが入っているパスを調べて、そこにあるconfig
を使っています。なので、開発時に./target/release/hayabusa.exe
などを実行すると、config
ディレクトリを./target/release/config
で探してしまうので、失敗します。
hayabusa.exeが入っているパスにconfig
を探して、無い場合はカレントディレクトリにconfig
を探すようにすれば、どっちもいけると思います。
以下の件について、--rules
と--rules-config
について対応をしようと思います。
hayabusa.exeが入っているパスに
config
を探して、無い場合はカレントディレクトリにconfig
を探すようにすれば、どっちもいけると思います
Describe the bug 下記2つのバグがあるようです。
hayabusa.exeを
C:\Users\takai\dev\git\hayabusa
にコピーして下記のように実行すると、エラーは解消される。Step to Reproduce Steps to reproduce the behavior:
[ERROR] Hayabusa could not find the config directory. Please make sure that it is in the same directory as the hayabusa executable.
C:\Users\takai\dev\git\hayabusa>cargo run -- --directory=C:\Users\takai\dev\git\hayabusa-sample-evtx -r .\rules\hayabusa\default\alerts\WindowsDefender\1116_WindowsDefenderAlert.yml --rules-config=C:\Users\takai\dev\git\hayabusa\rules\config Compiling hayabusa v1.4.2-dev (C:\Users\takai\dev\git\hayabusa) Finished dev [unoptimized + debuginfo] target(s) in 2.76s Running
target\debug\hayabusa.exe --directory=C:\Users\takai\dev\git\hayabusa-sample-evtx -r .\rules\hayabusa\default\alerts\WindowsDefender\1116_WindowsDefenderAlert.yml --rules-config=C:\Users\takai\dev\git\hayabusa\rules\config
[ERROR] Cannot open file. [file:C:\Users\takai\dev\git\hayabusa\target\debug\rules/config/statistics_event_info.txt] [ERROR] Cannot open file. [file:C:\Users\takai\dev\git\hayabusa\target\debug\rules/config/target_event_IDs.txt][ERROR] Hayabusa could not find the config directory. Please make sure that it is in the same directory as the hayabusa executable.