Align ContainsSection checks

This commit is contained in:
Matt Nadareski
2025-09-20 18:55:05 -04:00
parent cc87d44e3f
commit 0afd189fe0
5 changed files with 19 additions and 13 deletions

View File

@@ -10,12 +10,13 @@ namespace BinaryObjectScanner.Packer
/// <inheritdoc/>
public string? CheckExecutable(string file, PortableExecutable exe, bool includeDebug)
{
bool mpress1 = exe.ContainsSection(".MPRESS1");
bool mpress2 = exe.ContainsSection(".MPRESS2 ");
// TODO: Confirm if both need to be present
if (mpress1 || mpress2)
return "MPRESS"; // TODO: Figure out how to get version
// TODO: Figure out how to get version
if (exe.ContainsSection(".MPRESS1"))
return "MPRESS";
if (exe.ContainsSection(".MPRESS2"))
return "MPRESS";
return null;
}

View File

@@ -12,7 +12,7 @@ namespace BinaryObjectScanner.Packer
public string? CheckExecutable(string file, PortableExecutable exe, bool includeDebug)
{
// <see href="https://www.virustotal.com/gui/file/601573f263115035921f621598f7a81ace998bf325e081165aa698b981822013/details"/>
if (exe.ContainsSection(".pklstb"))
if (exe.ContainsSection(".pklstb", exact: true))
return "PKLITE32"; // TODO: Figure out how to determine version
return null;

View File

@@ -10,12 +10,13 @@ namespace BinaryObjectScanner.Packer
/// <inheritdoc/>
public string? CheckExecutable(string file, PortableExecutable exe, bool includeDebug)
{
bool shrink0 = exe.ContainsSection(".shrink0", exact: true);
bool shrink2 = exe.ContainsSection(".shrink2", exact: true);
// TODO: Confirm if both need to be present
// TODO: Figure out how to get version
// TODO: Confirm if both need to be present
if (shrink0 || shrink2)
return "Shrinker"; // TODO: Figure out how to get version
if (exe.ContainsSection(".shrink0", exact: true))
return "Shrinker";
if (exe.ContainsSection(".shrink2", exact: true))
return "Shrinker";
return null;
}

View File

@@ -28,7 +28,9 @@ namespace BinaryObjectScanner.Protection
// Get the .neac0 and .neac1 sections, if they exist.
// Found in "NeacSafe64.sys" and "NeacSafe.sys".
if (exe.ContainsSection(".neac0", exact: true) || exe.ContainsSection(".neac1", exact: true))
if (exe.ContainsSection(".neac0", exact: true))
return "NEAC Protect";
if (exe.ContainsSection(".neac1", exact: true))
return "NEAC Protect";
string? name = exe.ProductName;

View File

@@ -187,7 +187,9 @@ namespace BinaryObjectScanner.Protection
}
// Get the .cms_d and .cms_t sections, if they exist -- TODO: Confirm if both are needed or either/or is fine
if (exe.ContainsSection(".cmd_d", true) || exe.ContainsSection(".cms_t", true))
if (exe.ContainsSection(".cmd_d", true))
return $"SecuROM 1-3";
if (exe.ContainsSection(".cms_t", true))
return $"SecuROM 1-3";
return null;