Added depot encryption key support.

pull/8/head
azuisleet 14 years ago
parent e7129f0a1f
commit c7593aefbd

@ -209,10 +209,11 @@ namespace DepotDownloader
*/ */
// find a proper bootstrap... // find a proper bootstrap...
IPEndPoint contentServer1 = new IPEndPoint(IPAddress.Parse("4.28.20.42"), 80); CDNClient.ClientEndPoint contentServer1 = new CDNClient.ClientEndPoint("4.28.20.42", 80);
List<IPEndPoint> cdnServers = CDNClient.FetchServerList(contentServer1, cellId); List<CDNClient.ClientEndPoint> cdnServers = CDNClient.FetchServerList(contentServer1, cellId);
Console.WriteLine(" Done!"); Console.WriteLine(" Done!");
Console.Write("Downloading depot manifest...");
CDNClient cdnClient = new CDNClient(cdnServers[0], credentials.AppTicket); CDNClient cdnClient = new CDNClient(cdnServers[0], credentials.AppTicket);
@ -231,9 +232,19 @@ namespace DepotDownloader
} }
string manifestFile = Path.Combine(installDir, "manifest.bin"); string manifestFile = Path.Combine(installDir, "manifest.bin");
string keyFile = Path.Combine(installDir, "depotkey.bin");
File.WriteAllBytes(manifestFile, manifest); File.WriteAllBytes(manifestFile, manifest);
File.WriteAllBytes(keyFile, steam3.DepotKey);
DepotManifest depotManifest = new DepotManifest(manifest); DepotManifest depotManifest = new DepotManifest(manifest);
if (!depotManifest.DecryptFilenames(steam3.DepotKey))
{
Console.WriteLine("\nUnable to decrypt manifest for depot {0}", depotId);
return;
}
Console.WriteLine(" Done!");
} }
private static void DownloadSteam2( ContentServerClient.Credentials credentials, int depotId, int depotVersion, int cellId, string username, string password, bool onlyManifest, bool gameServer, bool exclude, string installDir, string[] fileList ) private static void DownloadSteam2( ContentServerClient.Credentials credentials, int depotId, int depotVersion, int cellId, string username, string password, bool onlyManifest, bool gameServer, bool exclude, string installDir, string[] fileList )

@ -27,6 +27,7 @@ namespace DepotDownloader
private set; private set;
} }
public byte[] DepotKey { get; private set; }
public ReadOnlyCollection<SteamApps.AppInfoCallback.AppInfo> AppInfo { get; private set; } public ReadOnlyCollection<SteamApps.AppInfoCallback.AppInfo> AppInfo { get; private set; }
SteamClient steamClient; SteamClient steamClient;
@ -37,6 +38,7 @@ namespace DepotDownloader
Thread callbackThread; Thread callbackThread;
ManualResetEvent credentialHandle; ManualResetEvent credentialHandle;
bool bConnected; bool bConnected;
bool bKeyResponse;
DateTime connectTime; DateTime connectTime;
@ -58,6 +60,7 @@ namespace DepotDownloader
this.credentials = new Credentials(); this.credentials = new Credentials();
this.credentialHandle = new ManualResetEvent( false ); this.credentialHandle = new ManualResetEvent( false );
this.bConnected = false; this.bConnected = false;
this.bKeyResponse = false;
this.steamClient = new SteamClient(); this.steamClient = new SteamClient();
@ -101,7 +104,7 @@ namespace DepotDownloader
if ( diff > STEAM3_TIMEOUT && !bConnected ) if ( diff > STEAM3_TIMEOUT && !bConnected )
break; break;
if ( credentials.HasSessionToken && credentials.AppTicket != null && Licenses != null && credentials.Steam2Ticket != null && AppInfo != null ) if ( credentials.HasSessionToken && credentials.AppTicket != null && Licenses != null && credentials.Steam2Ticket != null && AppInfo != null && bKeyResponse )
break; break;
if ( callback == null ) if ( callback == null )
@ -145,6 +148,7 @@ namespace DepotDownloader
steamApps.GetAppInfo( depotId ); steamApps.GetAppInfo( depotId );
steamApps.GetAppOwnershipTicket( depotId ); steamApps.GetAppOwnershipTicket( depotId );
steamApps.GetDepotDecryptionKey( depotId );
} }
if ( callback.IsType<SteamApps.AppOwnershipTicketCallback>() ) if ( callback.IsType<SteamApps.AppOwnershipTicketCallback>() )
@ -204,6 +208,16 @@ namespace DepotDownloader
Console.WriteLine("Got AppInfo for {0}", msg.Apps[0].AppID); Console.WriteLine("Got AppInfo for {0}", msg.Apps[0].AppID);
AppInfo = msg.Apps; AppInfo = msg.Apps;
} }
if (callback.IsType<SteamApps.DepotKeyCallback>())
{
var msg = callback as SteamApps.DepotKeyCallback;
DepotKey = msg.DepotKey;
Console.WriteLine("Got depot key for {0} result: {1}", msg.DepotID, msg.Result);
bKeyResponse = true;
}
} }
credentialHandle.Set(); credentialHandle.Set();

Loading…
Cancel
Save