Skip to content

Commit 40d0981

Browse files
Merge pull request #1554 from Yamato-Security/1553-fix-unnecessary-output-file
fix: not create unnecessary output file in `logon-summary` and `pivot-keywords-list`
2 parents 6a14a63 + 8a1e3c7 commit 40d0981

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

CHANGELOG-Japanese.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
- チャンネルフィルタリングで `logon-summary` コマンドの速度を大幅に改善した。 (#1544) (@fukusuket)
1313
- `extract-base64`コマンドが`PowerShell Classic EID 400`イベントも対象するようになった。 (#1549) (@fukusuket)
1414

15+
**バグ修正:**
16+
17+
- `logon-summary``pivot-keywords-list`コマンドが不要なファイルを出力していた。 (#1553) (@fukusuket)
18+
1519
## 3.0.1 [2024/12/29] - 3rd Year Anniversary Release
1620

1721
**バグ修正:**

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
- Significantly improved the speed of the `logon-summary` command with channel filtering. (#1544) (@fukusuket)
1313
- The `extract-base64` command now also works on `PowerShell Classic EID 400` events. (#1549) (@fukusuket)
1414

15+
**Bug Fixes:**
16+
17+
- An unneeded file was being created with `logon-summary` and `pivot-keywords-list` commands. (#1553) (@fukusuket)
18+
1519
## 3.0.1 [2024/12/29] - 3rd Year Anniversary Release
1620

1721
**Bug Fixes:**

src/afterfact.rs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,12 +165,19 @@ pub fn init_writer(stored_static: &StoredStatic) -> AfterfactWriter {
165165

166166
let mut display_flag = false;
167167
let target: Box<dyn io::Write> = if let Some(path) = &stored_static.output_path {
168-
// output to file
169-
match File::create(path) {
170-
Ok(file) => Box::new(BufWriter::new(file)),
171-
Err(err) => {
172-
AlertMessage::alert(&format!("Failed to open file. {err}")).ok();
173-
process::exit(1);
168+
if matches!(
169+
stored_static.config.action.as_ref().unwrap(),
170+
Action::PivotKeywordsList(_) | Action::LogonSummary(_)
171+
) {
172+
Box::new(BufWriter::new(io::stdout()))
173+
} else {
174+
// output to file
175+
match File::create(path) {
176+
Ok(file) => Box::new(BufWriter::new(file)),
177+
Err(err) => {
178+
AlertMessage::alert(&format!("Failed to open file. {err}")).ok();
179+
process::exit(1);
180+
}
174181
}
175182
}
176183
} else {

0 commit comments

Comments
 (0)