示例#1
0
 public void ImportData()
 {
     BrakeParts.Import();
     BrakeControllerParts.Import();
     SteerParts.Import();
     ChassisParts.Import();
     LightweightParts.Import();
     RacingModifyParts.Import();
     EngineParts.Import();
     PortPolishParts.Import();
     EngineBalanceParts.Import();
     DisplacementParts.Import();
     ComputerParts.Import();
     NATuneParts.Import();
     TurbineKitParts.Import();
     DrivetrainParts.Import();
     FlywheelParts.Import();
     ClutchParts.Import();
     PropellerShaftParts.Import();
     GearParts.Import();
     SuspensionParts.Import();
     IntercoolerParts.Import();
     MufflerParts.Import();
     LSDParts.Import();
     TiresFrontParts.Import();
     TiresRearParts.Import();
     Unknown1.Import();
     Unknown2.Import();
     Unknown3.Import();
     Unknown4.Import();
     Unknown5.Import();
     Unknown6.Import();
     Unknown7.Import();
     Cars.Import();
 }
示例#2
0
        public override int GetHashCode()
        {
            var hash = 1;

            if (Unknown1 != 0)
            {
                hash ^= Unknown1.GetHashCode();
            }
            if (Unknown2 != 0L)
            {
                hash ^= Unknown2.GetHashCode();
            }
            if (ApiUrl.Length != 0)
            {
                hash ^= ApiUrl.GetHashCode();
            }
            if (unknown6_ != null)
            {
                hash ^= Unknown6.GetHashCode();
            }
            if (auth_ != null)
            {
                hash ^= Auth.GetHashCode();
            }
            hash ^= payload_.GetHashCode();
            if (ErrorMessage.Length != 0)
            {
                hash ^= ErrorMessage.GetHashCode();
            }
            return(hash);
        }
示例#3
0
        public void ReadData(string filename)
        {
            using (FileStream file = new FileStream(filename, FileMode.Open, FileAccess.Read))
            {
                var blocks = new List <DataBlock>();

                for (int i = 1; i <= 34; i++)
                {
                    file.Position = 8 * i;
                    uint blockStart = file.ReadUInt();
                    uint blockSize  = file.ReadUInt();
                    blocks.Add(new DataBlock {
                        BlockStart = blockStart, BlockSize = blockSize
                    });
                }

                BrakeParts.Read(file, blocks[0].BlockStart, blocks[0].BlockSize);
                BrakeControllerParts.Read(file, blocks[1].BlockStart, blocks[1].BlockSize);
                SteerParts.Read(file, blocks[2].BlockStart, blocks[2].BlockSize);
                ChassisParts.Read(file, blocks[3].BlockStart, blocks[3].BlockSize);
                LightweightParts.Read(file, blocks[4].BlockStart, blocks[4].BlockSize);
                RacingModifyParts.Read(file, blocks[5].BlockStart, blocks[5].BlockSize);
                EngineParts.Read(file, blocks[6].BlockStart, blocks[6].BlockSize);
                PortPolishParts.Read(file, blocks[7].BlockStart, blocks[7].BlockSize);
                EngineBalanceParts.Read(file, blocks[8].BlockStart, blocks[8].BlockSize);
                DisplacementParts.Read(file, blocks[9].BlockStart, blocks[9].BlockSize);
                ComputerParts.Read(file, blocks[10].BlockStart, blocks[10].BlockSize);
                NATuneParts.Read(file, blocks[11].BlockStart, blocks[11].BlockSize);
                TurbineKitParts.Read(file, blocks[12].BlockStart, blocks[12].BlockSize);
                DrivetrainParts.Read(file, blocks[13].BlockStart, blocks[13].BlockSize);
                FlywheelParts.Read(file, blocks[14].BlockStart, blocks[14].BlockSize);
                ClutchParts.Read(file, blocks[15].BlockStart, blocks[15].BlockSize);
                PropellerShaftParts.Read(file, blocks[16].BlockStart, blocks[16].BlockSize);
                GearParts.Read(file, blocks[17].BlockStart, blocks[17].BlockSize);
                SuspensionParts.Read(file, blocks[18].BlockStart, blocks[18].BlockSize);
                IntercoolerParts.Read(file, blocks[19].BlockStart, blocks[19].BlockSize);
                MufflerParts.Read(file, blocks[20].BlockStart, blocks[20].BlockSize);
                LSDParts.Read(file, blocks[21].BlockStart, blocks[21].BlockSize);
                TiresFrontParts.Read(file, blocks[22].BlockStart, blocks[22].BlockSize);
                TiresRearParts.Read(file, blocks[23].BlockStart, blocks[23].BlockSize);
                Unknown1.Read(file, blocks[24].BlockStart, blocks[24].BlockSize);
                Unknown2.Read(file, blocks[25].BlockStart, blocks[25].BlockSize);
                Unknown3.Read(file, blocks[26].BlockStart, blocks[26].BlockSize);
                Unknown4.Read(file, blocks[27].BlockStart, blocks[27].BlockSize);
                Unknown5.Read(file, blocks[28].BlockStart, blocks[28].BlockSize);
                Unknown6.Read(file, blocks[29].BlockStart, blocks[29].BlockSize);
                Events.Read(file, blocks[30].BlockStart, blocks[30].BlockSize);
                EnemyCars.Read(file, blocks[31].BlockStart, blocks[31].BlockSize);
                Cars.Read(file, blocks[32].BlockStart, blocks[32].BlockSize);
                CarsSports.Read(file, blocks[33].BlockStart, blocks[33].BlockSize);

                uint stringTableStart = blocks[33].BlockStart + blocks[33].BlockSize;
                RaceStringTable.Read(file, stringTableStart, (uint)file.Length - stringTableStart);
            }
        }
