working new aes manager

This commit is contained in:
Asval 2019-06-14 02:21:37 +02:00
parent 458f994ded
commit dcacef3969
8 changed files with 122 additions and 89 deletions

View File

@ -5,7 +5,7 @@
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{8FABCD3A-9D55-4B54-B237-B259D815DEB8}</ProjectGuid>
<OutputType>Exe</OutputType>
<OutputType>WinExe</OutputType>
<RootNamespace>FModel</RootNamespace>
<AssemblyName>FModel</AssemblyName>
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
@ -125,7 +125,7 @@
<Compile Include="Forms\AESManager.Designer.cs">
<DependentUpon>AESManager.cs</DependentUpon>
</Compile>
<Compile Include="Methods\AESManager\AESManager.cs" />
<Compile Include="Methods\AESManager\DynamicKeysManager.cs" />
<Compile Include="Methods\BackPAKs\DynamicPAKs.cs" />
<Compile Include="Methods\BackPAKs\Parser\AccessCodeParser.cs" />
<Compile Include="Methods\BackPAKs\Parser\AESKeyParser.cs" />

View File

@ -35,7 +35,6 @@
this.OKButton = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.panel1 = new System.Windows.Forms.Panel();
this.label1 = new System.Windows.Forms.Label();
this.groupBox3.SuspendLayout();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
@ -44,7 +43,6 @@
//
this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox3.Controls.Add(this.label1);
this.groupBox3.Controls.Add(this.textBox2);
this.groupBox3.Controls.Add(this.label3);
this.groupBox3.Location = new System.Drawing.Point(12, 12);
@ -103,17 +101,6 @@
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(559, 157);
this.panel1.TabIndex = 0;
//
// label1
//
this.label1.AutoSize = true;
this.label1.ForeColor = System.Drawing.Color.Red;
this.label1.Location = new System.Drawing.Point(42, -2);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(523, 13);
this.label1.TabIndex = 18;
this.label1.Text = "GitHub clone: Main PAKs txtbox is the only working txtbox for now, use it to load" +
" the pak you want, like before";
//
// AESManager
//
@ -144,6 +131,5 @@
private System.Windows.Forms.Button OKButton;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Label label1;
}
}

View File

@ -36,6 +36,14 @@ namespace FModel.Forms
lbl.Size = new Size(155, 13);
lbl.Text = dCurrentUsedPak.Substring(0, dCurrentUsedPak.LastIndexOf("."));
lbl.Parent = panel1;
if (DynamicKeysManager.AESEntries != null)
{
foreach (AESEntry s in DynamicKeysManager.AESEntries)
{
if (s.thePak == dCurrentUsedPak) { txtBox.Text = @"0x" + s.theKey; }
}
}
}
}
@ -43,6 +51,27 @@ namespace FModel.Forms
{
Properties.Settings.Default.AESKey = textBox2.Text.Substring(2).ToUpper();
DynamicKeysManager.AESEntries = new List<AESEntry>();
for (int i = 0; i < ThePak.dynamicPaksList.Count; i++)
{
string dCurrentUsedPak = ThePak.dynamicPaksList[i].thePak; //SET CURRENT DYNAMIC PAK
int pFrom = dCurrentUsedPak.IndexOf("pakchunk") + "pakchunk".Length;
int pTo = dCurrentUsedPak.LastIndexOf("WindowsClient.pak");
Control[] controls = this.Controls.Find("txtBox_" + dCurrentUsedPak.Substring(pFrom, pTo - pFrom - 1), true);
if (controls.Length > 0)
{
TextBox txtBox = controls[0] as TextBox;
if (txtBox != null)
{
if (!string.IsNullOrWhiteSpace(txtBox.Text))
{
DynamicKeysManager.serialize(txtBox.Text.Substring(2).ToUpper(), dCurrentUsedPak);
}
}
}
}
Properties.Settings.Default.Save();
Close();
}

View File

