diff --git a/BurnOutSharp/PackerType/WiseInstaller.cs b/BurnOutSharp/PackerType/WiseInstaller.cs index 42f6306b..f0d7c966 100644 --- a/BurnOutSharp/PackerType/WiseInstaller.cs +++ b/BurnOutSharp/PackerType/WiseInstaller.cs @@ -95,7 +95,10 @@ namespace BurnOutSharp.PackerType // If the installer file itself fails try { - // TODO: Include NE parsing + // Try to parse as a New Executable + NewExecutable nex = NewExecutable.Create(stream); + if (nex != null) + return ScanNewExecutable(scanner, nex, file); // Try to parse as a Portable Executable PortableExecutable pex = PortableExecutable.Create(stream); @@ -214,6 +217,51 @@ namespace BurnOutSharp.PackerType return null; } + /// + /// Attempt to extract Wise data from a New Executable + /// + /// Scanner object for state tracking + /// New executable to check + /// Path to the input file + /// True if it matches a known version, false otherwise + private ConcurrentDictionary> ScanNewExecutable(Scanner scanner, NewExecutable nex, string file) + { + // If the installer file itself fails + try + { + string tempPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); + Directory.CreateDirectory(tempPath); + + // TODO: Try to find where the file data lives and how to get it + Wise unpacker = new Wise(); + unpacker.ExtractTo(file, tempPath); + + // Collect and format all found protections + var protections = scanner.GetProtections(tempPath); + + // If temp directory cleanup fails + try + { + Directory.Delete(tempPath, true); + } + catch (Exception ex) + { + if (scanner.IncludeDebug) Console.WriteLine(ex); + } + + // Remove temporary path references + StripFromKeys(protections, tempPath); + + return protections; + } + catch (Exception ex) + { + if (scanner.IncludeDebug) Console.WriteLine(ex); + } + + return null; + } + /// /// Attempt to extract Wise data from a Portable Executable ///