From 2c4906534b88c18f54d86356daedf73e4f73fbca Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Tue, 8 Nov 2022 15:11:18 -0800 Subject: [PATCH] Enable PE headers writing --- BurnOutSharp.Builder/PortableExecutable.cs | 8 ++++---- ExecutableTest/Program.cs | 17 ++++++++++++----- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/BurnOutSharp.Builder/PortableExecutable.cs b/BurnOutSharp.Builder/PortableExecutable.cs index 8f6b8f81..e81e11ba 100644 --- a/BurnOutSharp.Builder/PortableExecutable.cs +++ b/BurnOutSharp.Builder/PortableExecutable.cs @@ -79,8 +79,8 @@ namespace BurnOutSharp.Builder #endregion - // TODO: Implement PE parsing - return null; + // TODO: Finish implementing PE parsing + return executable; } /// @@ -349,8 +349,8 @@ namespace BurnOutSharp.Builder #endregion - // TODO: Implement PE parsing - return null; + // TODO: Finish implementing PE parsing + return executable; } /// diff --git a/ExecutableTest/Program.cs b/ExecutableTest/Program.cs index 08121fa5..feba089a 100644 --- a/ExecutableTest/Program.cs +++ b/ExecutableTest/Program.cs @@ -1,5 +1,4 @@ -using System.Security.Cryptography; -using System.Text; +using System.Text; using BurnOutSharp.Builder; namespace ExecutableTest @@ -94,9 +93,17 @@ namespace ExecutableTest // Portable Executable else if (magic[0] == 'P' && magic[1] == 'E' && magic[2] == '\0' && magic[3] == '\0') { - Console.WriteLine($"Portable executable found. No parsing currently available."); - Console.WriteLine(); - continue; + stream.Seek(0, SeekOrigin.Begin); + var portableExecutable = PortableExecutable.ParseExecutable(stream); + if (portableExecutable == null) + { + Console.WriteLine("Something went wrong parsing Portable Executable"); + Console.WriteLine(); + continue; + } + + // Print the executable info to screen + PrintPortableExecutable(portableExecutable); } // Unknown