@ -142,6 +142,8 @@ namespace FModel
DLLImport.SetTreeViewTheme(treeView1.Handle);
DynamicKeysManager.deserialize();
_backupFileName = "\\FortniteGame_" + DateTime.Now.ToString("MMddyyyy") + ".txt";
ThePak.dynamicPaksList = new List<PaksEntry>();
ThePak.mainPaksList = new List<PaksEntry>();
@ -286,6 +288,7 @@ namespace FModel
string[] CurrentUsedPakLines = JohnWick.MyExtractor.GetFileList().ToArray();
if (CurrentUsedPakLines != null)
{
JohnWick.MyKey = Settings.Default.AESKey;
string mountPoint = JohnWick.MyExtractor.GetMountPoint();
ThePak.PaksMountPoint.Add(ThePak.mainPaksList[i].thePak, mountPoint.Substring(9));
@ -319,33 +322,43 @@ namespace FModel
if (theSinglePak != null && ThePak.mainPaksList[i].thePak == theSinglePak.ClickedItem.Text) { PakAsTxt = CurrentUsedPakLines; }
}
}
if (theSinglePak != null)
if (theSinglePak != null) //IMPORTANT: IT STILLS LOAD THE DICTIONARY -> IT'S GONNA BE USEFUL FOR TRANSLATIONS
{
ThePak.CurrentUsedPak = theSinglePak.ClickedItem.Text;
ThePak.CurrentUsedPakGuid = ThePak.ReadPakGuid(Settings.Default.PAKsPath + "\\" + ThePak.CurrentUsedPak);
if (ThePak.CurrentUsedPakGuid != "0-0-0-0") //LOADING DYNAMIC PAK
{
try
if (DynamicKeysManager.AESEntries != null)
{
JohnWick.MyExtractor = new PakExtractor(Settings.Default.PAKsPath + "\\" + ThePak.CurrentUsedPak, Settings.Default.AESKey);
PakAsTxt = JohnWick.MyExtractor.GetFileList().ToArray();
if (PakAsTxt != null)
foreach (AESEntry s in DynamicKeysManager.AESEntries)
{
string mountPoint = JohnWick.MyExtractor.GetMountPoint();
ThePak.PaksMountPoint.Add(ThePak.CurrentUsedPak, mountPoint.Substring(9));
for (int i = 0; i < PakAsTxt.Length; i++)
if (s.thePak == ThePak.CurrentUsedPak)
{
PakAsTxt[i] = mountPoint.Substring(6) + PakAsTxt[i];
try
{
JohnWick.MyExtractor = new PakExtractor(Settings.Default.PAKsPath + "\\" + ThePak.CurrentUsedPak, s.theKey);
PakAsTxt = JohnWick.MyExtractor.GetFileList().ToArray();
if (PakAsTxt != null)
{
JohnWick.MyKey = s.theKey;
string mountPoint = JohnWick.MyExtractor.GetMountPoint();
ThePak.PaksMountPoint.Add(ThePak.CurrentUsedPak, mountPoint.Substring(9));
for (int i = 0; i < PakAsTxt.Length; i++)
{
PakAsTxt[i] = mountPoint.Substring(6) + PakAsTxt[i];
}
}
}
catch (Exception)
{
//do not crash
}
}
}
}
catch (Exception)
{
UpdateConsole("Can't read " + ThePak.CurrentUsedPak + " with this key", Color.FromArgb(255, 244, 66, 66), "Error");
}
}
}
if (loadAllPaKs)
@ -475,7 +488,7 @@ namespace FModel
UpdateConsole(Settings.Default.PAKsPath + "\\" + selectedPak.ClickedItem.Text, Color.FromArgb(255, 66, 244, 66), "Success");
}
else
UpdateConsole("Can't read " + selectedPak.ClickedItem.Text + " with this key", Color.FromArgb(255, 244, 66, 66), "Error");
UpdateConsole("Please, provide a working key in the AES Manager for " + selectedPak.ClickedItem.Text, Color.FromArgb(255, 244, 66, 66), "Error");
}
if (loadAllPaKs)
{

View File

@ -1,56 +0,0 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Xml.Serialization;
namespace FModel
{
static class AESManager
{
/*public static List<AESEntry> AESEntries { get; set; }
private static XmlSerializer serializer = new XmlSerializer(typeof(List<AESEntry>));
public static void serialize(string data)
{
ConfigurationUserLevel level = ConfigurationUserLevel.PerUserRoamingAndLocal;
Configuration configuration = ConfigurationManager.OpenExeConfiguration(level);
string configurationFilePath = configuration.FilePath.Substring(0, configuration.FilePath.LastIndexOf("\\"));
AESEntries.Add(new AESEntry()
{
theKey = data
});
string path = configurationFilePath + "\\AESManager.xml";
Directory.CreateDirectory(Path.GetDirectoryName(path));
using (var fileStream = new FileStream(path, FileMode.Create))
{
serializer.Serialize(fileStream, AESEntries);
}
}
public static string[] deserialize()
{
ConfigurationUserLevel level = ConfigurationUserLevel.PerUserRoamingAndLocal;
Configuration configuration = ConfigurationManager.OpenExeConfiguration(level);
string configurationFilePath = configuration.FilePath.Substring(0, configuration.FilePath.LastIndexOf("\\"));
string path = configurationFilePath + "\\AESManager.xml";
List<AESEntry> outputList;
using (var fileStream = new FileStream(path, FileMode.Open))
{
outputList = (List<AESEntry>)serializer.Deserialize(fileStream);
}
string[] toReturn = new string[outputList.Count];
for (int i = 0; i < toReturn.Length; i++)
{
toReturn[i] = outputList[i].theKey;
}
return toReturn;
}*/
}
}

View File

@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Xml.Serialization;
namespace FModel
{
static class DynamicKeysManager
{
public static List<AESEntry> AESEntries { get; set; }
private static XmlSerializer serializer = new XmlSerializer(typeof(List<AESEntry>));
private static string path = Properties.Settings.Default.ExtractOutput + "\\AESManager.xml";
public static void serialize(string key, string pak)
{
Directory.CreateDirectory(Path.GetDirectoryName(path));
AESEntries.Add(new AESEntry()
{
theKey = key,
thePak = pak
});
using (var fileStream = new FileStream(path, FileMode.Create))
{
serializer.Serialize(fileStream, AESEntries);
}
}
public static void deserialize()
{
if (File.Exists(path))
{
List<AESEntry> outputList;
using (var fileStream = new FileStream(path, FileMode.Open))
{
outputList = (List<AESEntry>)serializer.Deserialize(fileStream);
}
AESEntries = outputList;
}
}
}
}

View File

@ -13,6 +13,7 @@ namespace FModel
{
public static PakAsset MyAsset;
public static PakExtractor MyExtractor;
public static string MyKey;
public static string[] myArray { get; set; }
private static string currentPakToCheck { get; set; }
@ -72,7 +73,7 @@ namespace FModel
{
if (currentPak != currentPakToCheck || myArray == null)
{
MyExtractor = new PakExtractor(Settings.Default.PAKsPath + "\\" + currentPak, Settings.Default.AESKey);
MyExtractor = new PakExtractor(Settings.Default.PAKsPath + "\\" + currentPak, MyKey);
myArray = MyExtractor.GetFileList().ToArray();
}

View File

@ -102,4 +102,20 @@ namespace FModel
throw new NotImplementedException();
}
}
public struct AESEntry : IEquatable<AESEntry>
{
internal AESEntry(string myPak, string myKey)
{
thePak = myPak;
theKey = myKey;
}
public string thePak { get; set; }
public string theKey { get; set; }
bool IEquatable<AESEntry>.Equals(AESEntry other)
{
throw new NotImplementedException();
}
}
}