using System;
using System.Diagnostics;
using System.Linq;
class MalwareProtection
{
public static bool IsSuspiciousProcessRunning()
{
// ตรวจสอบ process ที่กำลังทำงานอยู่
string[] suspiciousProcesses = { "malicious.exe", "trojan.exe" }; // ตัวอย่างชื่อโปรแกรมที่ต้องการระวัง
var runningProcesses = Process.GetProcesses().Select(p => p.ProcessName.ToLower());
foreach (var process in suspiciousProcesses)
{
if (runningProcesses.Contains(process))
{
Console.WriteLine("พบกระบวนการที่น่าสงสัย: " + process);
return true;
}
}
Console.WriteLine("ไม่มีโปรเซสที่น่าสงสัย");
return false;
}
static void Main(string[] args)
{
bool suspiciousFound = IsSuspiciousProcessRunning();
if (suspiciousFound)
{
// ปิดโปรเซสที่เป็นอันตรายหรือแจ้งเตือน
}
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uRGlhZ25vc3RpY3M7CnVzaW5nIFN5c3RlbS5MaW5xOwoKY2xhc3MgTWFsd2FyZVByb3RlY3Rpb24KewogICAgcHVibGljIHN0YXRpYyBib29sIElzU3VzcGljaW91c1Byb2Nlc3NSdW5uaW5nKCkKICAgIHsKICAgICAgICAvLyDguJXguKPguKfguIjguKrguK3guJogcHJvY2VzcyDguJfguLXguYjguIHguLPguKXguLHguIfguJfguLPguIfguLLguJnguK3guKLguLnguYgKICAgICAgICBzdHJpbmdbXSBzdXNwaWNpb3VzUHJvY2Vzc2VzID0geyAibWFsaWNpb3VzLmV4ZSIsICJ0cm9qYW4uZXhlIiB9OyAvLyDguJXguLHguKfguK3guKLguYjguLLguIfguIrguLfguYjguK3guYLguJvguKPguYHguIHguKPguKHguJfguLXguYjguJXguYnguK3guIfguIHguLLguKPguKPguLDguKfguLHguIcKCiAgICAgICAgdmFyIHJ1bm5pbmdQcm9jZXNzZXMgPSBQcm9jZXNzLkdldFByb2Nlc3NlcygpLlNlbGVjdChwID0+IHAuUHJvY2Vzc05hbWUuVG9Mb3dlcigpKTsKCiAgICAgICAgZm9yZWFjaCAodmFyIHByb2Nlc3MgaW4gc3VzcGljaW91c1Byb2Nlc3NlcykKICAgICAgICB7CiAgICAgICAgICAgIGlmIChydW5uaW5nUHJvY2Vzc2VzLkNvbnRhaW5zKHByb2Nlc3MpKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgi4Lie4Lia4LiB4Lij4Liw4Lia4Lin4LiZ4LiB4Liy4Lij4LiX4Li14LmI4LiZ4LmI4Liy4Liq4LiH4Liq4Lix4LiiOiAiICsgcHJvY2Vzcyk7CiAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgICAgICAgfQogICAgICAgIH0KCiAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIuC5hOC4oeC5iOC4oeC4teC5guC4m+C4o+C5gOC4i+C4quC4l+C4teC5iOC4meC5iOC4suC4quC4h+C4quC4seC4oiIpOwogICAgICAgIHJldHVybiBmYWxzZTsKICAgIH0KCiAgICBzdGF0aWMgdm9pZCBNYWluKHN0cmluZ1tdIGFyZ3MpCiAgICB7CiAgICAgICAgYm9vbCBzdXNwaWNpb3VzRm91bmQgPSBJc1N1c3BpY2lvdXNQcm9jZXNzUnVubmluZygpOwogICAgICAgIGlmIChzdXNwaWNpb3VzRm91bmQpCiAgICAgICAgewogICAgICAgICAgICAvLyDguJvguLTguJTguYLguJvguKPguYDguIvguKrguJfguLXguYjguYDguJvguYfguJnguK3guLHguJnguJXguKPguLLguKLguKvguKPguLfguK3guYHguIjguYnguIfguYDguJXguLfguK3guJkKICAgICAgICB9CiAgICB9Cn0KCg==