Skip to content

Commit 0afd189

Browse files
committed
Align ContainsSection checks
1 parent cc87d44 commit 0afd189

File tree

5 files changed

+19
-13
lines changed

5 files changed

+19
-13
lines changed

BinaryObjectScanner/Packer/MPRESS.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ public class MPRESS : IExecutableCheck<PortableExecutable>
1010
/// <inheritdoc/>
1111
public string? CheckExecutable(string file, PortableExecutable exe, bool includeDebug)
1212
{
13-
bool mpress1 = exe.ContainsSection(".MPRESS1");
14-
bool mpress2 = exe.ContainsSection(".MPRESS2 ");
15-
1613
// TODO: Confirm if both need to be present
17-
if (mpress1 || mpress2)
18-
return "MPRESS"; // TODO: Figure out how to get version
14+
// TODO: Figure out how to get version
15+
16+
if (exe.ContainsSection(".MPRESS1"))
17+
return "MPRESS";
18+
if (exe.ContainsSection(".MPRESS2"))
19+
return "MPRESS";
1920

2021
return null;
2122
}

BinaryObjectScanner/Packer/PKLite.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class PKLite : IExecutableCheck<PortableExecutable>
1212
public string? CheckExecutable(string file, PortableExecutable exe, bool includeDebug)
1313
{
1414
// <see href="https://www.virustotal.com/gui/file/601573f263115035921f621598f7a81ace998bf325e081165aa698b981822013/details"/>
15-
if (exe.ContainsSection(".pklstb"))
15+
if (exe.ContainsSection(".pklstb", exact: true))
1616
return "PKLITE32"; // TODO: Figure out how to determine version
1717

1818
return null;

BinaryObjectScanner/Packer/Shrinker.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ public class Shrinker : IExecutableCheck<PortableExecutable>
1010
/// <inheritdoc/>
1111
public string? CheckExecutable(string file, PortableExecutable exe, bool includeDebug)
1212
{
13-
bool shrink0 = exe.ContainsSection(".shrink0", exact: true);
14-
bool shrink2 = exe.ContainsSection(".shrink2", exact: true);
13+
// TODO: Confirm if both need to be present
14+
// TODO: Figure out how to get version
1515

16-
// TODO: Confirm if both need to be present
17-
if (shrink0 || shrink2)
18-
return "Shrinker"; // TODO: Figure out how to get version
16+
if (exe.ContainsSection(".shrink0", exact: true))
17+
return "Shrinker";
18+
if (exe.ContainsSection(".shrink2", exact: true))
19+
return "Shrinker";
1920

2021
return null;
2122
}

BinaryObjectScanner/Protection/NEACProtect.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ public class NEACProtect : IExecutableCheck<PortableExecutable>, IPathCheck
2828

2929
// Get the .neac0 and .neac1 sections, if they exist.
3030
// Found in "NeacSafe64.sys" and "NeacSafe.sys".
31-
if (exe.ContainsSection(".neac0", exact: true) || exe.ContainsSection(".neac1", exact: true))
31+
if (exe.ContainsSection(".neac0", exact: true))
32+
return "NEAC Protect";
33+
if (exe.ContainsSection(".neac1", exact: true))
3234
return "NEAC Protect";
3335

3436
string? name = exe.ProductName;

BinaryObjectScanner/Protection/SecuROM.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,9 @@ public class SecuROM : IExecutableCheck<PortableExecutable>, IPathCheck
187187
}
188188

189189
// Get the .cms_d and .cms_t sections, if they exist -- TODO: Confirm if both are needed or either/or is fine
190-
if (exe.ContainsSection(".cmd_d", true) || exe.ContainsSection(".cms_t", true))
190+
if (exe.ContainsSection(".cmd_d", true))
191+
return $"SecuROM 1-3";
192+
if (exe.ContainsSection(".cms_t", true))
191193
return $"SecuROM 1-3";
192194

193195
return null;

0 commit comments

Comments
 (0)