diff --git a/WelsonJS.Toolkit/WelsonJS.Service/FileEventMonitor.cs b/WelsonJS.Toolkit/WelsonJS.Service/FileEventMonitor.cs index af407c5..881f935 100644 --- a/WelsonJS.Toolkit/WelsonJS.Service/FileEventMonitor.cs +++ b/WelsonJS.Toolkit/WelsonJS.Service/FileEventMonitor.cs @@ -160,12 +160,16 @@ namespace WelsonJS.Service foreach (var result in results) { - var matches = result.Matches; - foreach (var match in matches) + Dictionary> matches = result.Matches; + foreach (KeyValuePair> match in matches) { - parent.Log($"YARA matched: {match.ToString()}"); - - parent.DispatchServiceEvent("fileRuleMatched", new string[] { filePath, match.ToString() }); + string ruleName = match.Key; + List ruleMatches = match.Value; + ruleMatches.ForEach((x) => + { + parent.Log($"YARA rule matched: {ruleName}, {filePath}"); + parent.DispatchServiceEvent("fileRuleMatched", new string[] { ruleName, filePath }); + }); } } } diff --git a/WelsonJS.Toolkit/WelsonJS.Service/Model/FileRuleMatched.cs b/WelsonJS.Toolkit/WelsonJS.Service/Model/FileRuleMatched.cs new file mode 100644 index 0000000..23eb9f8 --- /dev/null +++ b/WelsonJS.Toolkit/WelsonJS.Service/Model/FileRuleMatched.cs @@ -0,0 +1,12 @@ +using System; + +namespace WelsonJS.Service.Model +{ + public class FileRuleMatched + { + public string Id { get; set; } + public string FilePath { get; set; } + public string RuleName { get; set; } + public DateTime LastChecked { get; set; } + } +} diff --git a/WelsonJS.Toolkit/WelsonJS.Service/WelsonJS.Service.csproj b/WelsonJS.Toolkit/WelsonJS.Service/WelsonJS.Service.csproj index 10555e1..1498e3b 100644 --- a/WelsonJS.Toolkit/WelsonJS.Service/WelsonJS.Service.csproj +++ b/WelsonJS.Toolkit/WelsonJS.Service/WelsonJS.Service.csproj @@ -82,13 +82,50 @@ + + ..\packages\Elastic.Clients.Elasticsearch.8.15.0\lib\net462\Elastic.Clients.Elasticsearch.dll + + + ..\packages\Elastic.Transport.0.4.22\lib\net462\Elastic.Transport.dll + + + ..\packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll + + + ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll + + + ..\packages\System.Diagnostics.DiagnosticSource.8.0.0\lib\net462\System.Diagnostics.DiagnosticSource.dll + + + ..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll + + + + ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll + + + ..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll + + + ..\packages\System.Text.Encodings.Web.8.0.0\lib\net462\System.Text.Encodings.Web.dll + + + ..\packages\System.Text.Json.8.0.4\lib\net462\System.Text.Json.dll + + + ..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll + + + ..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll + diff --git a/WelsonJS.Toolkit/WelsonJS.Service/app.config b/WelsonJS.Toolkit/WelsonJS.Service/app.config index 3e0e37c..f9833da 100644 --- a/WelsonJS.Toolkit/WelsonJS.Service/app.config +++ b/WelsonJS.Toolkit/WelsonJS.Service/app.config @@ -1,3 +1,12 @@ - + - + + + + + + + + + + diff --git a/WelsonJS.Toolkit/WelsonJS.Service/packages.config b/WelsonJS.Toolkit/WelsonJS.Service/packages.config index 08be739..4fe3021 100644 --- a/WelsonJS.Toolkit/WelsonJS.Service/packages.config +++ b/WelsonJS.Toolkit/WelsonJS.Service/packages.config @@ -1,4 +1,17 @@  + + + + + + + + + + + + + \ No newline at end of file