|
|
|
|
@ -238,25 +238,62 @@ namespace DepotDownloader
|
|
|
|
|
if (branch != "Public" && node == KeyValue.Invalid)
|
|
|
|
|
{
|
|
|
|
|
var node_encrypted = manifests_encrypted[branch];
|
|
|
|
|
if (node_encrypted != KeyValue.Invalid)
|
|
|
|
|
{
|
|
|
|
|
string password = Config.BetaPassword;
|
|
|
|
|
if (password == null)
|
|
|
|
|
{
|
|
|
|
|
Console.Write("Please enter the password for branch {0}: ", branch);
|
|
|
|
|
Config.BetaPassword = password = Console.ReadLine();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
byte[] input = Util.DecodeHexString(node_encrypted["encrypted_gid"].Value);
|
|
|
|
|
byte[] manifest_bytes = CryptoHelper.VerifyAndDecryptPassword(input, password);
|
|
|
|
|
|
|
|
|
|
if (manifest_bytes == null)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("Password was invalid for branch {0}", branch);
|
|
|
|
|
return INVALID_MANIFEST_ID;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return BitConverter.ToUInt64(manifest_bytes, 0);
|
|
|
|
|
if (node_encrypted != KeyValue.Invalid)
|
|
|
|
|
{
|
|
|
|
|
string password = Config.BetaPassword;
|
|
|
|
|
if (password == null)
|
|
|
|
|
{
|
|
|
|
|
Console.Write("Please enter the password for branch {0}: ", branch);
|
|
|
|
|
Config.BetaPassword = password = Console.ReadLine();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var encrypted_v1 = node_encrypted["encrypted_gid"];
|
|
|
|
|
var encrypted_v2 = node_encrypted["encrypted_gid_2"];
|
|
|
|
|
|
|
|
|
|
if (encrypted_v1 != KeyValue.Invalid)
|
|
|
|
|
{
|
|
|
|
|
byte[] input = Util.DecodeHexString(encrypted_v1.Value);
|
|
|
|
|
byte[] manifest_bytes = CryptoHelper.VerifyAndDecryptPassword(input, password);
|
|
|
|
|
|
|
|
|
|
if (manifest_bytes == null)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("Password was invalid for branch {0}", branch);
|
|
|
|
|
return INVALID_MANIFEST_ID;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return BitConverter.ToUInt64(manifest_bytes, 0);
|
|
|
|
|
}
|
|
|
|
|
else if (encrypted_v2 != KeyValue.Invalid)
|
|
|
|
|
{
|
|
|
|
|
// Submit the password to Steam now to get encryption keys
|
|
|
|
|
steam3.CheckAppBetaPassword(appId, Config.BetaPassword);
|
|
|
|
|
|
|
|
|
|
if (!steam3.AppBetaPasswords.ContainsKey(branch))
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("Password was invalid for branch {0}", branch);
|
|
|
|
|
return INVALID_MANIFEST_ID;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
byte[] input = Util.DecodeHexString(encrypted_v2.Value);
|
|
|
|
|
byte[] manifest_bytes;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
manifest_bytes = CryptoHelper.SymmetricDecryptECB(input, steam3.AppBetaPasswords[branch]);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("Failed to decrypt branch {0}", branch);
|
|
|
|
|
return INVALID_MANIFEST_ID;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return BitConverter.ToUInt64(manifest_bytes, 0);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("Unhandled depot encryption for depotId {0}", depotId);
|
|
|
|
|
return INVALID_MANIFEST_ID;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return INVALID_MANIFEST_ID;
|
|
|
|
|
@ -431,14 +468,14 @@ namespace DepotDownloader
|
|
|
|
|
steam3.RequestAppTicket((uint)depotId);
|
|
|
|
|
|
|
|
|
|
ulong manifestID = GetSteam3DepotManifest(depotId, appId, branch);
|
|
|
|
|
if (manifestID == INVALID_MANIFEST_ID && branch != "public")
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("Warning: Depot {0} does not have branch named \"{1}\". Trying public branch.", depotId, branch);
|
|
|
|
|
branch = "public";
|
|
|
|
|
if (manifestID == INVALID_MANIFEST_ID && branch != "public")
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("Warning: Depot {0} does not have branch named \"{1}\". Trying public branch.", depotId, branch);
|
|
|
|
|
branch = "public";
|
|
|
|
|
manifestID = GetSteam3DepotManifest(depotId, appId, branch);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (manifestID == INVALID_MANIFEST_ID)
|
|
|
|
|
if (manifestID == INVALID_MANIFEST_ID)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("Depot {0} ({1}) missing public subsection or manifest section.", depotId, contentName);
|
|
|
|
|
return null;
|
|
|
|
|
|