New backup pak1000+ method, work even if user's game isn't up to date

This commit is contained in:
Asval 2019-05-25 20:38:11 +02:00
parent 84969dcdf3
commit a0e3d8b454
9 changed files with 156 additions and 50 deletions

View File

@ -124,6 +124,12 @@
<setting name="createIconForSTWCardPacks" serializeAs="String">
<value>True</value>
</setting>
<setting name="eEmail" serializeAs="String">
<value />
</setting>
<setting name="ePassword" serializeAs="String">
<value />
</setting>
</FModel.Properties.Settings>
</userSettings>
</configuration>

View File

@ -91,6 +91,9 @@
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="RestSharp, Version=106.6.9.0, Culture=neutral, PublicKeyToken=598062e77f915f75, processorArchitecture=MSIL">
<HintPath>..\packages\RestSharp.106.6.9\lib\net452\RestSharp.dll</HintPath>
</Reference>
<Reference Include="ScintillaNET FindReplaceDialog, Version=1.4.0.17540, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>DLLs\ScintillaNET FindReplaceDialog.dll</HintPath>
@ -100,6 +103,7 @@
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
@ -115,6 +119,11 @@
<Compile Include="Custom\JsonExtensions.cs" />
<Compile Include="Custom\Prompt.cs" />
<Compile Include="Custom\TypeAssistant.cs" />
<Compile Include="Methods\BackupPAKs\DynamicPAKs.cs" />
<Compile Include="Methods\BackupPAKs\Parser\AccessCodeParser.cs" />
<Compile Include="Methods\BackupPAKs\Parser\AccessTokenParser.cs" />
<Compile Include="Methods\BackupPAKs\Parser\AESKeyParser.cs" />
<Compile Include="Methods\BackupPAKs\Parser\ExchangeTokenParser.cs" />
<Compile Include="Methods\IconGenerator\ItemIcon.cs" />
<Compile Include="Methods\IconGenerator\Rarity.cs" />
<Compile Include="Forms\About.cs">

View File

@ -52,6 +52,12 @@
this.label5 = new System.Windows.Forms.Label();
this.textBox3 = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.groupBox5 = new System.Windows.Forms.GroupBox();
this.label7 = new System.Windows.Forms.Label();
this.textBox5 = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.textBox4 = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.groupBox3.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox4.SuspendLayout();
@ -60,6 +66,7 @@
((System.ComponentModel.ISupportInitialize)(this.wPictureBox)).BeginInit();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.imgsPerRow)).BeginInit();
this.groupBox5.SuspendLayout();
this.SuspendLayout();
//
// groupBox3
@ -122,7 +129,7 @@
//
this.OKButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.OKButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.OKButton.Location = new System.Drawing.Point(475, 379);
this.OKButton.Location = new System.Drawing.Point(475, 476);
this.OKButton.Name = "OKButton";
this.OKButton.Size = new System.Drawing.Size(97, 21);
this.OKButton.TabIndex = 15;
@ -142,7 +149,7 @@
this.groupBox4.Controls.Add(this.label8);
this.groupBox4.Controls.Add(this.button1);
this.groupBox4.Controls.Add(this.wPictureBox);
this.groupBox4.Location = new System.Drawing.Point(12, 122);
this.groupBox4.Location = new System.Drawing.Point(12, 220);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(560, 195);
this.groupBox4.TabIndex = 16;
@ -256,7 +263,7 @@
this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.textBox3);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Location = new System.Drawing.Point(12, 322);
this.groupBox1.Location = new System.Drawing.Point(12, 420);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(560, 46);
this.groupBox1.TabIndex = 17;
@ -303,11 +310,71 @@
this.label4.TabIndex = 9;
this.label4.Text = "File Name:";
//
// groupBox5
//
this.groupBox5.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.groupBox5.Controls.Add(this.label7);
this.groupBox5.Controls.Add(this.textBox5);
this.groupBox5.Controls.Add(this.label6);
this.groupBox5.Controls.Add(this.textBox4);
this.groupBox5.Controls.Add(this.label2);
this.groupBox5.Location = new System.Drawing.Point(12, 122);
this.groupBox5.Name = "groupBox5";
this.groupBox5.Size = new System.Drawing.Size(560, 92);
this.groupBox5.TabIndex = 18;
this.groupBox5.TabStop = false;
this.groupBox5.Text = "Backup PAKs 1000+";
//
// label7
//
this.label7.AutoSize = true;
this.label7.ForeColor = System.Drawing.Color.Red;
this.label7.Location = new System.Drawing.Point(347, 72);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(207, 13);
this.label7.TabIndex = 6;
this.label7.Text = "This is only used to backup dynamic PAKs";
//
// textBox5
//
this.textBox5.Location = new System.Drawing.Point(95, 45);
this.textBox5.Name = "textBox5";
this.textBox5.PasswordChar = '*';
this.textBox5.Size = new System.Drawing.Size(459, 20);
this.textBox5.TabIndex = 4;
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(6, 48);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(83, 13);
this.label6.TabIndex = 5;
this.label6.Text = "EPIC Password:";
//
// textBox4
//
this.textBox4.Location = new System.Drawing.Point(74, 19);
this.textBox4.Name = "textBox4";
this.textBox4.PasswordChar = '*';
this.textBox4.Size = new System.Drawing.Size(480, 20);
this.textBox4.TabIndex = 2;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(6, 22);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(62, 13);
this.label2.TabIndex = 3;
this.label2.Text = "EPIC Email:";
//
// Settings
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(584, 412);
this.ClientSize = new System.Drawing.Size(584, 509);
this.Controls.Add(this.groupBox5);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.groupBox4);
this.Controls.Add(this.OKButton);
@ -332,6 +399,8 @@
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.imgsPerRow)).EndInit();
this.groupBox5.ResumeLayout(false);
this.groupBox5.PerformLayout();
this.ResumeLayout(false);
}
@ -361,5 +430,11 @@
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.GroupBox groupBox5;
private System.Windows.Forms.TextBox textBox5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.TextBox textBox4;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label7;
}
}

