Skip to content

Commit

Permalink
Version 1.3.5 / API version 0.63.1
Browse files Browse the repository at this point in the history
  • Loading branch information
mtaheij committed May 21, 2017
1 parent e1d8832 commit 69b736c
Show file tree
Hide file tree
Showing 11 changed files with 174 additions and 110 deletions.
2 changes: 1 addition & 1 deletion POGOLib.Official.Google/project.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"supports": {},
"dependencies": {
"GPSOAuthSharp.NetStandard1": "1.0.0"
"GPSOAuthSharp.NetStandard1": "1.0.1"
},
"frameworks": {
".NETPortable,Version=v4.5,Profile=Profile111": {}
Expand Down
2 changes: 2 additions & 0 deletions POGOLib.Official/Pokemon/HeartbeatDispatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ private async Task CheckDispatch(TaskCompletionSource<bool> firstRefreshComplete
}
}

firstRefreshCompleted?.TrySetResult(false);

Logger.Debug("Heartbeat got cancelled");
}

Expand Down
4 changes: 2 additions & 2 deletions POGOLib.Official/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
202 changes: 119 additions & 83 deletions POGOLib.Official/Util/Encryption/PokeHash/PCryptPokeHash.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,96 +5,132 @@ namespace POGOLib.Official.Util.Encryption.PokeHash
/// <summary>
/// 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
/// </summary>
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, 0x09,
0xb4, 0x16, 0x2f, 0xb7, 0x06, 0x04, 0x75, 0x39, 0x67, 0xc0, 0x30, 0xde, 0xa4, 0xf8, 0xd8, 0x19,
0xf7, 0xf9, 0x2d, 0xae, 0xc2, 0xe9, 0xcb, 0xc1, 0x1b, 0x5e, 0xc3, 0x08, 0xaa, 0x4f, 0xd4, 0xbf,
0x35, 0x63, 0x2e, 0x8f, 0x9f, 0x0f, 0x8a, 0x97, 0xb8, 0x3a, 0xa6, 0x48, 0x98, 0x11, 0x71, 0x89,
0x6c, 0x9b, 0x0a, 0x61, 0xa9, 0x86, 0x22, 0xe3, 0x03, 0x7f, 0x4a, 0x99, 0x00, 0xab, 0xed, 0xf2,
0x9a, 0xba, 0x52, 0x29, 0x1e, 0xbe, 0xfc, 0xa0, 0x65, 0x6a, 0x78, 0xca, 0x69, 0xd0, 0x21, 0x49,
0xbd, 0x4d, 0x2c, 0x7e, 0x53, 0xb5, 0xe6, 0xdc, 0x60, 0x8e, 0xfd, 0x17, 0x82, 0x0e, 0x9c, 0x4e,
0xaf, 0xc5, 0xc4, 0x5d, 0x81, 0xf4, 0x02, 0x5b, 0x0b, 0x50, 0xac, 0x45, 0x95, 0x5f, 0x38, 0xd3,
0x76, 0xc7, 0x07, 0x90, 0x92, 0x79, 0x15, 0x77, 0xdb, 0x12, 0x3d, 0xbc, 0x10, 0x1a, 0x51, 0xb9,
0x32, 0xbb, 0x26, 0x56, 0xdd, 0xd9, 0xe5, 0x7c, 0xe8, 0xe7, 0xad, 0xd2, 0xf6, 0xee, 0xcf, 0xfe,
0x87, 0x66, 0x64, 0xf5, 0xcd, 0xe1, 0xc9, 0xfa, 0x0c, 0x01, 0x6b, 0x3f, 0x0d, 0xda, 0x96, 0x40,
0xa2, 0x1f, 0x5a, 0x24, 0xeb, 0x59, 0xec, 0x44, 0x43, 0x91, 0xb0, 0xb2, 0xd7, 0x54, 0x2b, 0xce,
0x33, 0xff, 0x58, 0x18, 0x93, 0x46, 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);
}
}
}
}
}
6 changes: 3 additions & 3 deletions POGOLib.Official/Util/Hash/PokeHashHasher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<PokeHashAuthKey> _authKeys;