示例#4
0
        public void WriteData(string filename)
        {
            using (FileStream file = new FileStream(filename, FileMode.Create, FileAccess.ReadWrite))
            {
                file.Write(new byte[] { 0x47, 0x54, 0x44, 0x54, 0x6C, 0x00, 0x3E, 0x00 }, 0, 8); // The 0x3E is the number of indices

                file.Position = (0x3E * 8) + 7;
                file.WriteByte(0x00); // Data starts at 0x1F8 so position EOF

                uint i = 1;
                BrakeParts.Write(file, 8 * i++);
                BrakeControllerParts.Write(file, 8 * i++);
                SteerParts.Write(file, 8 * i++);
                ChassisParts.Write(file, 8 * i++);
                LightweightParts.Write(file, 8 * i++);
                RacingModifyParts.Write(file, 8 * i++);
                EngineParts.Write(file, 8 * i++);
                PortPolishParts.Write(file, 8 * i++);
                EngineBalanceParts.Write(file, 8 * i++);
                DisplacementParts.Write(file, 8 * i++);
                ComputerParts.Write(file, 8 * i++);
                NATuneParts.Write(file, 8 * i++);
                TurbineKitParts.Write(file, 8 * i++);
                DrivetrainParts.Write(file, 8 * i++);
                FlywheelParts.Write(file, 8 * i++);
                ClutchParts.Write(file, 8 * i++);
                PropellerShaftParts.Write(file, 8 * i++);
                GearParts.Write(file, 8 * i++);
                SuspensionParts.Write(file, 8 * i++);
                IntercoolerParts.Write(file, 8 * i++);
                MufflerParts.Write(file, 8 * i++);
                LSDParts.Write(file, 8 * i++);
                TiresFrontParts.Write(file, 8 * i++);
                TiresRearParts.Write(file, 8 * i++);
                Unknown1.Write(file, 8 * i++);
                Unknown2.Write(file, 8 * i++);
                Unknown3.Write(file, 8 * i++);
                Unknown4.Write(file, 8 * i++);
                Unknown5.Write(file, 8 * i++);
                Unknown6.Write(file, 8 * i++);
                Unknown7.Write(file, 8 * i++);
                Cars.Write(file, 8 * i++);

                file.Position = 0;
                using (FileStream zipFile = new FileStream(filename + ".gz", FileMode.Create, FileAccess.Write))
                {
                    using (GZipStream zip = new GZipStream(zipFile, CompressionMode.Compress))
                    {
                        file.CopyTo(zip);
                    }
                }
            }
        }