View File

@ -79,6 +79,9 @@ namespace FModel.Forms
textBox2.Text = Properties.Settings.Default.PAKsPath;
textBox1.Text = Properties.Settings.Default.ExtractOutput;
textBox4.Text = Properties.Settings.Default.eEmail;
textBox5.Text = Properties.Settings.Default.ePassword;
//MERGER
textBox3.Text = Properties.Settings.Default.mergerFileName;
imgsPerRow.Value = Properties.Settings.Default.mergerImagesRow;
@ -150,6 +153,9 @@ namespace FModel.Forms
MessageBox.Show(@"Please, restart FModel to apply your new output path", @"FModel Output Path Changed", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
Properties.Settings.Default.eEmail = textBox4.Text;
Properties.Settings.Default.ePassword = textBox5.Text;
//MERGER
Properties.Settings.Default.mergerFileName = textBox3.Text;
Properties.Settings.Default.mergerImagesRow = Decimal.ToInt32(imgsPerRow.Value);

View File

@ -9,7 +9,6 @@ using System.Drawing.Text;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net;
using System.Runtime.InteropServices;
using System.Security.AccessControl;
using System.Security.Principal;
@ -21,7 +20,7 @@ using FModel.Converter;
using FModel.Forms;
using FModel.Parser.Banners;
using FModel.Parser.Challenges;
using FModel.Parser.Featured;
using FModel.Methods.BackupPAKs.Parser.AESKeyParser;
using FModel.Parser.Items;
using FModel.Parser.Quests;
using FModel.Properties;
@ -44,7 +43,7 @@ namespace FModel
private static Dictionary<string, long> _questStageDict;
private static Dictionary<string, string> _diffToExtract;
private static string _backupFileName;
private static string _backupDynamicKeys;
private static string[] _backupDynamicKeys;
private static List<string> _itemsToDisplay;
public static string ExtractedFilePath;
public static string[] SelectedItemsArray;
@ -738,17 +737,17 @@ namespace FModel
}
private void CreateBackupList(string[] allYourPaKs)
{
_backupDynamicKeys = null;
bool connection = IsInternetAvailable();
string url = "https://pastebin.com/raw/bbnhmjWN";
if (connection)
if (connection && (!string.IsNullOrWhiteSpace(Settings.Default.eEmail) || !string.IsNullOrWhiteSpace(Settings.Default.ePassword)))
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
using (Stream stream = response.GetResponseStream())
using (StreamReader reader = new StreamReader(stream ?? throw new InvalidOperationException()))
{
_backupDynamicKeys = reader.ReadToEnd();
}
string myContent = DynamicPAKs.GetEndpoint("https://fortnite-public-service-prod11.ol.epicgames.com/fortnite/api/storefront/v2/keychain", true);
if (myContent.Contains("\"errorCode\": \"errors.com.epicgames.common.authentication.authentication_failed\""))
AppendText("EPIC Authentification Failed.", Color.Red, true);
else
_backupDynamicKeys = AesKeyParser.FromJson(myContent);
}
Settings.Default.AESKey = AESKeyTextBox.Text.Substring(2).ToUpper();
@ -785,16 +784,20 @@ namespace FModel
File.AppendAllLines(App.DefaultOutputPath + "\\Backup" + _backupFileName, CurrentUsedPakLines);
}
}
else
else if (_backupDynamicKeys != null)
{
foreach (var myString in _backupDynamicKeys.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries))
foreach (string myString in _backupDynamicKeys)
{
var parts = myString.Split(':');
if (parts[0] == arCurrentUsedPak && parts[1].StartsWith("0x"))
string[] parts = myString.Split(':');
if (DynamicPAKs.getPakGuidFromKeychain(parts) == arCurrentUsedPakGuid)
{
byte[] bytes = Convert.FromBase64String(parts[1]);
string aeskey = BitConverter.ToString(bytes).Replace("-", "");
try
{
JohnWick.MyExtractor = new PakExtractor(Settings.Default.PAKsPath + "\\" + arCurrentUsedPak, parts[1].Substring(2));
JohnWick.MyExtractor = new PakExtractor(Settings.Default.PAKsPath + "\\" + arCurrentUsedPak, aeskey);
}
catch (Exception)
{
@ -811,41 +814,16 @@ namespace FModel
{
CurrentUsedPakLines[ii] = JohnWick.MyExtractor.GetMountPoint().Substring(6) + CurrentUsedPakLines[ii];
}
UpdateConsole(arCurrentUsedPak, Color.FromArgb(255, 244, 132, 66), "Waiting");
AppendText("Backing up ", Color.Black);
AppendText(arCurrentUsedPak, Color.DarkRed, true);
File.AppendAllLines(App.DefaultOutputPath + "\\Backup" + _backupFileName, CurrentUsedPakLines);
}
}
else if (parts[0] == arCurrentUsedPak && parts[1] == "undefined")
{
AppendText("No key found for ", Color.Black);
AppendText(arCurrentUsedPak, Color.DarkRed, true);
//TODO: BETTER VERSION KTHX
/*string promptValue = Prompt.ShowDialog("AES Key:", arCurrentUsedPak);
if (!string.IsNullOrEmpty(promptValue))
{
JwpmProcess("filelist \"" + Settings.Default.PAKsPath + "\\" + arCurrentUsedPak + "\" \"" + App.DefaultOutputPath + "\" " + promptValue.Substring(2));
if (File.Exists(App.DefaultOutputPath + "\\" + arCurrentUsedPak + ".txt"))
{
if (!File.Exists(App.DefaultOutputPath + "\\Backup" + _backupFileName))
File.Create(App.DefaultOutputPath + "\\Backup" + _backupFileName).Dispose();
string[] CurrentUsedPakLines = File.ReadAllLines(App.DefaultOutputPath + "\\" + arCurrentUsedPak + ".txt");
for (int ii = 0; ii < CurrentUsedPakLines.Length; ii++)
{
CurrentUsedPakLines[ii] = "FortniteGame/" + CurrentUsedPakLines[ii];
}
UpdateConsole(".PAK mount point: \"/FortniteGame/\"", Color.FromArgb(255, 244, 132, 66), "Waiting");
File.AppendAllLines(App.DefaultOutputPath + "\\Backup" + _backupFileName, CurrentUsedPakLines);
File.Delete(App.DefaultOutputPath + "\\" + arCurrentUsedPak + ".txt");
}
}*/
}
}
}
}
if (File.Exists(App.DefaultOutputPath + "\\Backup" + _backupFileName))
UpdateConsole("\\Backup" + _backupFileName + " successfully created", Color.FromArgb(255, 66, 244, 66), "Success");
else

