예제 #1
0
        private RequestEnvelope.Types.PlatformRequest GenerateSignature(IEnumerable <IMessage> requests)
        {
            var sig = new POGOProtos.Networking.Envelopes.Signature();

            sig.TimestampSinceStart = (ulong)_internalWatch.ElapsedMilliseconds;
            sig.Timestamp           = (ulong)DateTime.UtcNow.ToUnixTime();
            sig.SensorInfo          = new POGOProtos.Networking.Envelopes.Signature.Types.SensorInfo()
            {
                GravityZ            = GenRandom(9.8),
                GravityX            = GenRandom(0.02),
                GravityY            = GenRandom(0.3),
                TimestampSnapshot   = (ulong)_internalWatch.ElapsedMilliseconds - 230,
                LinearAccelerationX = GenRandom(0.12271042913198471),
                LinearAccelerationY = GenRandom(-0.015570580959320068),
                LinearAccelerationZ = GenRandom(0.010850906372070313),
                MagneticFieldX      = GenRandom(17.950439453125),
                MagneticFieldY      = GenRandom(-23.36273193359375),
                MagneticFieldZ      = GenRandom(-48.8250732421875),
                RotationVectorX     = GenRandom(-0.0120010357350111),
                RotationVectorY     = GenRandom(-0.04214850440621376),
                RotationVectorZ     = GenRandom(0.94571763277053833),
                GyroscopeRawX       = GenRandom(7.62939453125e-005),
                GyroscopeRawY       = GenRandom(-0.00054931640625),
                GyroscopeRawZ       = GenRandom(0.0024566650390625),
                AccelerometerAxes   = 3
            };
            sig.DeviceInfo = new POGOProtos.Networking.Envelopes.Signature.Types.DeviceInfo()
            {
                DeviceId              = this.DeviceId,
                AndroidBoardName      = this.AndroidBoardName, // might al
                AndroidBootloader     = this.AndroidBootloader,
                DeviceBrand           = this.DeviceBrand,
                DeviceModel           = this.DeviceModel, // might als
                DeviceModelIdentifier = this.DeviceModelIdentifier,
                DeviceModelBoot       = this.DeviceModelBoot,
                HardwareManufacturer  = this.HardwareManufacturer,
                HardwareModel         = this.HardwareModel,
                FirmwareBrand         = this.FirmwareBrand,
                FirmwareTags          = this.FirmwareTags,
                FirmwareType          = this.FirmwareType,
                FirmwareFingerprint   = this.FirmwareFingerprint
            };
            Random r        = new Random();
            int    accuracy = r.Next(15, 50);

            sig.LocationFix.Add(new POGOProtos.Networking.Envelopes.Signature.Types.LocationFix()
            {
                Provider = "gps",

                //Unk4 = 120,
                TimestampSnapshot  = (ulong)_internalWatch.ElapsedMilliseconds - 200,
                Latitude           = (float)_latitude,
                Longitude          = (float)_longitude,
                Altitude           = (float)_altitude,
                HorizontalAccuracy = accuracy,        // Genauigkeit von GPS undso
                ProviderStatus     = 3,
                Floor        = 3,
                LocationType = 1
            });


            //Compute 10
            var x         = new System.Data.HashFunction.xxHash(32, 0x1B845238);
            var firstHash = BitConverter.ToUInt32(x.ComputeHash(_authTicket.ToByteArray()), 0);

            x = new System.Data.HashFunction.xxHash(32, firstHash);
            var locationBytes = BitConverter.GetBytes(_latitude).Reverse()
                                .Concat(BitConverter.GetBytes(_longitude).Reverse())
                                .Concat(BitConverter.GetBytes(_altitude).Reverse()).ToArray();

            sig.LocationHash1 = BitConverter.ToUInt32(x.ComputeHash(locationBytes), 0);
            //Compute 20
            x = new System.Data.HashFunction.xxHash(32, 0x1B845238);
            sig.LocationHash2 = BitConverter.ToUInt32(x.ComputeHash(locationBytes), 0);
            //Compute 24
            x = new System.Data.HashFunction.xxHash(64, 0x1B845238);
            var seed = BitConverter.ToUInt64(x.ComputeHash(_authTicket.ToByteArray()), 0);

            x = new System.Data.HashFunction.xxHash(64, seed);

            foreach (var req in requests)
            {
                sig.RequestHash.Add(BitConverter.ToUInt64(x.ComputeHash(req.ToByteArray()), 0));
            }

            // NEW Random Byte Array every session.
            if (sessionhash_array == null)
            {
                byte[] rByte = new byte[16];
                r.NextBytes(rByte);
                sessionhash_array = rByte;
            }
            sig.SessionHash = ByteString.CopyFrom(sessionhash_array);

            sig.Unknown25 = -8537042734809897855; // Generated via xxHash64("\"b8fa9757195897aae92c53dbcf8a60fb3d86d745\"".ToByteArray(), 0x88533787) | 0.33 Version

            var iv = new byte[32];

            new Random().NextBytes(iv);

            var platformRequest = new RequestEnvelope.Types.PlatformRequest()
            {
                Type           = PlatformRequestType.SendEncryptedSignature,
                RequestMessage = new SendEncryptedSignatureRequest()
                {
                    EncryptedSignature = ByteString.CopyFrom(EncryptionHelper.Encrypt(sig.ToByteArray(), iv)),
                }.ToByteString(),
            };

            return(platformRequest);
        }