示例#5
0
 public void MergeFrom(Response other)
 {
     if (other == null)
     {
         return;
     }
     if (other.Unknown1 != 0)
     {
         Unknown1 = other.Unknown1;
     }
     if (other.Unknown2 != 0L)
     {
         Unknown2 = other.Unknown2;
     }
     if (other.ApiUrl.Length != 0)
     {
         ApiUrl = other.ApiUrl;
     }
     if (other.unknown6_ != null)
     {
         if (unknown6_ == null)
         {
             unknown6_ = new global::PokemonGo.RocketAPI.GeneratedCode.Response.Types.Unknown6();
         }
         Unknown6.MergeFrom(other.Unknown6);
     }
     if (other.auth_ != null)
     {
         if (auth_ == null)
         {
             auth_ = new global::PokemonGo.RocketAPI.GeneratedCode.Response.Types.Auth();
         }
         Auth.MergeFrom(other.Auth);
     }
     payload_.Add(other.payload_);
     if (other.ErrorMessage.Length != 0)
     {
         ErrorMessage = other.ErrorMessage;
     }
 }
示例#6
0
            public override ListViewItem GetListViewItem()
            {
                ListViewItem m = new ListViewItem("");

                m.SubItems.Add(Position.X.ToString("#####0.############"));
                m.SubItems.Add(Position.Y.ToString("#####0.############"));
                m.SubItems.Add(Position.Z.ToString("#####0.############"));

                m.SubItems.Add(LengthVector.X.ToString("#####0.############"));
                m.SubItems.Add(LengthVector.Y.ToString("#####0.############"));
                m.SubItems.Add(LengthVector.Z.ToString("#####0.############"));

                m.SubItems.Add(XVector.X.ToString("#####0.############"));
                m.SubItems.Add(XVector.Y.ToString("#####0.############"));
                m.SubItems.Add(XVector.Z.ToString("#####0.############"));

                m.SubItems.Add(YVector.X.ToString("#####0.############"));
                m.SubItems.Add(YVector.Y.ToString("#####0.############"));
                m.SubItems.Add(YVector.Z.ToString("#####0.############"));

                m.SubItems.Add(ZVector.X.ToString("#####0.############"));
                m.SubItems.Add(ZVector.Y.ToString("#####0.############"));
                m.SubItems.Add(ZVector.Z.ToString("#####0.############"));

                m.SubItems.Add(Unknown5.ToString());
                m.SubItems.Add(Unknown6.ToString());
                m.SubItems.Add(Unknown7.ToString());

                m.SubItems.Add(HexUtil.GetHexReverse(Unknown8));
                m.SubItems.Add(LinkedCame.ToString());
                m.SubItems.Add(HexUtil.GetHexReverse(AreaType));

                m.SubItems.Add(HexUtil.GetHexReverse(Unknown10));

                m.SubItems.Add(HexUtil.GetHexReverse(Unknown11));
                return(m);
            }
        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 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);
        }
示例#9
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);
        }
示例#10
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);
        }
示例#11
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);
        }
示例#12
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);
        }
示例#13
0
 public override string ToString()
 {
     return($"{{{nameof(Offset)}={Offset.ToString("X")}, {nameof(Unknown0)}={Unknown0.ToString("X")}, {nameof(Unknown1)}={Unknown1.ToString("X")}, {nameof(Unknown2)}={Unknown2.ToString("X")}, {nameof(Unknown3)}={Unknown3.ToString("X")}, {nameof(Unknown4)}={Unknown4.ToString("X")}, {nameof(Unknown5)}={Unknown5.ToString("X")}, {nameof(Unknown6)}={Unknown6.ToString("X")}, {nameof(Unknown7)}={Unknown7.ToString("X")}}}");
 }
