public RequestBuilder(Client client, AuthType authType, double latitude, double longitude, double altitude, float speed, ISettings settings) { _client = client; _authType = authType; _latitude = latitude; _longitude = longitude; _altitude = altitude; // Add small variance to speed. _speed = speed + ((float)Math.Round(GenRandom(-1, 1), 7)); // If speed is 0 or negative, make it random. if (_speed <= 0) { _speed = (float)TRandomDevice.Triangular(0.1, 3.1, .8); } _horizontalAccuracy = TRandomDevice.Choice(new List <int>(new int[] { 5, 5, 5, 5, 10, 10, 10 })); _settings = settings; if (SessionHash == null) { GenerateNewHash(); } //TODO cleanup later //if (_crypt == null) // _crypt = new Crypt(); }
public RequestBuilder(Client client, string authToken, AuthType authType, double latitude, double longitude, double altitude, float speed, ISettings settings, AuthTicket authTicket = null) { _client = client; _authToken = authToken; _authType = authType; _latitude = latitude; _longitude = longitude; _altitude = altitude; // Add small variance to speed. _speed = speed + ((float)Math.Round(GenRandom(-1, 1), 7)); // If speed is 0 or negative, make it random. if (_speed <= 0) { _speed = (float)TRandomDevice.Triangular(0.1, 3.1, .8); } _horizontalAccuracy = TRandomDevice.Choice(new List <double>(new double[] { 5, 5, 5, 5, 10, 10, 10, 30, 30, 50, 65, GenRandom(66, 80) })); _settings = settings; _authTicket = authTicket; if (SessionHash == null) { GenerateNewHash(); } if (_crypt == null) { _crypt = new Crypt(); } }
public static async Task <AccountCreationResult> Create(AccountCreationOptions options) { var random = new TRandom(); var client = new RestClient { Proxy = options.Proxy }; var page = client.Execute(new RestRequest("https://club.pokemon.com/us/pokemon-trainer-club/sign-up/", Method.GET)); var csrf = string.Empty; // Get CSRF var match = new Regex("<input type='hidden' name='csrfmiddlewaretoken' value='(\\w+)' />").Match(page.Content); if (match.Success) { csrf = match.Groups[1].Value; } client.Execute(new RestRequest("https://club.pokemon.com/us/pokemon-trainer-club/sign-up/", Method.POST) .AddParameter("csrfmiddlewaretoken", csrf) .AddParameter("dob", options.Dob) .AddParameter("country", "US") .AddParameter("country", "US") .AddParameter("picker__year", options.Dob.Split('-')[0]) .AddParameter("picker__month", options.Dob.Split('-')[1])); await Task.Delay(random.Next(2000, 3000)); var user = client.Execute <VerifyUsernameResponse>(new RestRequest("https://club.pokemon.com/api/signup/" + "verify-username", Method.POST) .AddJsonBody(new { name = options.Username }) .AddHeader("X-CSRFToken", csrf)); // If username is in use, switch to a random suggestion from PTC if (user.Data.InUse) { options.Username = random.Choice(user.Data.Suggestions); } var captcha = options.CaptchaService.Solve(); await Task.Delay(random.Next(1500, 2500)); var res = client.Execute(new RestRequest("https://club.pokemon.com/us/pokemon-trainer-club/sign-up/", Method .POST) .AddParameter("csrfmiddlewaretoken", csrf) .AddParameter("username", options.Username)); return(new AccountCreationResult { Successful = res.StatusCode == HttpStatusCode.Found, Username = options.Username, Password = options.Password }); }
public async ValueTask ExecuteAsync(IConsole console) { var channels = ChannelIds?.UnJoin('|').ToArray(); // make a new app context with a custom region defined var appCtx = new PipeAppCtx(AppCtx) { CustomRegion = () => Rand.Choice(Regions) }; // run the work using the pipe entry point, forced to be local PipeAppCfg.Location = PipeRunLocation.Local; var pipeCtx = new PipeCtx(PipeAppCfg, appCtx, PipeCtx.Store, PipeCtx.Log); await pipeCtx.Run((YtCollector d) => d.Collect(PipeArg.Inject <ILogger>(), ForceUpdate, false, channels, PipeArg.Inject <CancellationToken>())); }
public static Region RandomUsRegion() => Rand.Choice(Regions);
private async Task <RequestEnvelope.Types.PlatformRequest> GenerateSignature(RequestEnvelope requestEnvelope, GeoCoordinate currentLocation) { byte[] ticketBytes = requestEnvelope.AuthTicket != null?requestEnvelope.AuthTicket.ToByteArray() : requestEnvelope.AuthInfo.ToByteArray(); // Common device info var deviceInfo = new Signature.Types.DeviceInfo { DeviceId = _settings.DeviceId, DeviceBrand = _settings.DeviceBrand, DeviceModel = _settings.DeviceModel, DeviceModelBoot = _settings.DeviceModelBoot + "\0", HardwareManufacturer = _settings.HardwareManufacturer, HardwareModel = _settings.HardwareModel + "\0", FirmwareBrand = (_settings.DeviceModel == "iPhone" ? "iOS" : "iPhone OS"), FirmwareType = _settings.FirmwareType }; // Android if (_client.Platform == Platform.Android) { deviceInfo.AndroidBoardName = _settings.AndroidBoardName; deviceInfo.AndroidBootloader = _settings.AndroidBootloader; deviceInfo.DeviceModelIdentifier = _settings.DeviceModelIdentifier; deviceInfo.FirmwareTags = _settings.FirmwareTags; deviceInfo.FirmwareFingerprint = _settings.FirmwareFingerprint; } var sig = new Signature { SessionHash = _sessionHash, Unknown25 = _client.Unknown25, Timestamp = (ulong)Utils.GetTime(true), TimestampSinceStart = (ulong)(Utils.GetTime(true) - _client.StartTime), DeviceInfo = deviceInfo }; if (sig.TimestampSinceStart < 5000) { sig.TimestampSinceStart = (ulong)TRandomDevice.Next(5000, 8000); } var sen = new Signature.Types.SensorInfo() { LinearAccelerationX = TRandomDevice.Triangular(-3, 1, 0), LinearAccelerationY = TRandomDevice.Triangular(-2, 3, 0), LinearAccelerationZ = TRandomDevice.Triangular(-4, 2, 0), MagneticFieldX = TRandomDevice.Triangular(-50, 50, 0), MagneticFieldY = TRandomDevice.Triangular(-60, 50, -5), MagneticFieldZ = TRandomDevice.Triangular(-60, 40, -30), MagneticFieldAccuracy = TRandomDevice.Choice(new List <int>(new int[] { -1, 1, 1, 2, 2, 2, 2 })), AttitudePitch = TRandomDevice.Triangular(-1.5, 1.5, 0.2), AttitudeYaw = TRandomDevice.NextDouble(-3, 3), AttitudeRoll = TRandomDevice.Triangular(-2.8, 2.5, 0.25), RotationRateX = TRandomDevice.Triangular(-6, 4, 0), RotationRateY = TRandomDevice.Triangular(-5.5, 5, 0), RotationRateZ = TRandomDevice.Triangular(-5, 3, 0), GravityX = TRandomDevice.Triangular(-1, 1, 0.15), GravityY = TRandomDevice.Triangular(-1, 1, -.2), GravityZ = TRandomDevice.Triangular(-1, .7, -0.8), Status = 3 }; sen.TimestampSnapshot = (ulong)TRandomDevice.NextUInt((uint)(sig.TimestampSinceStart - 5000), (uint)(sig.TimestampSinceStart - 100)); sig.SensorInfo.Add(sen); var locationFix = new Signature.Types.LocationFix { Provider = TRandomDevice.Choice(new List <string>(new string[] { "network", "network", "network", "network", "fused" })), Latitude = (float)currentLocation.Latitude, Longitude = (float)currentLocation.Longitude, Altitude = (float)currentLocation.Altitude, ProviderStatus = 3, LocationType = 1 }; locationFix.TimestampSnapshot = (ulong)TRandomDevice.NextUInt((uint)(sig.TimestampSinceStart - 5000), (uint)(sig.TimestampSinceStart - 1000)); if (requestEnvelope.Accuracy >= 65) { locationFix.HorizontalAccuracy = TRandomDevice.Choice(new List <float>(new float[] { (float)requestEnvelope.Accuracy, 65, 65, TRandomDevice.Next(66, 80), 200 })); if (_client.Platform == Platform.Ios) { locationFix.VerticalAccuracy = (float)TRandomDevice.Triangular(35, 100, 65); } } else { locationFix.HorizontalAccuracy = (float)requestEnvelope.Accuracy; if (_client.Platform == Platform.Ios) { locationFix.VerticalAccuracy = requestEnvelope.Accuracy > 10 ? (float)TRandomDevice.Choice(new List <double>(new double[] { 24, 32, 48, 48, 64, 64, 96, 128 })) : (float)TRandomDevice.Choice(new List <double>(new double[] { 3, 4, 6, 6, 8, 12, 24 })); } } locationFix.HorizontalAccuracy = (float)Math.Round(locationFix.HorizontalAccuracy, GEOLOCATION_PRECISION); locationFix.VerticalAccuracy = (float)Math.Round(locationFix.VerticalAccuracy, GEOLOCATION_PRECISION); if (_client.Platform == Platform.Ios) { sig.ActivityStatus = new Signature.Types.ActivityStatus() { Stationary = true }; sig.ActivityStatus.Tilting |= TRandomDevice.NextDouble() > 0.50; if (TRandomDevice.NextDouble() > 0.95) { // No reading for roughly 1 in 20 updates locationFix.Course = -1; locationFix.Speed = -1; } else { // Course is iOS only. locationFix.Course = GetCourse(); // Speed is iOS only. locationFix.Speed = (float)TRandomDevice.Triangular(0.2, 4.25, 1); } } sig.LocationFix.Add(locationFix); string envelopString = JsonConvert.SerializeObject(requestEnvelope); var hashRequest = new HashRequestContent() { Latitude64 = BitConverter.DoubleToInt64Bits(currentLocation.Latitude), Longitude64 = BitConverter.DoubleToInt64Bits(currentLocation.Longitude), Accuracy64 = BitConverter.DoubleToInt64Bits(requestEnvelope.Accuracy), AuthTicket = ticketBytes, SessionData = _sessionHash.ToByteArray(), Requests = new List <byte[]>(), Timestamp = sig.Timestamp }; foreach (var request in requestEnvelope.Requests) { hashRequest.Requests.Add(request.ToByteArray()); } var res = await _client.Hasher.RequestHashesAsync(hashRequest).ConfigureAwait(false); foreach (var item in res.RequestHashes) { sig.RequestHash.Add(((ulong)item)); } sig.LocationHash1 = (int)res.LocationAuthHash; sig.LocationHash2 = (int)res.LocationHash; var encryptedSignature = new RequestEnvelope.Types.PlatformRequest { Type = PlatformRequestType.SendEncryptedSignature, RequestMessage = new SendEncryptedSignatureRequest { EncryptedSignature = ByteString.CopyFrom(_client.Cryptor.Encrypt(sig.ToByteArray(), (uint)_client.StartTime)) }.ToByteString() }; return(encryptedSignature); }
public static async void Run(string[] args) { var random = new TRandom(); Configuration config; try { config = JsonConvert.DeserializeObject <Configuration>(File.ReadAllText( Directory.GetCurrentDirectory() + "/" + "config.json")); } catch (FileNotFoundException e) { Console.WriteLine("Please create a config.json file to continue."); throw; } Console.Write("Hello and welcome to "); Console.ForegroundColor = ConsoleColor.Magenta; Console.Write("Entropy!\n"); Console.ForegroundColor = ConsoleColor.Gray; Console.WriteLine("How many accounts would you like to create today?"); var acts = int.Parse(Console.ReadLine()); Console.WriteLine($"This generation session will cost you about ${Math.Round(acts * 0.003, 2)} USD " + $"(for {acts} accounts)"); IProxyPool proxyPool; if (File.Exists($"{Directory.GetCurrentDirectory()}/{config.ProxyFile}")) { proxyPool = new StandardProxyPool(ProxyReader.ReadProxies(config.ProxyFile)); } else { proxyPool = new GimmeProxyPool(); } var captcha = new TwoCaptchaService(config.CaptchaKey); Console.WriteLine("OK! Let's go!"); var tasks = new List <Task>(); Status = "OK"; UpdateStats(); for (var i = acts - 1; i >= 0; i--) { tasks.Add(new Task(async() => { var proxy = proxyPool.NextProxy(); ActiveProxies++; for (var x = 0; x < 5; x++) { var username = random.Choice(config.Usernames.Prefix) + random.Choice(config.Usernames.Root) + random.Choice(config.Usernames.Suffix); var password = config.Password.UseStaticPassword ? config.Password.StaticPassword : String.Empty; var ui = new AccountCreationOptions { CaptchaService = captcha, Dob = $"{random.Next(1970, 2000)}-{FormatPTCNumber(random.Next(1, 12))}-{FormatPTCNumber(random.Next(1, 27))}", Proxy = proxy.ToWebProxy(), Username = username, Password = password }; var res = await Creator.Create(ui); if (res.Successful) { Created++; UpdateStats(); await Creator.HandleAccountAfterCreation(config, res); } else { Failed++; UpdateStats(); } } BenchedProxies++; })); } // Go. await Task.WhenAll(tasks); }
static Region GetRegion() => Rand.Choice(Regions);