예제 #2
0
        private Unknown6 GenerateSignature(IEnumerable <IMessage> requests)
        {
            var sig = new POGOProtos.Networking.Signature();

            sig.TimestampSinceStart = (ulong)_internalWatch.ElapsedMilliseconds;
            sig.Timestamp           = (ulong)DateTime.UtcNow.ToUnixTime();
            sig.SensorInfo          = new POGOProtos.Networking.Signature.Types.SensorInfo()
            {
                AccelNormalizedZ  = GenRandom(9.8),
                AccelNormalizedX  = GenRandom(0.02),
                AccelNormalizedY  = GenRandom(0.3),
                TimestampSnapshot = (ulong)_internalWatch.ElapsedMilliseconds - 230,
                MagnetometerX     = GenRandom(0.12271042913198471),
                MagnetometerY     = GenRandom(-0.015570580959320068),
                MagnetometerZ     = GenRandom(0.010850906372070313),
                AngleNormalizedX  = GenRandom(17.950439453125),
                AngleNormalizedY  = GenRandom(-23.36273193359375),
                AngleNormalizedZ  = GenRandom(-48.8250732421875),
                AccelRawX         = GenRandom(-0.0120010357350111),
                AccelRawY         = GenRandom(-0.04214850440621376),
                AccelRawZ         = GenRandom(0.94571763277053833),
                GyroscopeRawX     = GenRandom(7.62939453125e-005),
                GyroscopeRawY     = GenRandom(-0.00054931640625),
                GyroscopeRawZ     = GenRandom(0.0024566650390625),
                AccelerometerAxes = 3
            };
            sig.DeviceInfo = new POGOProtos.Networking.Signature.Types.DeviceInfo()
            {
                DeviceId              = GetDeviceId(),
                AndroidBoardName      = "msm8994", // might al
                AndroidBootloader     = "unknown",
                DeviceBrand           = "OnePlus",
                DeviceModel           = "OnePlus2", // might als
                DeviceModelIdentifier = "ONE A2003_24_160604",
                DeviceModelBoot       = "qcom",
                HardwareManufacturer  = "OnePlus",
                HardwareModel         = "ONE A2003",
                FirmwareBrand         = "OnePlus2",
                FirmwareTags          = "dev-keys",
                FirmwareType          = "user",
                FirmwareFingerprint   = "OnePlus/OnePlus2/OnePlus2:6.0.1/MMB29M/1447840820:user/release-keys"
            };
            sig.LocationFix.Add(new POGOProtos.Networking.Signature.Types.LocationFix()
            {
                Provider = "network",

                //Unk4 = 120,
                Latitude            = (float)_latitude,
                Longitude           = (float)_longitude,
                Altitude            = (float)_altitude,
                TimestampSinceStart = (ulong)_internalWatch.ElapsedMilliseconds - 200,
                Floor        = 3,
                LocationType = 1
            });

            //Compute 10
            var x         = new System.Data.HashFunction.xxHash(32, 0x1B845238);
            var firstHash = BitConverter.ToUInt32(x.ComputeHash(_authTicket.ToByteArray()), 0);

            x = new System.Data.HashFunction.xxHash(32, firstHash);
            var locationBytes = BitConverter.GetBytes(_latitude).Reverse()
                                .Concat(BitConverter.GetBytes(_longitude).Reverse())
                                .Concat(BitConverter.GetBytes(_altitude).Reverse()).ToArray();

            sig.LocationHash1 = BitConverter.ToUInt32(x.ComputeHash(locationBytes), 0);
            //Compute 20
            x = new System.Data.HashFunction.xxHash(32, 0x1B845238);
            sig.LocationHash2 = BitConverter.ToUInt32(x.ComputeHash(locationBytes), 0);
            //Compute 24
            x = new System.Data.HashFunction.xxHash(64, 0x1B845238);
            var seed = BitConverter.ToUInt64(x.ComputeHash(_authTicket.ToByteArray()), 0);

            x = new System.Data.HashFunction.xxHash(64, seed);
            foreach (var req in requests)
            {
                sig.RequestHash.Add(BitConverter.ToUInt64(x.ComputeHash(req.ToByteArray()), 0));
            }

            //static for now
            sig.Unk22 = ByteString.CopyFrom(new byte[16] {
                0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F
            });


            Unknown6 val = new Unknown6();

            val.RequestType       = 6;
            val.Unknown2          = new Unknown6.Types.Unknown2();
            val.Unknown2.Unknown1 = ByteString.CopyFrom(Encrypt(sig.ToByteArray()));
            return(val);
        }
        private RequestEnvelope.Types.PlatformRequest GenerateSignature(IEnumerable<IMessage> requests)
        {
            var ticketBytes = _authTicket.ToByteArray();
            var sig = new SignalAgglomUpdates()
            {
                EpochTimestampMs = (ulong)Utils.GetTime(true),
                TimestampMsSinceStart = (ulong)(Utils.GetTime(true) - _startTime),
                LocationHashByTokenSeed = (uint)Utils.GenerateLocation1(ticketBytes, _latitude, _longitude, _accuracy),
                LocationHash = (uint)Utils.GenerateLocation2(_latitude, _longitude, _accuracy),
                SensorUpdates = new SignalAgglomUpdates.Types.SensorUpdate()
                {
                    GravityX = GenRandom(-0.31110161542892456, 0.1681540310382843),
                    GravityY = GenRandom(-0.6574847102165222, -0.07290205359458923),
                    GravityZ = GenRandom(-0.9943905472755432, -0.7463029026985168),
                    Timestamp = (ulong)(Utils.GetTime(true) - _startTime - RandomDevice.Next(100, 400)),
                    AccelerationX = GenRandom(-0.139084026217, 0.138112977147),
                    AccelerationY = GenRandom(-0.2, 0.19),
                    AccelerationZ = GenRandom(-0.2, 0.4),
                    MagneticFieldX = GenRandom(-47.149471283, 61.8397789001),
                    MagneticFieldY = GenRandom(-47.149471283, 61.8397789001),
                    MagneticFieldZ = GenRandom(-47.149471283, 5),
                    AttitudePitch = GenRandom(0.0729667818829, 0.0729667818829),
                    AttitudeYaw = GenRandom(-2.788630499244109, 3.0586791383810468),
                    AttitudeRoll = GenRandom(-0.34825887123552773, 0.19347580173737935),
                    RotationRateX = GenRandom(-0.9703824520111084, 0.8556089401245117),
                    RotationRateY = GenRandom(-1.7470258474349976, 1.4218578338623047),
                    RotationRateZ = GenRandom(-0.9681901931762695, 0.8396636843681335),
                    Status = 3
                },
                DeviceInfo = new SignalAgglomUpdates.Types.DeviceInfo()
                {
                    DeviceId = settings.DeviceId,
                    AndroidBoardName = settings.AndroidBoardName,
                    AndroidBootloader = settings.AndroidBootloader,
                    DeviceBrand = settings.DeviceBrand,
                    DeviceModel = settings.DeviceModel,
                    DeviceModelIdentifier = settings.DeviceModelIdentifier,
                    DeviceCommsModel = settings.DeviceModelBoot,
                    HardwareManufacturer = settings.HardwareManufacturer,
                    HardwareModel = settings.HardwareModel,
                    FirmwareBrand = settings.FirmwareBrand,
                    FirmwareTags = settings.FirmwareTags,
                    FirmwareType = settings.FirmwareType,
                    FirmwareFingerprint = settings.FirmwareFingerprint
                }
                };
            if (settings.DeviceBrand == "APPLE")
                sig.LocationUpdates.Add(new SignalAgglomUpdates.Types.LocationUpdate()
                {
                    Name = "fused",
                    TimestampMs = (Utils.GetTime(true) - _startTime - RandomDevice.Next(100, 300)),
                    Latitude = (float)_latitude,
                    Longitude = (float)_longitude,
                    Altitude = (-(float)_altitude) - 13,
                    DeviceSpeed = (float)_currentSpeed,
                    DeviceCourse = -1,
                    HorizontalAccuracy = (float)_accuracy,
                    VerticalAccuracy = RandomDevice.Next(2, 5),
                    ProviderStatus = 3,
                    Floor = 0,
                    LocationType = 1
                });
            else
                sig.LocationUpdates.Add(new SignalAgglomUpdates.Types.LocationUpdate()
                {
                    Name = "fused",
                    TimestampMs = (Utils.GetTime(true) - _startTime - RandomDevice.Next(100, 300)),
                    Latitude = (float)_latitude,
                    Longitude = (float)_longitude,
                    Altitude = (-(float)_altitude) - 13,
                    HorizontalAccuracy = (float)_accuracy,
                    VerticalAccuracy = RandomDevice.Next(2, 5),
                    ProviderStatus = 3,
                    Floor = 0,
                    LocationType = 1
                });

            //Compute 10
            var x = new System.Data.HashFunction.xxHash(32, 0x1B845238);
            var firstHash = BitConverter.ToUInt32(x.ComputeHash(_authTicket.ToByteArray()), 0);
            x = new System.Data.HashFunction.xxHash(32, firstHash);
            var locationBytes = BitConverter.GetBytes(_latitude).Reverse()
                .Concat(BitConverter.GetBytes(_longitude).Reverse())
                .Concat(BitConverter.GetBytes(_accuracy).Reverse()).ToArray();
            sig.LocationHashByTokenSeed = BitConverter.ToUInt32(x.ComputeHash(locationBytes), 0);
            //Compute 20
            x = new System.Data.HashFunction.xxHash(32, 0x1B845238);
            sig.LocationHash = BitConverter.ToUInt32(x.ComputeHash(locationBytes), 0);
            //Compute 24
            x = new System.Data.HashFunction.xxHash(64, 0x1B845238);
            var seed = BitConverter.ToUInt64(x.ComputeHash(_authTicket.ToByteArray()), 0);
            x = new System.Data.HashFunction.xxHash(64, seed);
            foreach (var req in requests)
                sig.RequestHashes.Add(BitConverter.ToUInt64(x.ComputeHash(req.ToByteArray()), 0));

            sig.Field22 = SessionHash;
            //static for now
            sig.Field25 = 7363665268261373700;




            RequestEnvelope.Types.PlatformRequest val = new RequestEnvelope.Types.PlatformRequest();
            val.Type = PlatformRequestType.SendEncryptedSignature;
            SendEncryptedSignatureRequest sigRequest = new SendEncryptedSignatureRequest();
            sigRequest.EncryptedSignature = ByteString.CopyFrom(Encrypt(sig.ToByteArray()));
            val.RequestMessage = sigRequest.ToByteString();
            return val;
            
        }
