Created
February 7, 2023 14:57
-
-
Save sunnamed434/51b4694b655ca0db6792176affb33061 to your computer and use it in GitHub Desktop.
PackerPacker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Task ExecuteAsync(ProtectionContext context, ProtectionParameters parameters) | |
{ | |
using (var stream = File.Open(context.BitMonoContext.OutputFile, FileMode.Open, FileAccess.ReadWrite, FileSha | |
using (var reader = new BinaryReader(stream)) | |
using (var writer = new BinaryWriter(stream)) | |
{ | |
stream.Position = 0x3C; | |
var peHeader = reader.ReadUInt32(); | |
stream.Position = peHeader; | |
stream.Position += 0x18; | |
var x64PEOptionsHeader = reader.ReadUInt16() == 0x20B; | |
stream.Position += x64PEOptionsHeader ? 0x6A : 0x5A; | |
writer.Write(0x00013); // NumberOfRvaAndSizes | |
stream.Position += 0xC; | |
writer.Write(0); // Import.Size | |
stream.Position += 0x20; | |
writer.Write(0); // Debug.VirtualAddress | |
writer.Write(0); // Debug.Size | |
stream.Position += 0x3C; | |
writer.Write(0); // .NET.Size | |
} | |
return Task.CompletedTask; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment