Exemplo n.º 1
0
        public FakeProfile Generate()
        {
            FakeProfile rezult = new FakeProfile()
            {
                BrowserTypeType = this.GetAllEnumValues <EBrowserType>(typeof(EBrowserType)).GetRandValue <EBrowserType>(),
                WindowsVersion  = this.GetAllEnumValues <EWindowsVersion>(typeof(EWindowsVersion)).GetRandValue <EWindowsVersion>(),
                IsX64           = RandomNumber.Between(0, 1) == 0
            };

            rezult.UserAgent                    = FakeProfileFactory.GenerateUserAgent(rezult.WindowsVersion, rezult.IsX64);
            rezult.CpuConcurrency               = FakeProfileFactory.CpuConcurrency.GetRandValue <int>();
            rezult.MemoryAvailable              = rezult.CpuConcurrency != 12 ? FakeProfileFactory.MemoryAvailable.Where <int>((Func <int, bool>)(x => x >= rezult.CpuConcurrency)).ToList <int>().GetRandValue <int>() : 8;
            rezult.CanvasFingerPrintHash        = this.GetMd5Hash(rezult.UserAgent + DateTime.Now.ToString((IFormatProvider)CultureInfo.InvariantCulture));
            rezult.BaseLatency                  = this.GenerateBaseLatencyValue();
            rezult.ChannelDataDelta             = this.GenerateRandomInt();
            rezult.ChannelDataIndexDelta        = this.GenerateRandomInt();
            rezult.FloatFrequencyDataDelta      = this.GenerateRandomInt();
            rezult.FloatFrequencyDataIndexDelta = this.GenerateRandomInt();
            rezult.ChromeLanguageInfo           = EChromeLanguageHelper.GetFullInfo(EChromeLanguage.Ru);
            rezult.ScreenSize                   = FakeProfileFactory.ScreenSizes.GetRandValue <ScreenSize>();
            rezult.Fonts = this.GenerateAvailableFonts(rezult.WindowsVersion);
            return(rezult);
        }
Exemplo n.º 2
0
 private static string GenerateUserAgent(EWindowsVersion winVersion, bool isX64)
 {
     return(string.Format("Mozilla/5.0 ({0}{1}) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/{2}.{3} Safari/537.36", (object)FakeProfileFactory.WinVersions[winVersion], (object)FakeProfileFactory.GetX64String(isX64), (object)FakeProfileFactory.ChromeBuildVersion.GetRandValue <string>(), (object)FakeProfileFactory.GenerateRandomChromeVersion(0, 155)));
 }