예제 #4
0
        private Unknown6 GenerateSignature(IEnumerable <IMessage> requests)
        {
            var ticketBytes = _authTicket.ToByteArray();

            Signature.Types.DeviceInfo deviceInfo;
            if (settings.HardwareManufacturer.Equals("Apple", StringComparison.Ordinal))
            {
                // iOS
                deviceInfo = new Signature.Types.DeviceInfo()
                {
                    DeviceId             = settings.DeviceId,
                    DeviceBrand          = settings.DeviceBrand,
                    DeviceModel          = settings.DeviceModel,
                    DeviceModelBoot      = settings.DeviceModelBoot,
                    HardwareManufacturer = settings.HardwareManufacturer,
                    HardwareModel        = settings.HardwareModel,
                    FirmwareBrand        = settings.FirmwareBrand,
                    FirmwareType         = settings.FirmwareType,
                };
            }
            else
            {
                // Android
                deviceInfo = new Signature.Types.DeviceInfo()
                {
                    DeviceId              = settings.DeviceId,
                    AndroidBoardName      = settings.AndroidBoardName,
                    AndroidBootloader     = settings.AndroidBootloader,
                    DeviceBrand           = settings.DeviceBrand,
                    DeviceModel           = settings.DeviceModel,
                    DeviceModelIdentifier = settings.DeviceModelIdentifier,
                    DeviceModelBoot       = settings.DeviceModelBoot,
                    HardwareManufacturer  = settings.HardwareManufacturer,
                    HardwareModel         = settings.HardwareModel,
                    FirmwareBrand         = settings.FirmwareBrand,
                    FirmwareTags          = settings.FirmwareTags,
                    FirmwareType          = settings.FirmwareType,
                    FirmwareFingerprint   = settings.FirmwareFingerprint
                };
            }

            var sig = new Signature()
            {
                Timestamp           = (ulong)Utils.GetTime(true),
                TimestampSinceStart = (ulong)(Utils.GetTime(true) - _startTime),
                LocationHash1       = Utils.GenerateLocation1(ticketBytes, _latitude, _longitude, _altitude),
                LocationHash2       = Utils.GenerateLocation2(_latitude, _longitude, _altitude),
                SensorInfo          = new Signature.Types.SensorInfo()
                {
                    AccelNormalizedX  = GenRandom(-0.31110161542892456, 0.1681540310382843),
                    AccelNormalizedY  = GenRandom(-0.6574847102165222, -0.07290205359458923),
                    AccelNormalizedZ  = GenRandom(-0.9943905472755432, -0.7463029026985168),
                    TimestampSnapshot = (ulong)(Utils.GetTime(true) - _startTime - RandomDevice.Next(100, 400)),
                    MagnetometerX     = GenRandom(-0.139084026217, 0.138112977147),
                    MagnetometerY     = GenRandom(-0.2, 0.19),
                    MagnetometerZ     = GenRandom(-0.2, 0.4),
                    AngleNormalizedX  = GenRandom(-47.149471283, 61.8397789001),
                    AngleNormalizedY  = GenRandom(-47.149471283, 61.8397789001),
                    AngleNormalizedZ  = GenRandom(-47.149471283, 5),
                    AccelRawX         = GenRandom(0.0729667818829, 0.0729667818829),
                    AccelRawY         = GenRandom(-2.788630499244109, 3.0586791383810468),
                    AccelRawZ         = GenRandom(-0.34825887123552773, 0.19347580173737935),
                    GyroscopeRawX     = GenRandom(-0.9703824520111084, 0.8556089401245117),
                    GyroscopeRawY     = GenRandom(-1.7470258474349976, 1.4218578338623047),
                    GyroscopeRawZ     = GenRandom(-0.9681901931762695, 0.8396636843681335),
                    AccelerometerAxes = 3
                },
                DeviceInfo = deviceInfo
            };

            sig.LocationFix.Add(new Signature.Types.LocationFix()
            {
                Provider           = "fused",
                Latitude           = (float)_latitude,
                Longitude          = (float)_longitude,
                Altitude           = (float)_altitude,
                HorizontalAccuracy = (float)Math.Round(GenRandom(50, 250), 7),
                VerticalAccuracy   = RandomDevice.Next(2, 5),
                TimestampSnapshot  = (ulong)(Utils.GetTime(true) - _startTime - RandomDevice.Next(100, 300)),
                ProviderStatus     = 3,
                LocationType       = 1
            });

            foreach (var request in requests)
            {
                sig.RequestHash.Add(Utils.GenerateRequestHash(ticketBytes, request.ToByteArray()));
            }

            sig.SessionHash = SessionHash;
            //sig.Unknown25 = -8537042734809897855; // For 0.33
            sig.Unknown25 = 7363665268261373700; // For 0.35

            Unknown6 val = new Unknown6()
            {
                RequestType = 6,
                Unknown2    = new Unknown6.Types.Unknown2()
                {
                    EncryptedSignature = ByteString.CopyFrom(crypt.Encrypt(sig.ToByteArray()))
                }
            };

            return(val);
        }
