-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #298 from Moonlight-Panel/AddProxyScan
Added proxy scan
- Loading branch information
Showing
2 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters