From e3631abeb3dae12a6491f15bd28979ca95b049bc Mon Sep 17 00:00:00 2001 From: Kazuminn Date: Sun, 4 Oct 2020 16:13:26 +0900 Subject: [PATCH] =?UTF-8?q?add=20test=20:=20white=20list=E3=81=A8=E3=83=9E?= =?UTF-8?q?=E3=83=83=E3=83=81=E3=81=99=E3=82=8B=E6=99=82=E3=81=AF=E3=80=81?= =?UTF-8?q?=E3=81=99=E3=81=90=E3=81=ABreturn=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/detections/utils.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/detections/utils.rs b/src/detections/utils.rs index b50a0db9..04b53b76 100644 --- a/src/detections/utils.rs +++ b/src/detections/utils.rs @@ -28,8 +28,10 @@ pub fn check_command( for entry in rdr.records() { if let Ok(_data) = entry { - if commandline == &_data[0] { - return; + if let Ok(_re) = Regex::new(&_data[0]) { + if _re.is_match(commandline) { + return; + } } } } @@ -220,5 +222,13 @@ mod tests { #[test] fn test_check_command() { utils::check_command(1, "dir", 100, 100, "dir", "dir"); + utils::check_command( + 1, + "\"C:\\Program Files\\Google\\Update\\GoogleUpdate.exe\"", + 100, + 100, + "dir", + "dir", + ); } }