Merge pull request #610 from Yamato-Security/606-print-all-field-info-when-no-details-are-defined
Print all field info when no details are defined
This commit is contained in:
@@ -1,18 +1,12 @@
|
||||
# 変更点
|
||||
|
||||
## v1.4.1 [2022/xx/xx]
|
||||
|
||||
**新機能:**
|
||||
|
||||
- XXX
|
||||
## v1.4.1 [2022/06/30]
|
||||
|
||||
**改善:**
|
||||
|
||||
- ルールや`default_details.txt` に対応する`details`の記載がない場合、すべてのフィールド情報を結果の``Details`列に出力するようにした (#606) (@hitenkoku)
|
||||
- `--deep-scan`オプションの追加。 このオプションがない場合、`config/target_event_ids.txt`で指定されたイベントIDのみをスキャン対象とします。 このオプションをつけることですべてのイベントIDをスキャン対象とします。(#608) (@hitenkoku)
|
||||
|
||||
**バグ修正:**
|
||||
|
||||
- XXX
|
||||
- `-U, --update-rules`オプションで`channel_abbreviations.txt`、`statistics_event_info.txt`、`target_event_IDs.txt`を更新できるように、`config`ディレクトリから`rules/config`ディレクトリに移動した。
|
||||
|
||||
## v1.4.0 [2022/06/26]
|
||||
|
||||
|
||||
12
CHANGELOG.md
12
CHANGELOG.md
@@ -1,18 +1,12 @@
|
||||
# Changes
|
||||
|
||||
## v1.4.1 [2022/xx/xx]
|
||||
|
||||
**New Features:**
|
||||
|
||||
- XXX
|
||||
## v1.4.1 [2022/06/30]
|
||||
|
||||
**Enhancements:**
|
||||
|
||||
- When no `details` field is defined in rule nor `default_details.txt`, all fields will be outputted to the `details` column. (#606) (@hitenkoku)
|
||||
- Added the `-D, --deep-scan` option. Now by default, events are filtered by Event IDs that there are detection rules for defined in `rules/config/target_event_IDs.txt`. This should improve performance by 25~55% while still detecting almost everything. If you want to do a thorough scan on all events, you can disable the event ID filter with `-D, --deep-scan`. (#608) (@hitenkoku)
|
||||
|
||||
**Bug Fixes:**
|
||||
|
||||
- XXX
|
||||
- `channel_abbreviations.txt`, `statistics_event_info.txt` and `target_event_IDs.txt` have been moved from the `config` directory to the `rules/config` directory in order to provide updates with `-U, --update-rules`.
|
||||
|
||||
## v1.4.0 [2022/06/26]
|
||||
|
||||
|
||||
@@ -506,7 +506,7 @@ Hayabusaの結果を標準出力に表示しているとき(デフォルト)
|
||||
* `Level`: YML検知ルールの`level`フィールドから来ています。(例:`informational`, `low`, `medium`, `high`, `critical`) デフォルトでは、すべてのレベルのアラートとイベントが出力されますが、`-m`オプションで最低のレベルを指定することができます。例えば`-m high`オプションを付けると、`high`と`critical`アラートしか出力されません。
|
||||
* `Title`: YML検知ルールの`title`フィールドから来ています。
|
||||
* `RecordID`: イベントレコードIDです。`<Event><System><EventRecordID>`フィールドから来ています。`-R`もしくは`--hide-record-id`オプションを付けると表示されません。
|
||||
* `Details`: YML検知ルールの`details`フィールドから来ていますが、このフィールドはHayabusaルールにしかありません。このフィールドはアラートとイベントに関する追加情報を提供し、ログのフィールドから有用なデータを抽出することができます。イベントキーのマッピングが間違っている場合、もしくはフィールドが存在しない場合で抽出ができなかった箇所は`n/a` (not available)と記載されます。YML検知ルールに`details`フィールドが存在しない時のdetailsのメッセージを`rules/config/default_details.txt`で設定できます。`default_details.txt`では`Provider Name`、`EventID`、`details`の組み合わせで設定することができます。
|
||||
* `Details`: YML検知ルールの`details`フィールドから来ていますが、このフィールドはHayabusaルールにしかありません。このフィールドはアラートとイベントに関する追加情報を提供し、ログのフィールドから有用なデータを抽出することができます。イベントキーのマッピングが間違っている場合、もしくはフィールドが存在しない場合で抽出ができなかった箇所は`n/a` (not available)と記載されます。YML検知ルールに`details`フィールドが存在しない時のdetailsのメッセージを`rules/config/default_details.txt`で設定できます。`default_details.txt`では`Provider Name`、`EventID`、`details`の組み合わせで設定することができます。default_details.txt`やYML検知ルールに対応するルールが記載されていない場合はすべてのフィールド情報を出力します。
|
||||
|
||||
CSVファイルとして保存する場合、以下の列が追加されます:
|
||||
|
||||
|
||||
@@ -503,7 +503,7 @@ When hayabusa output is being displayed to the screen (the default), it will dis
|
||||
* `Level`: This comes from the `level` field in the YML detection rule. (`informational`, `low`, `medium`, `high`, `critical`) By default, all level alerts will be displayed but you can set the minimum level with `-m`. For example, you can set `-m high`) in order to only scan for and display high and critical alerts.
|
||||
* `RecordID`: This comes from the `<Event><System><EventRecordID>` field in the event log. You can hidde this output with the `-R` or `--hide-record-id` option.
|
||||
* `Title`: This comes from the `title` field in the YML detection rule.
|
||||
* `Details`: This comes from the `details` field in the YML detection rule, however, only hayabusa rules have this field. This field gives extra information about the alert or event and can extract useful data from the fields in event logs. For example, usernames, command line information, process information, etc... When a placeholder points to a field that does not exist or there is an incorrect alias mapping, it will be outputted as `n/a` (not available). If the `details` field is not specified (i.e. sigma rules), default `details` messages to extract fields defined in `rules/config/default_details.txt` will be outputted. You can add more default `details` messages by adding the `Provider Name`, `EventID` and `details` message you want to output in `default_details.txt`.
|
||||
* `Details`: This comes from the `details` field in the YML detection rule, however, only hayabusa rules have this field. This field gives extra information about the alert or event and can extract useful data from the fields in event logs. For example, usernames, command line information, process information, etc... When a placeholder points to a field that does not exist or there is an incorrect alias mapping, it will be outputted as `n/a` (not available). If the `details` field is not specified (i.e. sigma rules), default `details` messages to extract fields defined in `rules/config/default_details.txt` will be outputted. You can add more default `details` messages by adding the `Provider Name`, `EventID` and `details` message you want to output in `default_details.txt`. When no description in `default_details.txt` and the YML detection rule, all fields information will be outputted.
|
||||
|
||||
The following additional columns will be added to the output when saving to a CSV file:
|
||||
|
||||
|
||||
@@ -243,10 +243,16 @@ impl Detection {
|
||||
.unwrap_or_default();
|
||||
let eid = get_serde_number_to_string(&record_info.record["Event"]["System"]["EventID"])
|
||||
.unwrap_or_else(|| "-".to_owned());
|
||||
let default_output = DEFAULT_DETAILS
|
||||
.get(&format!("{}_{}", provider, &eid))
|
||||
.unwrap_or(&"-".to_string())
|
||||
.to_string();
|
||||
let default_output = match DEFAULT_DETAILS.get(&format!("{}_{}", provider, &eid)) {
|
||||
Some(str) => str.to_owned(),
|
||||
None => recinfo.as_ref().unwrap_or(&"-".to_string()).to_string(),
|
||||
};
|
||||
let opt_record_info = if configs::CONFIG.read().unwrap().args.full_data {
|
||||
recinfo
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
let detect_info = DetectInfo {
|
||||
filepath: record_info.evtx_filepath.to_string(),
|
||||
rulepath: rule.rulepath.to_string(),
|
||||
@@ -259,7 +265,7 @@ impl Detection {
|
||||
alert: rule.yaml["title"].as_str().unwrap_or("").to_string(),
|
||||
detail: String::default(),
|
||||
tag_info: tag_info.join(" | "),
|
||||
record_information: recinfo,
|
||||
record_information: opt_record_info,
|
||||
record_id: rec_id,
|
||||
};
|
||||
MESSAGES.lock().unwrap().insert(
|
||||
|
||||
@@ -235,11 +235,8 @@ pub fn create_rec_info(data: Value, path: String, keys: &[String]) -> EvtxRecord
|
||||
|
||||
// EvtxRecordInfoを作る
|
||||
let data_str = data.to_string();
|
||||
let rec_info = if configs::CONFIG.read().unwrap().args.full_data {
|
||||
Option::Some(create_recordinfos(&data))
|
||||
} else {
|
||||
Option::None
|
||||
};
|
||||
let rec_info = Option::Some(create_recordinfos(&data));
|
||||
|
||||
EvtxRecordInfo {
|
||||
evtx_filepath: path,
|
||||
record: data,
|
||||
|
||||
Reference in New Issue
Block a user