diff --git a/POGOLib.Official.Google/project.json b/POGOLib.Official.Google/project.json index ed9892295..969665c1e 100644 --- a/POGOLib.Official.Google/project.json +++ b/POGOLib.Official.Google/project.json @@ -1,7 +1,7 @@ { "supports": {}, "dependencies": { - "GPSOAuthSharp.NetStandard1": "1.0.0" + "GPSOAuthSharp.NetStandard1": "1.0.1" }, "frameworks": { ".NETPortable,Version=v4.5,Profile=Profile111": {} diff --git a/POGOLib.Official/Pokemon/HeartbeatDispatcher.cs b/POGOLib.Official/Pokemon/HeartbeatDispatcher.cs index 167745f83..8fcb36373 100644 --- a/POGOLib.Official/Pokemon/HeartbeatDispatcher.cs +++ b/POGOLib.Official/Pokemon/HeartbeatDispatcher.cs @@ -93,6 +93,8 @@ private async Task CheckDispatch(TaskCompletionSource firstRefreshComplete } } + firstRefreshCompleted?.TrySetResult(false); + Logger.Debug("Heartbeat got cancelled"); } diff --git a/POGOLib.Official/Properties/AssemblyInfo.cs b/POGOLib.Official/Properties/AssemblyInfo.cs index e4c1bed18..4853dc0cb 100644 --- a/POGOLib.Official/Properties/AssemblyInfo.cs +++ b/POGOLib.Official/Properties/AssemblyInfo.cs @@ -26,5 +26,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.4.0.0")] -[assembly: AssemblyFileVersion("1.4.0.0")] +[assembly: AssemblyVersion("1.4.3.0")] +[assembly: AssemblyFileVersion("1.4.3.0")] diff --git a/POGOLib.Official/Util/Encryption/PokeHash/PCryptPokeHash.cs b/POGOLib.Official/Util/Encryption/PokeHash/PCryptPokeHash.cs index ccf18ef99..826058e11 100644 --- a/POGOLib.Official/Util/Encryption/PokeHash/PCryptPokeHash.cs +++ b/POGOLib.Official/Util/Encryption/PokeHash/PCryptPokeHash.cs @@ -5,96 +5,132 @@ namespace POGOLib.Official.Util.Encryption.PokeHash /// /// This is the PCrypt used by POGOLib. It should always match the used PokeHash version. /// - /// Android version: 0.59.1 - /// IOS version: 1.29.1 + /// Android version: 0.61.0 + /// IOS version: 1.31.0 /// internal static class PCryptPokeHash { - public static byte[] KEY = new byte[] - { - (byte) 0x4F, (byte) 0xEB, (byte) 0x1C, (byte) 0xA5, (byte) 0xF6, (byte) 0x1A, (byte) 0x67, (byte) 0xCE, - (byte) 0x43, (byte) 0xF3, (byte) 0xF0, (byte) 0x0C, (byte) 0xB1, (byte) 0x23, (byte) 0x88, (byte) 0x35, - (byte) 0xE9, (byte) 0x8B, (byte) 0xE8, (byte) 0x39, (byte) 0xD8, (byte) 0x89, (byte) 0x8F, (byte) 0x5A, - (byte) 0x3B, (byte) 0x51, (byte) 0x2E, (byte) 0xA9, (byte) 0x47, (byte) 0x38, (byte) 0xC4, (byte) 0x14 - }; - - public static byte[] MakeIv(Rand rand) - { - byte[] iv = new byte[TwoFish.BLOCK_SIZE]; - for (int i = 0; i < iv.Length; i++) - { - iv[i] = rand.Next(); - } - return iv; - } - - public static byte MakeIntegrityByte(Rand rand) - { - return 0x21; - } - - /** + private static readonly byte[] KEY = { + 0x4F, 0xEB, 0x1C, 0xA5, 0xF6, 0x1A, 0x67, 0xCE, + 0x43, 0xF3, 0xF0, 0x0C, 0xB1, 0x23, 0x88, 0x35, + 0xE9, 0x8B, 0xE8, 0x39, 0xD8, 0x89, 0x8F, 0x5A, + 0x3B, 0x51, 0x2E, 0xA9, 0x47, 0x38, 0xC4, 0x14 + }; + + private static byte[] xbox = { + 0x01, + 0x00, + 0x83, 0x57, 0x47, 0x28, 0x1c, 0x84, 0x5c, 0xf0, 0x25, 0xcc, 0x14, 0xd1, 0xe4, 0xe0, 0x4b, 0x4c, + 0x68, 0x20, 0x72, 0x37, 0x34, 0x7b, 0x23, 0xf3, 0x7d, 0x62, 0x8c, 0xa7, 0xe2, 0xa8, 0x88, 0x6e, + 0x27, 0x74, 0x3e, 0x94, 0x2a, 0x6d, 0x3b, 0xa5, 0x7a, 0x41, 0xa3, 0x13, 0x8b, 0x31, 0x42, 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, 0xc8, 0xdf, 0x3c, 0xfb, 0x8d, 0xb1, 0x55, 0xd5, 0x6f, 0x70, + 0xef, 0x9d, 0xa1, 0x9e, 0xb6, 0xea, 0xc6, 0xf1, 0x80, 0x1d, 0x05, 0x73, 0xd6, 0xb3, 0x36, 0x85 + }; + + private static void encrypt_cipher(byte[] src, int size) + { + var newxbox = new byte[xbox.Length]; + xbox.CopyTo(newxbox, 0); + int a4 = size - 1; + int srci = 0; + byte v4 = newxbox[0]; + byte v5 = newxbox[1]; + for (; a4 != 0; v4 = (byte)(v4 + 1)) + { + --a4; + byte v7 = newxbox[2 + v4]; + v5 = (byte)(v5 + v7); + byte v9 = newxbox[2 + v5]; + newxbox[2 + v4] = v9; + newxbox[2 + v5] = v7; + byte v10 = (byte)(v9 + v7); + src[srci++] ^= newxbox[2 + v10]; + } + newxbox[0] = v4; + newxbox[1] = v5; + } + + /** * Encrypts the given signature * * @param input input data * @param msSinceStart time since start * @return encrypted signature */ - public static byte[] Encrypt(byte[] input, uint msSinceStart) - { - try - { - object[] key = TwoFish.MakeKey(KEY); - - Rand rand = new Rand(msSinceStart); - byte[] iv = MakeIv(rand); - int blockCount = (input.Length + 256) / 256; - int outputSize = (blockCount * 256) + 5; - byte[] output = new byte[outputSize]; - - output[0] = (byte)(msSinceStart >> 24); - output[1] = (byte)(msSinceStart >> 16); - output[2] = (byte)(msSinceStart >> 8); - output[3] = (byte)msSinceStart; - - Array.Copy(input, 0, output, 4, input.Length); - output[outputSize - 2] = (byte)(256 - input.Length % 256); - - for (int offset = 0; offset < blockCount * 256; offset += TwoFish.BLOCK_SIZE) - { - for (int i = 0; i < TwoFish.BLOCK_SIZE; i++) - { - output[4 + offset + i] ^= iv[i]; - } - - byte[] block = TwoFish.blockEncrypt(output, offset + 4, key); - Array.Copy(block, 0, output, offset + 4, block.Length); - Array.Copy(output, 4 + offset, iv, 0, TwoFish.BLOCK_SIZE); - } - - output[outputSize - 1] = MakeIntegrityByte(rand); - return output; - } - catch (Exception) - { - return null; - } - } - - public class Rand - { - private long state; - - public Rand(long state) - { - this.state = state; - } - - public byte Next() - { - state = (state * 0x41C64E6D) + 0x3039; - return (byte)((state >> 16) & 0xFF); - } - } + + public static byte[] Encrypt(byte[] uncryptedSignature, uint msSinceStart) + { + try + { + Rand rand = new Rand(msSinceStart); + + object[] key = TwoFish.MakeKey(KEY); + + var xor_byte = new byte[TwoFish.BLOCK_SIZE]; + + for (int i = 0; i < TwoFish.BLOCK_SIZE; ++i) + xor_byte[i] = (byte)rand.Next(); + + int block_count = (uncryptedSignature.Length + 256) / 256; + int output_size = 4 + (block_count * 256) + 1; + var output = new byte[output_size]; + output[0] = (byte)(msSinceStart >> 24); + output[1] = (byte)(msSinceStart >> 16); + output[2] = (byte)(msSinceStart >> 8); + output[3] = (byte)msSinceStart; + + + Array.Copy(uncryptedSignature, 0, output, 4, uncryptedSignature.Length); + + output[output_size - 2] = (byte)(256 - uncryptedSignature.Length % 256); + + for (int offset = 0; offset < block_count * 256; offset += TwoFish.BLOCK_SIZE) + { + for (int i = 0; i < TwoFish.BLOCK_SIZE; i++) + output[4 + offset + i] ^= xor_byte[i]; + + byte[] block = TwoFish.blockEncrypt(output, offset + 4, key); + Array.Copy(block, 0, output, offset + 4, block.Length); + Array.Copy(output, 4 + offset, xor_byte, 0, TwoFish.BLOCK_SIZE); + + } + output[output_size - 1] = 0x23; + encrypt_cipher(output, output_size); + + return output; + } + + catch (Exception) + { + return null; + } + } + + public class Rand + { + private long state; + + public Rand(long state) + { + this.state = state; + } + + public byte Next() + { + state = (state * 0x41C64E6D) + 0x3039; + return (byte)((state >> 16) & 0xFF); + } + } } -} +} \ No newline at end of file diff --git a/POGOLib.Official/Util/Hash/PokeHashHasher.cs b/POGOLib.Official/Util/Hash/PokeHashHasher.cs index 8569d63ed..37c9356dc 100644 --- a/POGOLib.Official/Util/Hash/PokeHashHasher.cs +++ b/POGOLib.Official/Util/Hash/PokeHashHasher.cs @@ -28,7 +28,7 @@ public class PokeHashHasher : IHasher { private const string PokeHashUrl = "https://pokehash.buddyauth.com/"; - private const string PokeHashEndpoint = "api/v131_0/hash"; + private const string PokeHashEndpoint = "api/v133_1/hash"; private readonly List _authKeys; @@ -79,9 +79,9 @@ public PokeHashHasher(string[] authKeys) _keySelection = new Semaphore(1, 1); } - public Version PokemonVersion { get; } = new Version("0.61.0"); + public Version PokemonVersion { get; } = new Version("0.63.1"); - public long Unknown25 { get; } = 1296456256998993698; + public long Unknown25 { get; } = 5348175887752539474; public async Task GetHashDataAsync(RequestEnvelope requestEnvelope, Signature signature, byte[] locationBytes, byte[][] requestsBytes, byte[] serializedTicket) { diff --git a/POGOLib.Official/project.json b/POGOLib.Official/project.json index 05fc57fa3..e70c30229 100644 --- a/POGOLib.Official/project.json +++ b/POGOLib.Official/project.json @@ -1,10 +1,10 @@ { "supports": {}, "dependencies": { - "GeoCoordinate.NetStandard1": "1.0.0", - "Google.Protobuf": "3.2.0", - "Newtonsoft.Json": "9.0.1", - "POGOProtos.NetStandard1": "2.8.0", + "GeoCoordinate.NetStandard1": "1.0.1", + "Google.Protobuf": "3.3.0", + "Newtonsoft.Json": "10.0.2", + "POGOProtos.NetStandard1": "2.9.2", "S2Geometry": "1.0.3" }, "frameworks": { diff --git a/PokemonGo-UWP/Package.appxmanifest b/PokemonGo-UWP/Package.appxmanifest index 60e650900..6f01be5f2 100644 --- a/PokemonGo-UWP/Package.appxmanifest +++ b/PokemonGo-UWP/Package.appxmanifest @@ -1,6 +1,6 @@  - + PoGo diff --git a/PokemonGo-UWP/PokemonGo-UWP.nuget.props b/PokemonGo-UWP/PokemonGo-UWP.nuget.props new file mode 100644 index 000000000..c62c27146 --- /dev/null +++ b/PokemonGo-UWP/PokemonGo-UWP.nuget.props @@ -0,0 +1,21 @@ + + + + True + NuGet + E:\Users\Michel\Source\Repos\PoGo-UWP\PokemonGo-UWP\project.lock.json + $(UserProfile)\.nuget\packages\ + C:\Users\mtahe\.nuget\packages\ + ProjectJson + 4.2.0 + + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + + + + + + + + \ No newline at end of file diff --git a/PokemonGo-UWP/PokemonGo-UWP.nuget.targets b/PokemonGo-UWP/PokemonGo-UWP.nuget.targets index cea72eb6e..229d02337 100644 --- a/PokemonGo-UWP/PokemonGo-UWP.nuget.targets +++ b/PokemonGo-UWP/PokemonGo-UWP.nuget.targets @@ -1,9 +1,14 @@  - - $(UserProfile)\.nuget\packages\ + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - - + + + + + + + \ No newline at end of file diff --git a/PokemonGo-UWP/project.json b/PokemonGo-UWP/project.json index 70e1e692a..d827356dd 100644 --- a/PokemonGo-UWP/project.json +++ b/PokemonGo-UWP/project.json @@ -1,17 +1,17 @@ { "dependencies": { - "Google.Protobuf.Tools": "3.1.0", + "Google.Protobuf.Tools": "3.3.0", "HockeySDK.UWP": "4.1.6", - "Microsoft.NETCore.UniversalWindowsPlatform": "5.2.2", - "Newtonsoft.Json": "9.0.1", - "Nito.AsyncEx": "3.0.1", + "Microsoft.NETCore.UniversalWindowsPlatform": "5.3.3", + "Newtonsoft.Json": "10.0.2", + "Nito.AsyncEx": "4.0.1", "NotificationsExtensions.Win10": "14332.0.2", - "Octokit": "0.22.0", + "Octokit": "0.24.0", "Template10": "1.1.12", - "UniversalMapControl": "0.3.45", - "WinRTXamlToolkit.Controls.Gauge.UWP": "2.0.0", + "UniversalMapControl": "0.3.53", + "WinRTXamlToolkit.Controls.Gauge.UWP": "2.3.0", "Xam.Plugin.DeviceMotion": "1.1.2", - "XamlAnimatedGif": "1.1.6" + "XamlAnimatedGif": "1.1.9" }, "frameworks": { "uap10.0": {} diff --git a/version.json b/version.json index 5cf3097a4..d8a2514c6 100644 --- a/version.json +++ b/version.json @@ -1,12 +1,12 @@ { - "minimum_version": "1.3.2", - "unknown25": 1296456256998993698, + "minimum_version": "1.3.5", + "unknown25": 5348175887752539474, "seed1": 1189692920, "version_number": 6100, "settings_updated": "2017-02-19T00:00:00", "latest_release": { - "version": "1.3.4", - "setup_file": "https://github.com/mtaheij/PoGo-UWP/releases/download/v1.3.4-beta/PokemonGo-UWP_1.3.4.0_{arch}.appxbundle", + "version": "1.3.5", + "setup_file": "https://github.com/mtaheij/PoGo-UWP/releases/download/v1.3.5-beta/PokemonGo-UWP_1.3.5.0_{arch}.appxbundle", "dependencies": [ ] }