예제 #5
0
        private Unknown6 GenerateSignature(IEnumerable <IMessage> requests)
        {
            var sig = new POGOProtos.Networking.Signature();

            sig.TimestampSinceStart = (ulong)_internalWatch.ElapsedMilliseconds;
            sig.Timestamp           = (ulong)DateTime.UtcNow.ToUnixTime();
            sig.SensorInfo          = new POGOProtos.Networking.Signature.Types.SensorInfo()
            {
                AccelNormalizedZ  = GenRandom(9.8),
                AccelNormalizedX  = GenRandom(0.02),
                AccelNormalizedY  = GenRandom(0.3),
                TimestampSnapshot = (ulong)_internalWatch.ElapsedMilliseconds - 230,
                MagnetometerX     = GenRandom(0.12271042913198471),
                MagnetometerY     = GenRandom(-0.015570580959320068),
                MagnetometerZ     = GenRandom(0.010850906372070313),
                AngleNormalizedX  = GenRandom(17.950439453125),
                AngleNormalizedY  = GenRandom(-23.36273193359375),
                AngleNormalizedZ  = GenRandom(-48.8250732421875),
                AccelRawX         = GenRandom(-0.0120010357350111),
                AccelRawY         = GenRandom(-0.04214850440621376),
                AccelRawZ         = GenRandom(0.94571763277053833),
                GyroscopeRawX     = GenRandom(7.62939453125e-005),
                GyroscopeRawY     = GenRandom(-0.00054931640625),
                GyroscopeRawZ     = GenRandom(0.0024566650390625),
                AccelerometerAxes = 3
            };
            sig.DeviceInfo = new POGOProtos.Networking.Signature.Types.DeviceInfo()
            {
                DeviceId              = settings.DeviceId,
                AndroidBoardName      = settings.AndroidBoardName,
                AndroidBootloader     = settings.AndroidBootloader,
                DeviceBrand           = settings.DeviceBrand,
                DeviceModel           = settings.DeviceModel,
                DeviceModelIdentifier = settings.DeviceModelIdentifier,
                DeviceModelBoot       = settings.DeviceModelBoot,
                HardwareManufacturer  = settings.HardwareManufacturer,
                HardwareModel         = settings.HardwareModel,
                FirmwareBrand         = settings.FirmwareBrand,
                FirmwareTags          = settings.FirmwareTags,
                FirmwareType          = settings.FirmwareType,
                FirmwareFingerprint   = settings.FirmwareFingerprint
            };

            float altitude      = 0;
            long  requestLength = 200;

            lock (RandomDevice)
            {
                altitude      = (float)(RandomDevice.NextDouble() * (15 - 10) + 10);
                requestLength = (long)RandomDevice.Next(100, 300);
            }

            sig.LocationFix.Add(new POGOProtos.Networking.Signature.Types.LocationFix()
            {
                Provider = "network",

                //Unk4 = 120,
                Latitude  = (float)_latitude,
                Longitude = (float)_longitude,
                //Altitude = (float)_altitude,
                Altitude            = altitude, //Just random for now
                TimestampSinceStart = (ulong)(_internalWatch.ElapsedMilliseconds - requestLength),
                Floor        = 3,
                LocationType = 1
            });

            //Compute 10
            var x         = new System.Data.HashFunction.xxHash(32, 0x1B845238);
            var firstHash = BitConverter.ToUInt32(x.ComputeHash(_authTicket.ToByteArray()), 0);

            x = new System.Data.HashFunction.xxHash(32, firstHash);
            var locationBytes = BitConverter.GetBytes(_latitude).Reverse()
                                .Concat(BitConverter.GetBytes(_longitude).Reverse())
                                .Concat(BitConverter.GetBytes(_altitude).Reverse()).ToArray();

            sig.LocationHash1 = BitConverter.ToUInt32(x.ComputeHash(locationBytes), 0);
            //Compute 20
            x = new System.Data.HashFunction.xxHash(32, 0x1B845238);
            sig.LocationHash2 = BitConverter.ToUInt32(x.ComputeHash(locationBytes), 0);
            //Compute 24
            x = new System.Data.HashFunction.xxHash(64, 0x1B845238);
            var seed = BitConverter.ToUInt64(x.ComputeHash(_authTicket.ToByteArray()), 0);

            x = new System.Data.HashFunction.xxHash(64, seed);
            foreach (var req in requests)
            {
                sig.RequestHash.Add(BitConverter.ToUInt64(x.ComputeHash(req.ToByteArray()), 0));
            }

            //static for now
            //sig.Unk22 = ByteString.CopyFrom(new byte[16] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F });
            byte[] buffer = new byte[16];

            lock (RandomDevice)
            {
                RandomDevice.NextBytes(buffer);
            }

            sig.Unk22 = ByteString.CopyFrom(buffer);

            Unknown6 val = new Unknown6();

            val.RequestType       = 6;
            val.Unknown2          = new Unknown6.Types.Unknown2();
            val.Unknown2.Unknown1 = ByteString.CopyFrom(Encrypt(sig.ToByteArray()));
            return(val);
        }
예제 #6
0
        private Unknown6 GenerateSignature(IEnumerable <IMessage> requests)
        {
            var accelNextZ = RandomDevice.NextInRange(5.8125, 10.125);        //9,80665
            var accelNextX = RandomDevice.NextInRange(-0.513123, 0.61231567); //Considering we handle phone only in 2 directions
            var accelNextY = Math.Sqrt(96.16744225D - accelNextZ * accelNextZ) * ((accelNextZ > 9.8) ? -1 : 1);
            var sig        = new Signature
            {
                TimestampSinceStart = (ulong)InternalWatch.ElapsedMilliseconds,
                Timestamp           = (ulong)DateTime.UtcNow.ToUnixTime(),
                SensorInfo          = new Signature.Types.SensorInfo()
                {
                    AccelNormalizedZ  = accelNextZ,
                    AccelNormalizedX  = accelNextX,
                    AccelNormalizedY  = accelNextY,
                    TimestampSnapshot = (ulong)InternalWatch.ElapsedMilliseconds - 230,
                    MagnetometerX     = accelNextX * 10,
                    MagnetometerY     = -20 + -20 * accelNextY / 9.8065,
                    MagnetometerZ     = -40 * accelNextZ / 9.8065,
                    AngleNormalizedX  = Math.Acos(accelNextX / 9.8065),
                    AngleNormalizedY  = Math.Acos(accelNextY / 9.8065),
                    AngleNormalizedZ  = Math.Acos(accelNextZ / 9.8065),
                    AccelRawX         = RandomDevice.NextInRange(-0.005, 0.005),
                    AccelRawY         = RandomDevice.NextInRange(0.5, 1),
                    AccelRawZ         = RandomDevice.NextInRange(-0.05, 0.05),
                    GyroscopeRawX     = RandomDevice.NextInRange(-0.0001, 0.0001),
                    GyroscopeRawY     = RandomDevice.NextInRange(-0.0005, 0.0005),
                    GyroscopeRawZ     = RandomDevice.NextInRange(-0.003, 0.003),
                    AccelerometerAxes = 3
                },
                DeviceInfo = new Signature.Types.DeviceInfo()
                {
                    DeviceId              = _settings.DeviceId,
                    AndroidBoardName      = _settings.AndroidBoardName,
                    AndroidBootloader     = _settings.AndroidBootloader,
                    DeviceBrand           = _settings.DeviceBrand,
                    DeviceModel           = _settings.DeviceModel,
                    DeviceModelIdentifier = _settings.DeviceModelIdentifier,
                    DeviceModelBoot       = _settings.DeviceModelBoot,
                    HardwareManufacturer  = _settings.HardwareManufacturer,
                    HardwareModel         = _settings.HardwareModel,
                    FirmwareBrand         = _settings.FirmwareBrand,
                    FirmwareTags          = _settings.FirmwareTags,
                    FirmwareType          = _settings.FirmwareType,
                    FirmwareFingerprint   = _settings.FirmwareFingerprint
                }
            };

            sig.LocationFix.Add(new Signature.Types.LocationFix()
            {
                Provider = "fused",

                //Unk4 = 120,
                Latitude  = (float)_latitude,
                Longitude = (float)_longitude,
                Altitude  = (float)_altitude,
                //TimestampSinceStart = (ulong)InternalWatch.ElapsedMilliseconds - 200,
                TimestampSnapshot  = (ulong)InternalWatch.ElapsedMilliseconds - 200,
                Floor              = 3,
                HorizontalAccuracy = (float)Math.Round(RandomDevice.NextInRange(4, 10), 6),
                VerticalAccuracy   = RandomDevice.Next(3, 7),
                ProviderStatus     = 3,
                LocationType       = 1
            });

            //Compute 10
            var x         = new System.Data.HashFunction.xxHash(32, 0x1B845238);
            var firstHash = BitConverter.ToUInt32(x.ComputeHash(_authTicket.ToByteArray()), 0);

            x = new System.Data.HashFunction.xxHash(32, firstHash);
            var locationBytes = BitConverter.GetBytes(_latitude).Reverse()
                                .Concat(BitConverter.GetBytes(_longitude).Reverse())
                                .Concat(BitConverter.GetBytes(_altitude).Reverse()).ToArray();

            sig.LocationHash1 = BitConverter.ToUInt32(x.ComputeHash(locationBytes), 0);
            //Compute 20
            x = new System.Data.HashFunction.xxHash(32, 0x1B845238);
            sig.LocationHash2 = BitConverter.ToUInt32(x.ComputeHash(locationBytes), 0);
            //Compute 24
            x = new System.Data.HashFunction.xxHash(64, 0x1B845238);
            var seed = BitConverter.ToUInt64(x.ComputeHash(_authTicket.ToByteArray()), 0);

            x = new System.Data.HashFunction.xxHash(64, seed);
            foreach (var req in requests)
            {
                sig.RequestHash.Add(BitConverter.ToUInt64(x.ComputeHash(req.ToByteArray()), 0));
            }

            //static for now
            //sig.Unk22 = ByteString.CopyFrom(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F);
            sig.SessionHash = SessionHash;
            sig.Unknown25   = -7363665268261373700; //-8537042734809897855;



            var val = new Unknown6
            {
                RequestType = 6,
                Unknown2    = new Unknown6.Types.Unknown2 {
                    Unknown1 = ByteString.CopyFrom(Encrypt(sig.ToByteArray()))
                }
            };

            return(val);
        }
