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