diff --git a/CHANGELOG-Japanese.md b/CHANGELOG-Japanese.md index b41a62eda..4b6bbb649 100644 --- a/CHANGELOG-Japanese.md +++ b/CHANGELOG-Japanese.md @@ -11,6 +11,7 @@ - `yaml-rust`クレートを`yaml-rust2`に更新した。(#461) (@yamatosecurity) - `windash`文字が、`rules/config/windash_characters.txt`から動的に読み込まれるようになった。(#1440) (@fukusuket) - `logon-summary`コマンドがRDPイベントからのログオン情報を表示するようになった。注意: ファイルに保存する場合、Hayabusaはより詳細な情報を出力する。(#1468) (@fukusuket) +- 見やすくなるように色を更新した。 (#1480) (@yamatosecurity) **バグ修正:** diff --git a/CHANGELOG.md b/CHANGELOG.md index d029149a0..558292316 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ - Updated the `yaml-rust` crate to `yaml-rust2`. (#461) (@yamatosecurity) - `windash` characters are now being dynamically read from `rules/config/windash_characters.txt`. (#1440) (@fukusuket) - `logon-summary` command now displays logon information from RDP events. Note: Hayabusa will output more detailed information when saving to a file. (#1468) (@fukusuket) +- The colors were updated to make it easier to read. (#1480) (@yamatosecurity) **Bug Fixes:** diff --git a/Cargo.lock b/Cargo.lock index 5d95e0305..5fb5ca8d6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -59,6 +59,15 @@ dependencies = [ "libc", ] +[[package]] +name = "ansi_term" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" +dependencies = [ + "winapi", +] + [[package]] name = "anstream" version = "0.6.18" @@ -349,6 +358,16 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" +[[package]] +name = "colored" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8" +dependencies = [ + "lazy_static", + "windows-sys 0.48.0", +] + [[package]] name = "comfy-table" version = "7.1.1" @@ -689,9 +708,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" +checksum = "486f806e73c5707928240ddc295403b1b93c96a02038563881c4a2fd84b81ac4" [[package]] name = "file-chunker" @@ -838,11 +857,13 @@ name = "hayabusa" version = "2.19.0-dev" dependencies = [ "aho-corasick", + "ansi_term", "base64", "bytesize", "chrono", "cidr-utils", "clap", + "colored", "comfy-table", "compact_str", "console", @@ -1211,9 +1232,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.161" +version = "0.2.162" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1" +checksum = "18d287de67fe55fd7e1581fe933d965a5a9477b38e949cfa9f8574ef01506398" [[package]] name = "libgit2-sys" @@ -2064,9 +2085,9 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.13.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" +checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" dependencies = [ "cfg-if", "fastrand", @@ -2136,9 +2157,9 @@ dependencies = [ [[package]] name = "tokio" -version = "1.41.0" +version = "1.41.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "145f3413504347a2be84393cc8a7d2fb4d863b375909ea59f2158261aa258bbb" +checksum = "22cfb5bee7a6a52939ca9224d6ac897bb669134078daa8735560897f69de4d33" dependencies = [ "backtrace", "bytes", diff --git a/Cargo.toml b/Cargo.toml index d8327c33d..451040f1e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,11 +9,13 @@ include = ["src/**/*", "LICENSE.txt", "README.md", "CHANGELOG.md"] [dependencies] aho-corasick = "*" +ansi_term = "0.*" base64 = "*" bytesize = "1.*" chrono = "0.4.*" cidr-utils = "0.6.*" clap = { version = "4.*", features = ["derive", "cargo", "color"]} +colored = "2" comfy-table = "7.*" compact_str = "0.8.*" console = "0.15.*" diff --git a/rules b/rules index 696e677b2..662ec5b93 160000 --- a/rules +++ b/rules @@ -1 +1 @@ -Subproject commit 696e677b22d3fa4323d0712d7706c45c0bef4b9b +Subproject commit 662ec5b93930a68385ab49e0b080ce31f4ac2b2b diff --git a/src/main.rs b/src/main.rs index ec2aef7f4..19b96f70a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -23,6 +23,7 @@ use std::{ use bytesize::ByteSize; use chrono::{DateTime, Datelike, Local, NaiveDateTime, Utc}; use clap::Command; +use colored::Colorize; use compact_str::CompactString; use console::{style, Style}; use dialoguer::Confirm; @@ -779,7 +780,7 @@ impl App { for profile in profile_list.iter() { write_color_buffer( &BufferWriter::stdout(ColorChoice::Always), - Some(Color::Green), + Some(Color::Rgb(0, 255, 0)), &format!("- {:<25}", &format!("{}:", profile[0])), false, ) @@ -1539,20 +1540,27 @@ impl App { } let template = if stored_static.common_options.no_color { - "[{elapsed_precise}] {human_pos} / {human_len} {spinner} [{bar:40}] {percent}%\r\n\r\n{msg}" + "[{elapsed_precise}] {human_pos} / {human_len} {spinner} [{bar:40}] {percent}%\r\n\r\n{msg}".to_string() } else { - "[{elapsed_precise}] {human_pos} / {human_len} {spinner:.green} [{bar:40.green}] {percent}%\r\n\r\n{msg}" + let spinner = "{spinner}".truecolor(0, 255, 0).to_string(); + let bar = "{bar:40}".truecolor(0, 255, 0).to_string(); + format!( + "[{{elapsed_precise}}] {{human_pos}} / {{human_len}} {} [{}] {{percent}}%\r\n\r\n{{msg}}", + spinner, bar + ) }; - let progress_style = ProgressStyle::with_template(template) + + let progress_style = ProgressStyle::with_template(&template) // Pass `&template` here .unwrap() .progress_chars("=> "); + let pb = ProgressBar::with_draw_target( Some(evtx_files.len() as u64), ProgressDrawTarget::stdout_with_hz(10), ) .with_tab_width(55); pb.set_style(progress_style); - // I tried progress bar with low memory option(output log on detection) but it seemts that progress bar didn't go well with low memory option. + // I tried progress bar with low memory option(output log on detection) but it seems that progress bar didn't go well with low memory option. // I disabled progress bar if low memory option is specified. let is_show_progress = !stored_static.is_low_memory || stored_static.output_path.is_some(); if is_show_progress { @@ -2321,7 +2329,7 @@ impl App { let output_color = if stored_static.common_options.no_color { None } else { - Some(Color::Green) + Some(Color::Rgb(0,255,0)) }; write_color_buffer( &BufferWriter::stdout(ColorChoice::Always),