예제 #7
0
        private Unknown6 GenerateSignature(IEnumerable <IMessage> requests)
        {
            var accelNextZ = RandomDevice.NextInRange(5.8125, 10.125);        //9,80665
            var accelNextX = RandomDevice.NextInRange(-0.513123, 0.61231567); //Considering we handle phone only in 2 directions
            var accelNextY = Math.Sqrt(96.16744225D - accelNextZ * accelNextZ) * ((accelNextZ > 9.8) ? -1 : 1);

            var sig = new Signature
            {
                TimestampSinceStart = (ulong)_internalWatch.ElapsedMilliseconds,
                Timestamp           = (ulong)DateTime.UtcNow.ToUnixTime(),
                DeviceInfo          = new Signature.Types.DeviceInfo()
                {
                    DeviceId              = _settings.DeviceId,
                    AndroidBoardName      = _settings.AndroidBoardName,
                    AndroidBootloader     = _settings.AndroidBootloader,
                    DeviceBrand           = _settings.DeviceBrand,
                    DeviceModel           = _settings.DeviceModel,
                    DeviceModelIdentifier = _settings.DeviceModelIdentifier,
                    DeviceModelBoot       = _settings.DeviceModelBoot,
                    HardwareManufacturer  = _settings.HardwareManufacturer,
                    HardwareModel         = _settings.HardwareModel,
                    FirmwareBrand         = _settings.FirmwareBrand,
                    FirmwareTags          = _settings.FirmwareTags,
                    FirmwareType          = _settings.FirmwareType,
                    FirmwareFingerprint   = _settings.FirmwareFingerprint
                }
            };

            sig.SensorInfo.Add(new Signature.Types.SensorInfo
            {
                GravityZ              = accelNextZ,
                GravityX              = accelNextX,
                GravityY              = accelNextY,
                TimestampSnapshot     = (ulong)_internalWatch.ElapsedMilliseconds - 230,
                MagneticFieldX        = accelNextX * 10,
                MagneticFieldY        = -20 + -20 * accelNextY / 9.8065,
                MagneticFieldZ        = -40 * accelNextZ / 9.8065,
                AttitudePitch         = Math.Acos(accelNextX / 9.8065),
                AttitudeRoll          = Math.Acos(accelNextY / 9.8065),
                AttitudeYaw           = Math.Acos(accelNextZ / 9.8065),
                LinearAccelerationX   = RandomDevice.NextInRange(-0.005, 0.005),
                LinearAccelerationY   = RandomDevice.NextInRange(0.5, 1),
                LinearAccelerationZ   = RandomDevice.NextInRange(-0.05, 0.05),
                RotationRateX         = RandomDevice.NextInRange(-0.0001, 0.0001),
                RotationRateY         = RandomDevice.NextInRange(-0.0005, 0.0005),
                RotationRateZ         = RandomDevice.NextInRange(-0.003, 0.003),
                MagneticFieldAccuracy = RandomDevice.Next(10),
                Status = 3
            });

            sig.LocationFix.Add(new Signature.Types.LocationFix()
            {
                Provider = "fused",

                //Unk4 = 120,
                Latitude  = (float)_latitude,
                Longitude = (float)_longitude,
                Altitude  = (float)_altitude,
                Speed     = -1,
                Course    = -1,
                //TimestampSinceStart = (ulong)InternalWatch.ElapsedMilliseconds - 200,
                TimestampSnapshot  = (ulong)_internalWatch.ElapsedMilliseconds - 200,
                Floor              = 3,
                HorizontalAccuracy = (float)Math.Round(RandomDevice.NextInRange(4, 10), 6), //10
                VerticalAccuracy   = RandomDevice.Next(3, 7),
                ProviderStatus     = 3,
                LocationType       = 1
            });

            //Compute 10

            byte[] serializedTicket = _authTicket.ToByteArray();

            uint firstHash = HashBuilder.Hash32(serializedTicket);

            var locationBytes = BitConverter.GetBytes(_latitude).Reverse()
                                .Concat(BitConverter.GetBytes(_longitude).Reverse())
                                .Concat(BitConverter.GetBytes(_altitude).Reverse()).ToArray();

            sig.LocationHash1 = HashBuilder.Hash32Salt(locationBytes, firstHash);

            //Compute 20
            sig.LocationHash2 = HashBuilder.Hash32(locationBytes);

            //Compute 24
            ulong seed = HashBuilder.Hash64(_authTicket.ToByteArray());

            foreach (var req in requests)
            {
                sig.RequestHash.Add(HashBuilder.Hash64Salt64(req.ToByteArray(), seed));
            }

            //static for now
            //sig.Unk22 = ByteString.CopyFrom(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F);
            sig.SessionHash = SessionHash;
            sig.Unknown25   = 16892874496697272497; //16892874496697272497; //7363665268261373700; //-8537042734809897855;



            var val = new Unknown6
            {
                RequestType = 6,
                Unknown2    = new Unknown6.Types.Unknown2 {
                    Unknown1 = ByteString.CopyFrom(PCrypt.encrypt(sig.ToByteArray(), (uint)sig.TimestampSinceStart))
                }
            };

            return(val);
        }
