mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-03-11 16:35:13 +00:00
Update FileEventMonitor
This commit is contained in:
parent
15bd7d40db
commit
4ece37fdf4
|
@ -6,6 +6,7 @@ using System.IO;
|
|||
using libyaraNET;
|
||||
using System.Collections.Generic;
|
||||
using System.ServiceProcess;
|
||||
using WelsonJS.Service.Model;
|
||||
|
||||
namespace WelsonJS.Service
|
||||
{
|
||||
|
@ -169,6 +170,14 @@ namespace WelsonJS.Service
|
|||
{
|
||||
parent.Log($"YARA rule matched: {ruleName}, {filePath}, Offset {x.Offset}");
|
||||
parent.DispatchServiceEvent("fileRuleMatched", new string[] { ruleName, filePath, x.Offset.ToString() });
|
||||
|
||||
IndexMatched(new FileRuleMatched
|
||||
{
|
||||
FilePath = filePath,
|
||||
Offset = x.Offset,
|
||||
RuleName = ruleName,
|
||||
LastChecked = DateTime.Now
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -180,6 +189,11 @@ namespace WelsonJS.Service
|
|||
}
|
||||
}
|
||||
|
||||
private void IndexMatched(FileRuleMatched match)
|
||||
{
|
||||
// todo (save result to the search engine)
|
||||
}
|
||||
|
||||
private void Dispose()
|
||||
{
|
||||
if (rules != null)
|
||||
|
|
|
@ -6,6 +6,7 @@ namespace WelsonJS.Service.Model
|
|||
{
|
||||
public string Id { get; set; }
|
||||
public string FilePath { get; set; }
|
||||
public ulong Offset { get; set; }
|
||||
public string RuleName { get; set; }
|
||||
public DateTime LastChecked { get; set; }
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user