Expand Down Expand Up @@ -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<HashData> GetHashDataAsync(RequestEnvelope requestEnvelope, Signature signature, byte[] locationBytes, byte[][] requestsBytes, byte[] serializedTicket)
{
Expand Down
8 changes: 4 additions & 4 deletions POGOLib.Official/project.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion PokemonGo-UWP/Package.appxmanifest
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities" xmlns:wincap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/windowscapabilities" IgnorableNamespaces="uap mp rescap wincap">
<Identity Name="c602d2cb-fdd8-4e41-b5a1-8f9a8a1f56c7" Publisher="CN=stept" Version="1.3.4.0" />
<Identity Name="c602d2cb-fdd8-4e41-b5a1-8f9a8a1f56c7" Publisher="CN=stept" Version="1.3.5.0" />
<mp:PhoneIdentity PhoneProductId="c602d2cb-fdd8-4e41-b5a1-8f9a8a1f56c7" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
<Properties>
<DisplayName>PoGo</DisplayName>
Expand Down
21 changes: 21 additions & 0 deletions PokemonGo-UWP/PokemonGo-UWP.nuget.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">E:\Users\Michel\Source\Repos\PoGo-UWP\PokemonGo-UWP\project.lock.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\mtahe\.nuget\packages\</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">ProjectJson</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">4.2.0</NuGetToolVersion>
</PropertyGroup>
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<Import Project="$(NuGetPackageRoot)microsoft.net.native.sharedlibrary-x86\1.6.1\build\Microsoft.Net.Native.SharedLibrary-x86.props" Condition="Exists('$(NuGetPackageRoot)microsoft.net.native.sharedlibrary-x86\1.6.1\build\Microsoft.Net.Native.SharedLibrary-x86.props')" />
<Import Project="$(NuGetPackageRoot)microsoft.net.native.sharedlibrary-x64\1.6.1\build\Microsoft.Net.Native.SharedLibrary-x64.props" Condition="Exists('$(NuGetPackageRoot)microsoft.net.native.sharedlibrary-x64\1.6.1\build\Microsoft.Net.Native.SharedLibrary-x64.props')" />
<Import Project="$(NuGetPackageRoot)microsoft.net.native.sharedlibrary-arm\1.6.1\build\Microsoft.Net.Native.SharedLibrary-arm.props" Condition="Exists('$(NuGetPackageRoot)microsoft.net.native.sharedlibrary-arm\1.6.1\build\Microsoft.Net.Native.SharedLibrary-arm.props')" />
<Import Project="$(NuGetPackageRoot)microsoft.net.native.compiler\1.6.2\build\Microsoft.Net.Native.Compiler.props" Condition="Exists('$(NuGetPackageRoot)microsoft.net.native.compiler\1.6.2\build\Microsoft.Net.Native.Compiler.props')" />
</ImportGroup>
</Project>
13 changes: 9 additions & 4 deletions PokemonGo-UWP/PokemonGo-UWP.nuget.targets
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(NuGetPackageRoot)' == ''">
<NuGetPackageRoot>$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>
<ImportGroup>
<Import Project="$(NuGetPackageRoot)\Template10\1.1.12\build\uap10.0\Template10.targets" Condition="Exists('$(NuGetPackageRoot)\Template10\1.1.12\build\uap10.0\Template10.targets')" />
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<Import Project="$(NuGetPackageRoot)microsoft.net.native.sharedlibrary-x86\1.6.1\build\Microsoft.Net.Native.SharedLibrary-x86.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.net.native.sharedlibrary-x86\1.6.1\build\Microsoft.Net.Native.SharedLibrary-x86.targets')" />
<Import Project="$(NuGetPackageRoot)microsoft.net.native.sharedlibrary-x64\1.6.1\build\Microsoft.Net.Native.SharedLibrary-x64.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.net.native.sharedlibrary-x64\1.6.1\build\Microsoft.Net.Native.SharedLibrary-x64.targets')" />
<Import Project="$(NuGetPackageRoot)microsoft.net.native.sharedlibrary-arm\1.6.1\build\Microsoft.Net.Native.SharedLibrary-arm.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.net.native.sharedlibrary-arm\1.6.1\build\Microsoft.Net.Native.SharedLibrary-arm.targets')" />
<Import Project="$(NuGetPackageRoot)microsoft.net.native.compiler\1.6.2\build\Microsoft.Net.Native.Compiler.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.net.native.compiler\1.6.2\build\Microsoft.Net.Native.Compiler.targets')" />
<Import Project="$(NuGetPackageRoot)template10\1.1.12\build\uap10.0\Template10.targets" Condition="Exists('$(NuGetPackageRoot)template10\1.1.12\build\uap10.0\Template10.targets')" />
<Import Project="$(NuGetPackageRoot)microsoft.bcl.build\1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.bcl.build\1.0.21\build\Microsoft.Bcl.Build.targets')" />
</ImportGroup>
</Project>
16 changes: 8 additions & 8 deletions PokemonGo-UWP/project.json
Original file line number Diff line number Diff line change
@@ -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": {}
Expand Down
8 changes: 4 additions & 4 deletions version.json
Original file line number Diff line number Diff line change
@@ -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": [
]
}
Expand Down

0 comments on commit 69b736c

Please sign in to comment.