예제 #8
0
        private RequestEnvelope.Types.PlatformRequest GenerateSignature(IEnumerable <IMessage> requests)
        {
            byte[] ticket = _authTicket.ToByteArray();

            if (sessionhash_array == null)
            {
                byte[] rByte = new byte[16];
                Random ra    = new Random();
                ra.NextBytes(rByte);
                sessionhash_array = rByte;
            }
            // Device
            Signature.Types.DeviceInfo dInfo = new Signature.Types.DeviceInfo
            {
                DeviceId              = this.DeviceId,
                AndroidBoardName      = this.AndroidBoardName, // might al
                AndroidBootloader     = this.AndroidBootloader,
                DeviceBrand           = this.DeviceBrand,
                DeviceModel           = this.DeviceModel, // might als
                DeviceModelIdentifier = this.DeviceModelIdentifier,
                DeviceModelBoot       = this.DeviceModelBoot,
                HardwareManufacturer  = this.HardwareManufacturer,
                HardwareModel         = this.HardwareModel,
                FirmwareBrand         = this.FirmwareBrand,
                FirmwareTags          = this.FirmwareTags,
                FirmwareType          = this.FirmwareType,
                FirmwareFingerprint   = this.FirmwareFingerprint
            };

            var sig = new Signature
            {
                SessionHash         = ByteString.CopyFrom(sessionhash_array),
                Unknown25           = -8408506833887075802, // Could change every Update
                TimestampSinceStart = (ulong)(Utils.GetTime(true) - _client.StartTime),
                Timestamp           = (ulong)DateTime.UtcNow.ToUnixTime(),
                LocationHash1       = Utils.GenLocation1(ticket, _latitude, _longitude, _altitude),
                LocationHash2       = Utils.GenLocation2(_latitude, _longitude, _altitude),
                DeviceInfo          = dInfo
            };

            sig.SensorInfo.Add(new POGOProtos.Networking.Envelopes.Signature.Types.SensorInfo
            {
                GravityZ              = GenRandom(9.8),
                GravityX              = GenRandom(0.02),
                GravityY              = GenRandom(0.3),
                TimestampSnapshot     = (ulong)(Utils.GetTime(true) - _client.StartTime - RandomDevice.Next(100, 500)),
                LinearAccelerationX   = GenRandom(0.12271042913198471),
                LinearAccelerationY   = GenRandom(-0.015570580959320068),
                LinearAccelerationZ   = GenRandom(0.010850906372070313),
                MagneticFieldX        = GenRandom(17.950439453125),
                MagneticFieldY        = GenRandom(-23.36273193359375),
                MagneticFieldZ        = GenRandom(-48.8250732421875),
                RotationRateX         = GenRandom(-0.0120010357350111),
                RotationRateY         = GenRandom(-0.04214850440621376),
                RotationRateZ         = GenRandom(0.94571763277053833),
                AttitudePitch         = GenRandom(-47.149471283, 61.8397789001),
                AttitudeYaw           = GenRandom(-47.149471283, 61.8397789001),
                AttitudeRoll          = GenRandom(-47.149471283, 5),
                MagneticFieldAccuracy = -1,
                Status = 3
            });
            Random r        = new Random();
            int    accuracy = r.Next(15, 50);

            sig.LocationFix.Add(new POGOProtos.Networking.Envelopes.Signature.Types.LocationFix()
            {
                Provider           = "gps",
                TimestampSnapshot  = (ulong)(Utils.GetTime(true) - _client.StartTime - RandomDevice.Next(100, 300)),
                Latitude           = (float)_latitude,
                Longitude          = (float)_longitude,
                Altitude           = (float)_altitude,
                HorizontalAccuracy = accuracy,        // Genauigkeit von GPS undso
                ProviderStatus     = 3,
                Floor        = 3,
                LocationType = 1
            });

            foreach (var requst in requests)
            {
                sig.RequestHash.Add(Utils.GenRequestHash(ticket, requst.ToByteArray()));
            }

            var encryptedSig = new RequestEnvelope.Types.PlatformRequest
            {
                Type           = PlatformRequestType.SendEncryptedSignature,
                RequestMessage = new SendEncryptedSignatureRequest
                {
                    EncryptedSignature = ByteString.CopyFrom(PCrypt.Encrypt(sig.ToByteArray(), (uint)_client.StartTime))
                }.ToByteString()
            };

            return(encryptedSig);
        }
        private Unknown6 GenerateSignature(IEnumerable <IMessage> requests)
        {
            var sig = new Signature();

            sig.TimestampSinceStart = (ulong)(Utils.GetTime(true) - _startTime);
            sig.Timestamp           = (ulong)DateTime.UtcNow.ToUnixTime();
            sig.SensorInfo          = new Signature.Types.SensorInfo()
            {
                AccelNormalizedX  = GenRandom(-0.31110161542892456, 0.1681540310382843),
                AccelNormalizedY  = GenRandom(-0.6574847102165222, -0.07290205359458923),
                AccelNormalizedZ  = GenRandom(-0.9943905472755432, -0.7463029026985168),
                TimestampSnapshot = (ulong)(Utils.GetTime(true) - _startTime - RandomDevice.Next(100, 400)),
                MagnetometerX     = GenRandom(-0.139084026217, 0.138112977147),
                MagnetometerY     = GenRandom(-0.2, 0.19),
                MagnetometerZ     = GenRandom(-0.2, 0.4),
                AngleNormalizedX  = GenRandom(-47.149471283, 61.8397789001),
                AngleNormalizedY  = GenRandom(-47.149471283, 61.8397789001),
                AngleNormalizedZ  = GenRandom(-47.149471283, 5),
                AccelRawX         = GenRandom(0.0729667818829, 0.0729667818829),
                AccelRawY         = GenRandom(-2.788630499244109, 3.0586791383810468),
                AccelRawZ         = GenRandom(-0.34825887123552773, 0.19347580173737935),
                GyroscopeRawX     = GenRandom(-0.9703824520111084, 0.8556089401245117),
                GyroscopeRawY     = GenRandom(-1.7470258474349976, 1.4218578338623047),
                GyroscopeRawZ     = GenRandom(-0.9681901931762695, 0.8396636843681335),
                AccelerometerAxes = 3
            };

            sig.DeviceInfo = new POGOProtos.Networking.Signature.Types.DeviceInfo();
            if (settings.DeviceId != null)
            {
                sig.DeviceInfo.DeviceId = settings.DeviceId;
            }
            if (settings.AndroidBoardName != null)
            {
                sig.DeviceInfo.AndroidBoardName = settings.AndroidBoardName;
            }
            if (settings.AndroidBootloader != null)
            {
                sig.DeviceInfo.AndroidBootloader = settings.AndroidBootloader;
            }
            if (settings.DeviceBrand != null)
            {
                sig.DeviceInfo.DeviceBrand = settings.DeviceBrand;
            }
            if (settings.DeviceModel != null)
            {
                sig.DeviceInfo.DeviceModel = settings.DeviceModel;
            }
            if (settings.DeviceModelIdentifier != null)
            {
                sig.DeviceInfo.DeviceModelIdentifier = settings.DeviceModelIdentifier;
            }
            if (settings.DeviceModelBoot != null)
            {
                sig.DeviceInfo.DeviceModelBoot = settings.DeviceModelBoot;
            }
            if (settings.HardwareManufacturer != null)
            {
                sig.DeviceInfo.HardwareManufacturer = settings.HardwareManufacturer;
            }
            if (settings.HardwareModel != null)
            {
                sig.DeviceInfo.HardwareModel = settings.HardwareModel;
            }
            if (settings.FirmwareBrand != null)
            {
                sig.DeviceInfo.FirmwareBrand = settings.FirmwareBrand;
            }
            if (settings.FirmwareTags != null)
            {
                sig.DeviceInfo.FirmwareTags = settings.FirmwareTags;
            }
            if (settings.FirmwareType != null)
            {
                sig.DeviceInfo.FirmwareType = settings.FirmwareType;
            }
            if (settings.FirmwareFingerprint != null)
            {
                sig.DeviceInfo.FirmwareFingerprint = settings.FirmwareFingerprint;
            }

            sig.LocationFix.Add(new POGOProtos.Networking.Signature.Types.LocationFix()
            {
                Provider           = "fused",
                Latitude           = (float)_latitude,
                Longitude          = (float)_longitude,
                Altitude           = (float)_altitude,
                HorizontalAccuracy = (float)Math.Round(GenRandom(50, 250), 7),
                VerticalAccuracy   = RandomDevice.Next(2, 5),
                //TimestampSnapshot = (ulong)(Utils.GetTime(true) - _startTime - RandomDevice.Next(100, 300)),
                ProviderStatus = 3,
                LocationType   = 1
            });

            //Compute 10
            var x         = new System.Data.HashFunction.xxHash(32, 0x1B845238);
            var firstHash = BitConverter.ToUInt32(x.ComputeHash(_authTicket.ToByteArray()), 0);

            x = new System.Data.HashFunction.xxHash(32, firstHash);
            var locationBytes = BitConverter.GetBytes(_latitude).Reverse()
                                .Concat(BitConverter.GetBytes(_longitude).Reverse())
                                .Concat(BitConverter.GetBytes(_altitude).Reverse()).ToArray();

            sig.LocationHash1 = BitConverter.ToUInt32(x.ComputeHash(locationBytes), 0);
            //Compute 20
            x = new System.Data.HashFunction.xxHash(32, 0x1B845238);
            sig.LocationHash2 = BitConverter.ToUInt32(x.ComputeHash(locationBytes), 0);
            //Compute 24
            x = new System.Data.HashFunction.xxHash(64, 0x1B845238);
            var seed = BitConverter.ToUInt64(x.ComputeHash(_authTicket.ToByteArray()), 0);

            x = new System.Data.HashFunction.xxHash(64, seed);
            foreach (var req in requests)
            {
                sig.RequestHash.Add(BitConverter.ToUInt64(x.ComputeHash(req.ToByteArray()), 0));
            }

            //static for now
            sig.Unk22 = ByteString.CopyFrom(new byte[16] {
                0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F
            });


            Unknown6 val = new Unknown6();

            val.RequestType       = 6;
            val.Unknown2          = new Unknown6.Types.Unknown2();
            val.Unknown2.Unknown1 = ByteString.CopyFrom(Encrypt(sig.ToByteArray()));
            return(val);
        }
