Skip to content

Commit

Permalink
Merge pull request #298 from Moonlight-Panel/AddProxyScan
Browse files Browse the repository at this point in the history
Added proxy scan
  • Loading branch information
Masu-Baumgartner authored Aug 30, 2023
2 parents 71a8839 + 42a0115 commit c549d45
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
36 changes: 36 additions & 0 deletions Moonlight/App/MalwareScans/ProxyScan.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using Moonlight.App.Database.Entities;
using Moonlight.App.Models.Misc;
using Moonlight.App.Services;

namespace Moonlight.App.MalwareScans;

public class ProxyScan : MalwareScan
{
public override string Name => "Proxy software";
public override string Description => "Software to use nodes as a proxy";
public override async Task<MalwareScanResult?> Scan(Server server, IServiceProvider serviceProvider)
{
var serverService = serviceProvider.GetRequiredService<ServerService>();
var access = await serverService.CreateFileAccess(server, null!);

var files = await access.Ls();

foreach (var file in files.Where(x => x.Name.EndsWith(".sh")))
{
var fileContent = await access.Read(file);
var processableContent = fileContent.ToLower();

if (processableContent.Contains("t-e-s-tweb"))
{
return new MalwareScanResult()
{
Title = "Proxy software",
Description = "Software to use nodes as a proxy",
Author = "Marcel Baumgartner"
};
}
}

return null;
}
}
3 changes: 2 additions & 1 deletion Moonlight/App/Services/MalwareScanService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ public MalwareScanService(PluginService pluginService, IServiceScopeFactory serv
new MinerJarScan(),
new SelfBotCodeScan(),
new FakePlayerPluginScan(),
new MinerScan()
new MinerScan(),
new ProxyScan()
};

var scans = await PluginService.BuildMalwareScans(defaultScans.ToArray());
Expand Down

0 comments on commit c549d45

Please sign in to comment.