mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-02-11 09:24:58 +00:00
Fix the FileEventMonitor.cs
This commit is contained in:
parent
a18229afea
commit
91b73186d3
|
@ -114,13 +114,13 @@ namespace WelsonJS.Service
|
|||
|
||||
if (File.Exists(fileName))
|
||||
{
|
||||
parent.Log($"File created: {fileName}");
|
||||
parent.DispatchServiceEvent("fileCreated", new string[] {
|
||||
parent.Log($"> Detected the file creation: {fileName}");
|
||||
parent.Log(parent.DispatchServiceEvent("fileCreated", new string[] {
|
||||
ruleName,
|
||||
processId,
|
||||
image,
|
||||
fileName
|
||||
});
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -135,13 +135,15 @@ namespace WelsonJS.Service
|
|||
string protocol = e.EventRecord.Properties[(int)NetworkConnectionEvent.Protocol]?.Value?.ToString();
|
||||
string destinationIp = e.EventRecord.Properties[(int)NetworkConnectionEvent.DestinationIp]?.Value?.ToString();
|
||||
string desinationPort = e.EventRecord.Properties[(int)NetworkConnectionEvent.DestinationPort]?.Value?.ToString();
|
||||
string dstinationAddress = $"{protocol}://{destinationIp}:{desinationPort}";
|
||||
|
||||
parent.DispatchServiceEvent("networkConnected", new string[] {
|
||||
parent.Log($"> Detected the network connection: {dstinationAddress}");
|
||||
parent.Log(parent.DispatchServiceEvent("networkConnected", new string[] {
|
||||
ruleName,
|
||||
processId,
|
||||
image,
|
||||
$"{protocol}://{destinationIp}:{desinationPort}"
|
||||
});
|
||||
dstinationAddress
|
||||
}));
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
|
@ -9,7 +9,6 @@ using System.ServiceProcess;
|
|||
using Grpc.Net.Client;
|
||||
using Grpc.Net.Client.Web;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
|
||||
namespace WelsonJS.Service
|
||||
{
|
||||
|
|
3
app.js
3
app.js
|
@ -626,10 +626,9 @@ function dispatchServiceEvent(name, eventType, w_args, argl) {
|
|||
start: bind("ServiceStart"),
|
||||
stop: bind("ServiceStop"),
|
||||
elapsedTime: bind("ServiceElapsedTime"),
|
||||
messageReceived: bind("MessageReceived"),
|
||||
screenTime: bind("ServiceScreenTime"),
|
||||
fileCreated: bind("FileCreated"),
|
||||
fileRuleMatched: bind("FileRuleMatched")
|
||||
networkConnected: bind("NetworkConnected")
|
||||
});
|
||||
} else {
|
||||
console.error("Could not find", name + ".js");
|
||||
|
|
|
@ -32,8 +32,8 @@ function onFileCreated(args) {
|
|||
return "onFileCreated recevied. " + args.join(', ');
|
||||
}
|
||||
|
||||
function onFileRuleMatched(args) {
|
||||
return "onFileCreated recevied. " + args.join(', ');
|
||||
function onNetworkConnected(args) {
|
||||
return "onNetworkConnected recevied. " + args.join(', ');
|
||||
}
|
||||
|
||||
exports.main = main;
|
||||
|
@ -43,4 +43,4 @@ exports.onServiceStop = onServiceStop;
|
|||
exports.onServiceElapsedTime = onServiceElapsedTime;
|
||||
exports.onServiceScreenTime = onServiceScreenTime;
|
||||
exports.onFileCreated = onFileCreated;
|
||||
exports.onFileRuleMatched = onFileRuleMatched;
|
||||
exports.onNetworkConnected = onNetworkConnected;
|
||||
|
|
Loading…
Reference in New Issue
Block a user