View File

@ -148,7 +148,8 @@ namespace FModel
if (ThePak.CurrentUsedItem == "DA_Featured_Glider_ID_141_AshtonBoardwalk" ||
ThePak.CurrentUsedItem == "DA_Featured_Glider_ID_150_TechOpsBlue" ||
ThePak.CurrentUsedItem == "DA_Featured_Glider_ID_131_SpeedyMidnight")
ThePak.CurrentUsedItem == "DA_Featured_Glider_ID_131_SpeedyMidnight" ||
ThePak.CurrentUsedItem == "DA_Featured_Pickaxe_ID_178_SpeedyMidnight")
GetItemIcon(theItem);
else
{

View File

@ -478,5 +478,29 @@ namespace FModel.Properties {
this["createIconForSTWCardPacks"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string eEmail {
get {
return ((string)(this["eEmail"]));
}
set {
this["eEmail"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string ePassword {
get {
return ((string)(this["ePassword"]));
}
set {
this["ePassword"] = value;
}
}
}
}

View File

@ -116,5 +116,11 @@
<Setting Name="createIconForSTWCardPacks" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="eEmail" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="ePassword" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
</Settings>
</SettingsFile>

View File

@ -3,4 +3,5 @@
<package id="Autoupdater.NET.Official" version="1.5.1" targetFramework="net471" />
<package id="jacobslusser.ScintillaNET" version="3.6.3" targetFramework="net471" />
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net471" />
<package id="RestSharp" version="106.6.9" targetFramework="net471" />
</packages>