Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added print count of rules in the scan wizard #1219

Merged
merged 18 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion CHANGELOG-Japanese.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
# 変更点

## 2.x.x [xxxx/xx/xx]
## 2.11.0 [2023/XX/XX] "XXX Release"

**新機能:**

- PowerShell classicログのフィールドを抽出するようにした。(`--no-pwsh-field-extraction`で無効化できる) (#1220) (@fukusuket)

**改善:**

- スキャンウィザードにルール数を追加した. (#1206) (@hitenkoku)

**バグ修正:**

- xxx

**その他:**

- xxx

## 2.10.1 [2023/11/12] "Kamemushi Release"

**改善:**
Expand Down
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
# Changes

## 2.x.x [xxxx/xx/xx]
## 2.11.0 [2023/XX/XX] "XX Release"

**New Features:**

- Extraction of fields from PowerShell classic logs. (Can disable with `--no-pwsh-field-extraction`) (#1220) (@fukusuket)

**Enhancements:**

- Added rule count in the scan wizard. (#1206) (@hitenkoku)

**Bug Fixes:**

- XXX

**Other:**

- XXX

## 2.10.1 [2023/11/13] "Kamemushi Release"

**Enhancements:**
Expand Down
9 changes: 4 additions & 5 deletions src/afterfact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
return;
}
let empty = &"".to_string();
let level = CompactString::new(line.get(0).unwrap_or(empty).to_lowercase());
let level = CompactString::new(line.first().unwrap_or(empty).to_lowercase());
let convert_color_result = hex::decode(line.get(1).unwrap_or(empty).trim());
if convert_color_result.is_err() {
AlertMessage::warn(&format!(
Expand Down Expand Up @@ -498,7 +498,7 @@
let level_suffix = get_level_suffix(detect_info.level.as_str());
let author_list = author_list_cache
.entry(detect_info.rulepath.clone())
.or_insert_with(|| extract_author_name(&detect_info.rulepath, stored_static))
.or_insert_with(|| extract_author_name(&detect_info.rulepath))

Check warning on line 501 in src/afterfact.rs

View check run for this annotation

Codecov / codecov/patch

src/afterfact.rs#L501

Added line #L501 was not covered by tests
.clone();
let author_str = author_list.iter().join(", ");
detect_rule_authors.insert(detect_info.rulepath.to_owned(), author_str.into());
Expand Down Expand Up @@ -1792,9 +1792,8 @@
}

/// 与えられたyaml_pathからauthorの名前を抽出して配列で返却する関数
fn extract_author_name(yaml_path: &str, stored_static: &StoredStatic) -> Nested<String> {
let parser = ParseYaml::new(stored_static);
let contents = match parser.read_file(Path::new(&yaml_path).to_path_buf()) {
fn extract_author_name(yaml_path: &str) -> Nested<String> {
let contents = match ParseYaml::read_file(Path::new(&yaml_path).to_path_buf()) {

Check warning on line 1796 in src/afterfact.rs

View check run for this annotation

Codecov / codecov/patch

src/afterfact.rs#L1795-L1796

Added lines #L1795 - L1796 were not covered by tests
Ok(yaml) => Some(yaml),
Err(e) => {
AlertMessage::alert(&e).ok();
Expand Down
6 changes: 3 additions & 3 deletions src/detections/configs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ impl StoredStatic {
lines
.iter()
.try_for_each(|line| -> Result<(), String> {
let provider = match line.get(0) {
let provider = match line.first() {
Some(_provider) => _provider.trim(),
_ => {
return Result::Err(
Expand Down Expand Up @@ -2028,7 +2028,7 @@ pub fn load_eventkey_alias(path: &str) -> EventKeyAliasConfig {
}

let empty = &"".to_string();
let alias = line.get(0).unwrap_or(empty);
let alias = line.first().unwrap_or(empty);
let event_key = line.get(1).unwrap_or(empty);
if alias.is_empty() || event_key.is_empty() {
return;
Expand Down Expand Up @@ -2522,7 +2522,7 @@ fn load_eventcode_info(path: &str) -> EventInfoConfig {
}

let empty = &"".to_string();
let channel = line.get(0).unwrap_or(empty);
let channel = line.first().unwrap_or(empty);
let eventcode = line.get(1).unwrap_or(empty);
let event_title = line.get(2).unwrap_or(empty);
infodata = EventInfo {
Expand Down
2 changes: 1 addition & 1 deletion src/detections/field_data_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ mod tests {
fn build_yaml(s: &str) -> Yaml {
YamlLoader::load_from_str(s)
.unwrap_or_default()
.get(0)
.first()
.unwrap()
.clone()
}
Expand Down
Loading