diff --git a/PayCheck3.sln b/PayCheck3.sln index a9909cd..36a3a9d 100644 --- a/PayCheck3.sln +++ b/PayCheck3.sln @@ -12,7 +12,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution .editorconfig = .editorconfig EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DS_Server", "DS_Server\DS_Server.csproj", "{ECDB0271-5226-4381-9460-2D550F4B4D4B}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DS_Server", "DS_Server\DS_Server.csproj", "{ECDB0271-5226-4381-9460-2D550F4B4D4B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SaveGetter", "SaveGetter\SaveGetter.csproj", "{A40D3EF0-D4B0-468A-85C6-6A92719E0497}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -32,6 +34,10 @@ Global {ECDB0271-5226-4381-9460-2D550F4B4D4B}.Debug|Any CPU.Build.0 = Debug|Any CPU {ECDB0271-5226-4381-9460-2D550F4B4D4B}.Release|Any CPU.ActiveCfg = Release|Any CPU {ECDB0271-5226-4381-9460-2D550F4B4D4B}.Release|Any CPU.Build.0 = Release|Any CPU + {A40D3EF0-D4B0-468A-85C6-6A92719E0497}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A40D3EF0-D4B0-468A-85C6-6A92719E0497}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A40D3EF0-D4B0-468A-85C6-6A92719E0497}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A40D3EF0-D4B0-468A-85C6-6A92719E0497}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/PayCheckServerLib/PayCheckServerLib.csproj b/PayCheckServerLib/PayCheckServerLib.csproj index 80a340e..959bd3a 100644 --- a/PayCheckServerLib/PayCheckServerLib.csproj +++ b/PayCheckServerLib/PayCheckServerLib.csproj @@ -66,7 +66,4 @@ - - - diff --git a/SaveGetter/LoginTokenJson.cs b/SaveGetter/LoginTokenJson.cs new file mode 100644 index 0000000..db47e3f --- /dev/null +++ b/SaveGetter/LoginTokenJson.cs @@ -0,0 +1,66 @@ +using Newtonsoft.Json; + +namespace SaveGetter +{ + public class LoginToken + { + [JsonProperty("access_token")] + public string AccessToken { get; set; } + + [JsonProperty("bans")] + public List Bans { get; set; } + + [JsonProperty("display_name")] + public string DisplayName { get; set; } + + [JsonProperty("expires_in")] + public long ExpiresIn { get; set; } + + [JsonProperty("is_comply")] + public bool IsComply { get; set; } + + [JsonProperty("jflgs")] + public long Jflgs { get; set; } + + [JsonProperty("namespace")] + public string Namespace { get; set; } + + [JsonProperty("namespace_roles")] + public List NamespaceRoles { get; set; } + + [JsonProperty("permissions")] + public List Permissions { get; set; } + + [JsonProperty("platform_id")] + public string PlatformId { get; set; } + + [JsonProperty("platform_user_id")] + public string PlatformUserId { get; set; } + + [JsonProperty("refresh_expires_in")] + public long RefreshExpiresIn { get; set; } + + [JsonProperty("refresh_token")] + public string RefreshToken { get; set; } + + [JsonProperty("roles")] + public List Roles { get; set; } + + [JsonProperty("scope")] + public string Scope { get; set; } + + [JsonProperty("token_type")] + public string TokenType { get; set; } + + [JsonProperty("user_id")] + public string UserId { get; set; } + } + public partial class NamespaceRole + { + [JsonProperty("roleId")] + public string RoleId { get; set; } + + [JsonProperty("namespace")] + public string Namespace { get; set; } + } +} diff --git a/SaveGetter/Program.cs b/SaveGetter/Program.cs new file mode 100644 index 0000000..afacf6c --- /dev/null +++ b/SaveGetter/Program.cs @@ -0,0 +1,87 @@ +using Newtonsoft.Json; +using Steamworks; + +namespace SaveGetter +{ + internal class Program + { + static void Main(string[] args) + { + Console.WriteLine("Getting your save!"); + + if (!SteamAPI.Init()) + { + Console.WriteLine("Steam not running, make sure it is running in the background!"); + Environment.Exit(0); + } + byte[] buffer = new byte[1024]; + _ = SteamUser.GetAuthSessionTicket(buffer, 1024, out uint tikcet); + var Token = BitConverter.ToString(buffer[..(int)tikcet]).Replace("-", string.Empty); + //Console.WriteLine(Token); + var token = Auth(Token); + GetSave(token); + Exit(); + } + + static LoginToken Auth(string Token) + { + HttpClient client = new HttpClient(); + client.BaseAddress = new Uri("https://nebula.starbreeze.com"); + + var formvalues = new Dictionary + { + { "platform_token", Token } + }; + var content = new FormUrlEncodedContent(formvalues); + //client.DefaultRequestHeaders.Add("Content-Type", "application/x-www-form-urlencoded"); + client.DefaultRequestHeaders.Add("Authorization", "Basic MGIzYmZkZjVhMjVmNDUyZmJkMzNhMzYxMzNhMmRlYWI6"); + client.DefaultRequestHeaders.Add("Namespace", "pd3"); + var resp = client.PostAsync("/iam/v3/oauth/platforms/steam/token", content).Result; + if (resp.StatusCode == System.Net.HttpStatusCode.OK) + { + Console.WriteLine("SUCCESS! Got your Login Tokens"); + var json = JsonConvert.DeserializeObject(resp.Content.ReadAsStringAsync().Result); + //Console.WriteLine(JsonConvert.SerializeObject(json)); + return json; + } + else + { + Console.WriteLine("Error!"); + Console.WriteLine(resp.StatusCode); + Console.WriteLine(resp.Content.ReadAsStringAsync().Result); + Exit(); + return null; + } + } + + static void GetSave(LoginToken token) + { + string save = "cloudsave/v1/namespaces/__namespace__/users/__userId__/records/progressionsavegame"; + HttpClient client = new HttpClient(); + client.BaseAddress = new Uri("https://nebula.starbreeze.com"); + client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token.AccessToken); + client.DefaultRequestHeaders.Add("Cookie", $"access_token={token.AccessToken};refresh_token={token.RefreshToken}"); + client.DefaultRequestHeaders.Add("Namespace", token.Namespace); + + var result = client.GetAsync(save.Replace("__namespace__", token.Namespace).Replace("__userId__", token.UserId)).Result; + + if (result.StatusCode == System.Net.HttpStatusCode.OK) + { + Console.WriteLine("SUCCESS! Your save saved!"); + File.WriteAllText($"{token.UserId}.save.txt", result.Content.ReadAsStringAsync().Result); + } + else + { + Console.WriteLine("Error!"); + Exit(); + } + } + + static void Exit() + { + Console.WriteLine("Quitting.."); + SteamAPI.Shutdown(); + Environment.Exit(0); + } + } +} diff --git a/SaveGetter/SaveGetter.csproj b/SaveGetter/SaveGetter.csproj new file mode 100644 index 0000000..025f15b --- /dev/null +++ b/SaveGetter/SaveGetter.csproj @@ -0,0 +1,24 @@ + + + + Exe + net8.0 + enable + enable + + + + + + + + + + Always + + + Always + + + + diff --git a/SaveGetter/steam_api64.dll b/SaveGetter/steam_api64.dll new file mode 100644 index 0000000..2b42812 Binary files /dev/null and b/SaveGetter/steam_api64.dll differ diff --git a/SaveGetter/steam_appid.txt b/SaveGetter/steam_appid.txt new file mode 100644 index 0000000..be591c4 --- /dev/null +++ b/SaveGetter/steam_appid.txt @@ -0,0 +1 @@ +1272080 \ No newline at end of file