示例#14
0
        /// <summary>
        ///     Generates the encrypted signature which is required for the <see cref="RequestEnvelope"/>.
        /// </summary>
        /// <param name="requests">The requests of the <see cref="RequestEnvelope"/>.</param>
        /// <returns>The encrypted <see cref="Unknown6"/> (Signature).</returns>
        internal Unknown6 GenerateSignature(RequestEnvelope requestEnvelope)
        {
            var signature = new Signature
            {
                TimestampSinceStart = (ulong)_internalStopwatch.ElapsedMilliseconds,
                Timestamp           = (ulong)TimeUtil.GetCurrentTimestampInMilliseconds(),
                SensorInfo          = new SensorInfo()
                {
                    AccelNormalizedZ  = Randomize(9.8),
                    AccelNormalizedX  = Randomize(0.02),
                    AccelNormalizedY  = Randomize(0.3),
                    TimestampSnapshot = (ulong)_internalStopwatch.ElapsedMilliseconds - 230,
                    MagnetometerX     = Randomize(012271042913198471),
                    MagnetometerY     = Randomize(-0.015570580959320068),
                    MagnetometerZ     = Randomize(0.010850906372070313),
                    AngleNormalizedX  = Randomize(17.950439453125),
                    AngleNormalizedY  = Randomize(-23.36273193359375),
                    AngleNormalizedZ  = Randomize(-48.8250732421875),
                    AccelRawX         = Randomize(-0.0120010357350111),
                    AccelRawY         = Randomize(-0.04214850440621376),
                    AccelRawZ         = Randomize(0.94571763277053833),
                    GyroscopeRawX     = Randomize(7.62939453125e-005),
                    GyroscopeRawY     = Randomize(-0.00054931640625),
                    GyroscopeRawZ     = Randomize(0.0024566650390625),
                    AccelerometerAxes = 3
                },
                DeviceInfo = new DeviceInfo()
                {
                    DeviceId              = _session.Device.DeviceId,
                    AndroidBoardName      = _session.Device.AndroidBoardName,
                    AndroidBootloader     = _session.Device.AndroidBootloader,
                    DeviceBrand           = _session.Device.DeviceBrand,
                    DeviceModel           = _session.Device.DeviceModel,
                    DeviceModelIdentifier = _session.Device.DeviceModelIdentifier,
                    DeviceModelBoot       = _session.Device.DeviceModelBoot,
                    HardwareManufacturer  = _session.Device.HardwareManufacturer,
                    HardwareModel         = _session.Device.HardwareModel,
                    FirmwareBrand         = _session.Device.FirmwareBrand,
                    FirmwareTags          = _session.Device.FirmwareTags,
                    FirmwareType          = _session.Device.FirmwareType,
                    FirmwareFingerprint   = _session.Device.FirmwareFingerprint
                },
                LocationFix =
                {
                    new LocationFix
                    {
                        Provider = "network",
                        //Unk4 = 120,
                        Latitude            = (float)_session.Player.Coordinate.Latitude,
                        Longitude           = (float)_session.Player.Coordinate.Longitude,
                        Altitude            = (float)_session.Player.Coordinate.Altitude,
                        TimestampSinceStart = (ulong)_internalStopwatch.ElapsedMilliseconds - 200,
                        Floor        = 3,
                        LocationType = 1
                    }
                }
            };

            // Compute 10
            var serializedTicket = requestEnvelope.AuthTicket != null?requestEnvelope.AuthTicket.ToByteArray() : requestEnvelope.AuthInfo.ToByteArray();

            var firstHash     = CalculateHash32(serializedTicket, 0x1B845238);
            var locationBytes = BitConverter.GetBytes(_session.Player.Coordinate.Latitude).Reverse()
                                .Concat(BitConverter.GetBytes(_session.Player.Coordinate.Longitude).Reverse())
                                .Concat(BitConverter.GetBytes(_session.Player.Coordinate.Altitude).Reverse()).ToArray();

            signature.LocationHash1 = CalculateHash32(locationBytes, firstHash);
            // Compute 20
            signature.LocationHash2 = CalculateHash32(locationBytes, 0x1B845238);
            // Compute 24
            var seed = xxHash64.CalculateHash(serializedTicket, serializedTicket.Length, 0x1B845238);

            foreach (var req in requestEnvelope.Requests)
            {
                var reqBytes = req.ToByteArray();
                signature.RequestHash.Add(xxHash64.CalculateHash(reqBytes, reqBytes.Length, seed));
            }

            //static for now
            signature.Unknown22 = ByteString.CopyFrom(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F);

            var iv = new byte[32];

            _random.NextBytes(iv);

            var encryptedSignature = new Unknown6
            {
                RequestType = 6,
                Unknown2    = new Unknown6.Types.Unknown2
                {
                    EncryptedSignature = ByteString.CopyFrom(CryptUtil.Encrypt(signature.ToByteArray(), iv))
                }
            };

            return(encryptedSignature);
        }
示例#15
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);
        }
示例#16
0
        private Unknown6 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));
            }


            // OLD
            //static for now
            //sig.SessionHash = ByteString.CopyFrom(new byte[16] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F });
            // 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

            Unknown6 val = new Unknown6();

            val.RequestType = 6;
            val.Unknown2    = new Unknown6.Types.Unknown2();
            var iv = new byte[32];

            new Random().NextBytes(iv);
            val.Unknown2.EncryptedSignature = ByteString.CopyFrom(EncryptionHelper.Encrypt(sig.ToByteArray(), iv));
            return(val);
        }
        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);
        }
示例#18
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;
        }