|
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Reflection.PortableExecutable;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace apphost_extract_v2.General
|
|
|
|
|
{
|
|
|
|
@ -21,24 +22,33 @@ namespace apphost_extract_v2.General
|
|
|
|
|
public void ExtractAll(string outputDir)
|
|
|
|
|
{
|
|
|
|
|
Directory.CreateDirectory(outputDir);
|
|
|
|
|
|
|
|
|
|
foreach(var fileEntry in Header.Manifest.FileEntries)
|
|
|
|
|
//Parallel.ForEach(Header.Manifest.FileEntries, fileEntry =>
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var bytes = FileStream.ReadBuffer(fileEntry.Offset, fileEntry.Size);
|
|
|
|
|
var name = fileEntry.Name;
|
|
|
|
|
if (FileChecker.IsKnownFile(bytes))
|
|
|
|
|
{
|
|
|
|
|
Log.Info($"Extracting {name} --> Known file", ConsoleColor.Green);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Log.Info($"Extracting {name} --> Unknown file", ConsoleColor.Yellow);
|
|
|
|
|
name = name.Insert(0, "_");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var filePath = Path.Combine(outputDir, name);
|
|
|
|
|
File.WriteAllBytes(filePath, bytes);
|
|
|
|
|
|
|
|
|
|
Log.Critical($"Extracted {name}");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
Log.Error($"Could not extract {fileEntry.Name}: {ex.Message}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}//);
|
|
|
|
|
Console.WriteLine();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public abstract void Close();
|
|
|
|
|