Hide section complexity from content checks

This commit is contained in:
Matt Nadareski
2022-03-14 23:01:06 -07:00
parent ceae505f4d
commit 65eea4301d
9 changed files with 64 additions and 58 deletions

View File

@@ -40,7 +40,7 @@ namespace BurnOutSharp.ProtectionType
return null;
// Get the last .bss section, if it exists
var bssSectionRaw = pex.ReadRawSection(pex.SourceArray, ".bss", first: false);
var bssSectionRaw = pex.ReadRawSection(".bss", first: false);
if (bssSectionRaw != null)
{
var matchers = new List<ContentMatchSet>

View File

@@ -15,7 +15,7 @@ namespace BurnOutSharp.ProtectionType
return null;
// Get the code/CODE section, if it exists
var codeSectionRaw = pex.ReadRawSection(pex.SourceArray, "code", first: true) ?? pex.ReadRawSection(pex.SourceArray, "CODE", first: true);
var codeSectionRaw = pex.ReadRawSection("code", first: true) ?? pex.ReadRawSection("CODE", first: true);
if (codeSectionRaw != null)
{
var matchers = new List<ContentMatchSet>

View File

@@ -24,7 +24,7 @@ namespace BurnOutSharp.ProtectionType
if (extSection)
{
// Get the .dcrtext section, if it exists
var dcrtextSectionRaw = pex.ReadRawSection(pex.SourceArray, ".dcrtext");
var dcrtextSectionRaw = pex.ReadRawSection(".dcrtext");
if (dcrtextSectionRaw != null)
{
var matchers = new List<ContentMatchSet>

View File

@@ -272,7 +272,7 @@ namespace BurnOutSharp.ProtectionType
private string CheckSectionForProtection(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, string sectionName)
{
// This subtract is needed because BoG_ starts before the section
var sectionRaw = pex.ReadRawSection(fileContent, sectionName, first: true, offset: -64);
var sectionRaw = pex.ReadRawSection(sectionName, first: true, offset: -64);
if (sectionRaw != null)
{
var matchers = new List<ContentMatchSet>

View File

@@ -33,7 +33,7 @@ namespace BurnOutSharp.ProtectionType
return match;
// Get the .tls section, if it exists
var tlsSectionRaw = pex.ReadRawSection(pex.SourceArray, ".tls", first: false);
var tlsSectionRaw = pex.ReadRawSection(".tls", first: false);
match = GetMatchForSection(file, tlsSectionRaw, includeDebug);
if (!string.IsNullOrWhiteSpace(match))
return match;

View File

@@ -37,7 +37,7 @@ namespace BurnOutSharp.ProtectionType
return $"SolidShield Activation Manager Module {GetFileVersion(pex)}";
// Get the .init section, if it exists
var initSectionRaw = pex.ReadRawSection(pex.SourceArray, ".init", first: true);
var initSectionRaw = pex.ReadRawSection(".init", first: true);
if (initSectionRaw != null)
{
var matchers = new List<ContentMatchSet>
@@ -66,7 +66,7 @@ namespace BurnOutSharp.ProtectionType
var sectionNames = pex.GetSectionNames();
for (int i = (sectionNames.Length >= 2 ? sectionNames.Length - 2 : 0); i < sectionNames.Length; i++)
{
var nthSectionRaw = pex.ReadRawSection(pex.SourceArray, sectionNames[i], first: false);
var nthSectionRaw = pex.ReadRawSection(sectionNames[i], first: false);
if (nthSectionRaw != null)
{
var matchers = new List<ContentMatchSet>

View File

@@ -25,7 +25,7 @@ namespace BurnOutSharp.ProtectionType
return "WTM Protection Viewer";
// Get the CODE section, if it exists
var codeSectionRaw = pex.ReadRawSection(pex.SourceArray, "CODE", first: true);
var codeSectionRaw = pex.ReadRawSection("CODE", first: true);
if (codeSectionRaw != null)
{
var matchers = new List<ContentMatchSet>