예제 #10
0
        private Unknown6 GenerateSignature(IEnumerable <IMessage> requests)
        {
            var ticketBytes = _authTicket.ToByteArray(); //Added
            var sig         = new Signature()
            {
                LocationHash1 = Utils.GenerateLocation1(ticketBytes, _latitude, _longitude, _altitude),
                LocationHash2 = Utils.GenerateLocation2(_latitude, _longitude, _altitude),
                SensorInfo    = new Signature.Types.SensorInfo()
                {
                    AccelNormalizedZ  = GenRandom(9.8),
                    AccelNormalizedX  = GenRandom(0.02),
                    AccelNormalizedY  = GenRandom(0.3),
                    TimestampSnapshot = (ulong)_internalWatch.ElapsedMilliseconds - 230,
                    MagnetometerX     = GenRandom(0.12271042913198471),
                    MagnetometerY     = GenRandom(-0.015570580959320068),
                    MagnetometerZ     = GenRandom(0.010850906372070313),
                    AngleNormalizedX  = GenRandom(17.950439453125),
                    AngleNormalizedY  = GenRandom(-23.36273193359375),
                    AngleNormalizedZ  = GenRandom(-48.8250732421875),
                    AccelRawX         = GenRandom(-0.0120010357350111),
                    AccelRawY         = GenRandom(-0.04214850440621376),
                    AccelRawZ         = GenRandom(0.94571763277053833),
                    GyroscopeRawX     = GenRandom(7.62939453125e-005),
                    GyroscopeRawY     = GenRandom(-0.00054931640625),
                    GyroscopeRawZ     = GenRandom(0.0024566650390625),
                    AccelerometerAxes = 3
                },
                DeviceInfo = new Signature.Types.DeviceInfo()
                {
                    DeviceId              = Client.DeviceId,
                    AndroidBoardName      = Client.AndroidBoardName,
                    AndroidBootloader     = Client.AndroidBootloader,
                    DeviceBrand           = Client.DeviceBrand,
                    DeviceModel           = Client.DeviceModel,
                    DeviceModelIdentifier = Client.DeviceModelIdentifier,
                    DeviceModelBoot       = Client.DeviceModelBoot,
                    HardwareManufacturer  = Client.HardwareManufacturer,
                    HardwareModel         = Client.HardwareModel,
                    FirmwareBrand         = Client.FirmwareBrand,
                    FirmwareTags          = Client.FirmwareTags,
                    FirmwareType          = Client.FirmwareType,
                    FirmwareFingerprint   = Client.FirmwareFingerprint
                }
            };

            sig.LocationFix.Add(new Signature.Types.LocationFix()
            {
                Provider = "network",

                //Unk4 = 120,
                Latitude            = (float)_latitude,
                Longitude           = (float)_longitude,
                Altitude            = (float)_altitude,
                TimestampSinceStart = (ulong)_internalWatch.ElapsedMilliseconds - 200,
                Floor        = 3,
                LocationType = 1
            });

            //Compute 10
            var x         = new System.Data.HashFunction.xxHash(32, 0x1B845238);
            var firstHash = BitConverter.ToUInt32(x.ComputeHash(_authTicket.ToByteArray()), 0);

            x = new System.Data.HashFunction.xxHash(32, firstHash);
            var locationBytes = BitConverter.GetBytes(_latitude).Reverse()
                                .Concat(BitConverter.GetBytes(_longitude).Reverse())
                                .Concat(BitConverter.GetBytes(_altitude).Reverse()).ToArray();

            sig.LocationHash1 = BitConverter.ToUInt32(x.ComputeHash(locationBytes), 0);

            //Compute 20
            x = new System.Data.HashFunction.xxHash(32, 0x1B845238);
            sig.LocationHash2 = BitConverter.ToUInt32(x.ComputeHash(locationBytes), 0);

            //Compute 24
            x = new System.Data.HashFunction.xxHash(64, 0x1B845238);
            var seed = BitConverter.ToUInt64(x.ComputeHash(_authTicket.ToByteArray()), 0);

            x = new System.Data.HashFunction.xxHash(64, seed);

            foreach (var req in requests)
            {
                sig.RequestHash.Add(BitConverter.ToUInt64(x.ComputeHash(req.ToByteArray()), 0));
            }

            Unknown6 val = new Unknown6();

            val.RequestType       = 6;
            val.Unknown2          = new Unknown6.Types.Unknown2();
            val.Unknown2.Unknown1 = ByteString.CopyFrom(Encrypt(sig.ToByteArray()));

            foreach (var request in requests)
            {
                sig.RequestHash.Add(BitConverter.ToUInt64(x.ComputeHash(request.ToByteArray()), 0));
            }

            sig.Unk22 = ByteString.CopyFrom(new byte[16] {
                0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F
            });
            sig.Unk25 = BitConverter.ToUInt32(new System.Data.HashFunction.xxHash(64, 0x88533787).ComputeHash(System.Text.Encoding.ASCII.GetBytes("\"0f15301fe1d0e824738ef5d93355e56a6fb910d4\"")), 0);

            return(val);
        }
예제 #11
0
        private Unknown6 GenerateSignature(IEnumerable <IMessage> requests)
        {
            var sig = new Signature();

            sig.TimestampSinceStart = (ulong)InternalWatch.ElapsedMilliseconds;
            sig.Timestamp           = (ulong)DateTime.UtcNow.ToUnixTime();
            sig.SensorInfo          = new Signature.Types.SensorInfo
            {
                AccelNormalizedZ  = GenRandom(9.8),
                AccelNormalizedX  = GenRandom(0.02),
                AccelNormalizedY  = GenRandom(0.3),
                TimestampSnapshot = (ulong)(InternalWatch.ElapsedMilliseconds - 230L),
                MagnetometerX     = GenRandom(12271042913198472.0),
                MagnetometerY     = GenRandom(-0.015570580959320068),
                MagnetometerZ     = GenRandom(0.010850906372070313),
                AngleNormalizedX  = GenRandom(17.950439453125),
                AngleNormalizedY  = GenRandom(-23.36273193359375),
                AngleNormalizedZ  = GenRandom(-48.8250732421875),
                AccelRawX         = GenRandom(-0.0120010357350111),
                AccelRawY         = GenRandom(-0.04214850440621376),
                AccelRawZ         = GenRandom(0.94571763277053833),
                GyroscopeRawX     = GenRandom(7.62939453125E-05),
                GyroscopeRawY     = GenRandom(-0.00054931640625),
                GyroscopeRawZ     = GenRandom(0.0024566650390625),
                AccelerometerAxes = 3uL
            };
            sig.DeviceInfo = new Signature.Types.DeviceInfo
            {
                DeviceId              = (_settings.DeviceId ?? $"1{RandomDevice.Next(12345)}"),
                AndroidBoardName      = (_settings.AndroidBoardName ?? $"plsnobanerino{RandomDevice.Next(12345)}"),
                AndroidBootloader     = (_settings.AndroidBootloader ?? $"andriod{RandomDevice.Next(12345)}"),
                DeviceBrand           = (_settings.DeviceBrand ?? $"samsung{RandomDevice.Next(12345)}"),
                DeviceModel           = (_settings.DeviceModel ?? $"1.0{RandomDevice.Next(12345)}"),
                DeviceModelIdentifier = (_settings.DeviceModelIdentifier ?? $"1.0{RandomDevice.Next(12345)}"),
                DeviceModelBoot       = (_settings.DeviceModelBoot ?? $"1234{RandomDevice.Next(12345)}"),
                HardwareManufacturer  = (_settings.HardwareManufacturer ?? $"sprint{RandomDevice.Next(12345)}"),
                HardwareModel         = (_settings.HardwareModel ?? $"thisone{RandomDevice.Next(12345)}"),
                FirmwareBrand         = (_settings.FirmwareBrand ?? $"thatone{RandomDevice.Next(12345)}"),
                FirmwareTags          = (_settings.FirmwareTags ?? $"123{RandomDevice.Next(12345)}"),
                FirmwareType          = (_settings.FirmwareType ?? $"n{RandomDevice.Next(12345)}o"),
                FirmwareFingerprint   = (_settings.FirmwareFingerprint ?? $"kth{RandomDevice.Next(12345)}x")
            };
            sig.LocationFix.Add(new Signature.Types.LocationFix
            {
                Provider            = "network",
                Latitude            = (float)_latitude,
                Longitude           = (float)_longitude,
                Altitude            = (float)_altitude,
                TimestampSinceStart = (ulong)(InternalWatch.ElapsedMilliseconds - 200L),
                Floor        = 3u,
                LocationType = 1uL
            });
            var x         = new xxHash(32, 461656632uL);
            var firstHash = BitConverter.ToUInt32(x.ComputeHash(_authTicket.ToByteArray()), 0);

            x = new xxHash(32, (ulong)firstHash);
            var locationBytes = BitConverter.GetBytes(_latitude).Reverse <byte>().Concat(BitConverter.GetBytes(_longitude).Reverse <byte>()).Concat(BitConverter.GetBytes(_altitude).Reverse <byte>()).ToArray <byte>();

            sig.LocationHash1 = BitConverter.ToUInt32(x.ComputeHash(locationBytes), 0);
            x = new xxHash(32, 461656632uL);
            sig.LocationHash2 = BitConverter.ToUInt32(x.ComputeHash(locationBytes), 0);
            x = new xxHash(64, 461656632uL);
            var seed = BitConverter.ToUInt64(x.ComputeHash(_authTicket.ToByteArray()), 0);

            x = new xxHash(64, seed);
            foreach (var req in requests)
            {
                sig.RequestHash.Add(BitConverter.ToUInt64(x.ComputeHash(req.ToByteArray()), 0));
            }
            sig.Unk22 = ByteString.CopyFrom(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
            var val = new Unknown6
            {
                RequestType = 6,
                Unknown2    = new Unknown6.Types.Unknown2 {
                    Unknown1 = ByteString.CopyFrom(Encrypt(sig.ToByteArray()))
                }
            };

            return(val);
        }
예제 #12
0
        private RequestEnvelope.Types.PlatformRequest GenerateSignature(IEnumerable <IMessage> requests)
        {
            var ticketBytes = _authTicket.ToByteArray();

            // Common device info
            Signature.Types.DeviceInfo deviceInfo = new Signature.Types.DeviceInfo
            {
                DeviceId             = _settings.DeviceId,
                DeviceBrand          = _settings.DeviceBrand,
                DeviceModel          = _settings.DeviceModel,
                DeviceModelBoot      = _settings.DeviceModelBoot,
                HardwareManufacturer = _settings.HardwareManufacturer,
                HardwareModel        = _settings.HardwareModel,
                FirmwareBrand        = _settings.FirmwareBrand,
                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_3500_Unknown25,
                Timestamp           = (ulong)Utils.GetTime(true),
                TimestampSinceStart = (ulong)(Utils.GetTime(true) - _client.StartTime),
                LocationHash1       = Utils.GenerateLocation1(ticketBytes, _latitude, _longitude, _horizontalAccuracy),
                LocationHash2       = Utils.GenerateLocation2(_latitude, _longitude, _horizontalAccuracy),
                SensorInfo          = new Signature.Types.SensorInfo
                {
                    TimestampSnapshot   = (ulong)(Utils.GetTime(true) - _client.StartTime - RandomDevice.Next(100, 500)),
                    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),
                    RotationVectorX     = GenRandom(-47.149471283, 61.8397789001),
                    RotationVectorY     = GenRandom(-47.149471283, 61.8397789001),
                    RotationVectorZ     = GenRandom(-47.149471283, 5),
                    GyroscopeRawX       = GenRandom(0.0729667818829, 0.0729667818829),
                    GyroscopeRawY       = GenRandom(-2.788630499244109, 3.0586791383810468),
                    GyroscopeRawZ       = GenRandom(-0.34825887123552773, 0.19347580173737935),
                    GravityX            = TRandomDevice.Triangular(-1, 1, 0.15),
                    GravityY            = TRandomDevice.Triangular(-1, 1, -.2),
                    GravityZ            = TRandomDevice.Triangular(-1, .7, -0.8),
                    AccelerometerAxes   = 3
                },
                DeviceInfo = deviceInfo
            };

            Signature.Types.LocationFix locationFix = new Signature.Types.LocationFix
            {
                Provider           = TRandomDevice.Choice(new List <string>(new string[] { "network", "network", "network", "network", "fused" })),
                Latitude           = (float)_latitude,
                Longitude          = (float)_longitude,
                Altitude           = (float)_altitude,
                HorizontalAccuracy = (float)_horizontalAccuracy,
                TimestampSnapshot  = (ulong)(Utils.GetTime(true) - _client.StartTime - RandomDevice.Next(100, 300)),
                ProviderStatus     = 3,
                LocationType       = 1
            };

            if (_horizontalAccuracy >= 65)
            {
                locationFix.HorizontalAccuracy = (float)TRandomDevice.Choice(new List <double>(new double[] { _horizontalAccuracy, 65, 65, GenRandom(66, 80), 200 }));
                if (_client.Platform == Platform.Ios)
                {
                    locationFix.VerticalAccuracy = (float)TRandomDevice.Triangular(35, 100, 65);
                }
            }
            else
            {
                locationFix.HorizontalAccuracy = (float)_horizontalAccuracy;
                if (_client.Platform == Platform.Ios)
                {
                    if (_horizontalAccuracy > 10)
                    {
                        locationFix.VerticalAccuracy = (float)TRandomDevice.Choice(new List <double>(new double[] { 24, 32, 48, 48, 64, 64, 96, 128 }));
                    }
                    else
                    {
                        locationFix.VerticalAccuracy = (float)TRandomDevice.Choice(new List <double>(new double[] { 3, 4, 6, 6, 8, 12, 24 }));
                    }
                }
            }

            if (_client.Platform == Platform.Ios)
            {
                if (RandomDevice.NextDouble() > 0.95)
                {
                    // No reading for roughly 1 in 20 updates
                    locationFix.Course = -1;
                    locationFix.Speed  = -1;
                }
                else
                {
                    _course = (float)TRandomDevice.Triangular(0, 360, _course);

                    // Course is iOS only.
                    locationFix.Course = _course;

                    // Speed is iOS only.
                    locationFix.Speed = _speed;
                }
            }

            sig.LocationFix.Add(locationFix);

            foreach (var request in requests)
            {
                sig.RequestHash.Add(Utils.GenerateRequestHash(ticketBytes, request.ToByteArray()));
            }

            var encryptedSignature = new RequestEnvelope.Types.PlatformRequest
            {
                Type           = PlatformRequestType.SendEncryptedSignature,
                RequestMessage = new SendEncryptedSignatureRequest
                {
                    EncryptedSignature = ByteString.CopyFrom(_crypt.Encrypt(sig.ToByteArray()))
                }.ToByteString()
            };

            return(encryptedSignature);
        }