mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-09-22 23:05:03 +00:00
Use SourceArray for PE checks
This commit is contained in:
@@ -528,6 +528,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft.PE
|
||||
/// <summary>
|
||||
/// Get the raw bytes from a section, if possible
|
||||
/// </summary>
|
||||
/// <remarks>TODO: These can be combined and use SourceArray and SourceStream instead</remarks>
|
||||
public byte[] ReadRawSection(Stream stream, string sectionName, bool force = false, bool first = true, int offset = 0)
|
||||
{
|
||||
// Special cases for non-forced, non-offset data
|
||||
@@ -569,6 +570,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft.PE
|
||||
/// <summary>
|
||||
/// Get the raw bytes from a section, if possible
|
||||
/// </summary>
|
||||
/// <remarks>TODO: These can be combined and use SourceArray and SourceStream instead</remarks>
|
||||
public byte[] ReadRawSection(byte[] content, string sectionName, bool force = false, bool first = true, int offset = 0)
|
||||
{
|
||||
// Special cases for non-forced, non-offset data
|
||||
|
||||
@@ -173,7 +173,7 @@ namespace BurnOutSharp.FileType
|
||||
bool foundProtection = false;
|
||||
|
||||
// Check using custom content checks first
|
||||
string protection = contentCheckClass.CheckPEContents(file, fileContent, scanner.IncludeDebug, pex);
|
||||
string protection = contentCheckClass.CheckPEContents(file, scanner.IncludeDebug, pex);
|
||||
foundProtection |= !string.IsNullOrWhiteSpace(protection);
|
||||
if (ShouldAddProtection(contentCheckClass, scanner, protection))
|
||||
Utilities.AppendToDictionary(protections, file, protection);
|
||||
|
||||
@@ -9,10 +9,9 @@ namespace BurnOutSharp
|
||||
/// Check a path for protections based on file contents
|
||||
/// </summary>
|
||||
/// <param name="file">File to check for protection indicators</param>
|
||||
/// <param name="fileContent">Byte array representing the file contents</param>
|
||||
/// <param name="includeDebug">True to include debug data, false otherwise</param>
|
||||
/// <param name="pex">PortableExecutable representing the read-in file</param>
|
||||
/// <returns>String containing any protections found in the file</returns>
|
||||
string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex);
|
||||
string CheckPEContents(string file, bool includeDebug, PortableExecutable pex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace BurnOutSharp.PackerType
|
||||
public class AdvancedInstaller : IPEContentCheck
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// Get the sections from the executable, if possible
|
||||
var sections = pex?.SectionTable;
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace BurnOutSharp.PackerType
|
||||
public class Armadillo : IPEContentCheck
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// Get the sections from the executable, if possible
|
||||
var sections = pex?.SectionTable;
|
||||
@@ -26,7 +26,7 @@ namespace BurnOutSharp.PackerType
|
||||
foreach (var section in sections.Where(s => s != null && Encoding.ASCII.GetString(s.Name).Trim('\0').EndsWith("1")))
|
||||
{
|
||||
string sectionName = Encoding.ASCII.GetString(section.Name).Trim('\0');
|
||||
var sectionRaw = pex.ReadRawSection(fileContent, sectionName);
|
||||
var sectionRaw = pex.ReadRawSection(pex.SourceArray, sectionName);
|
||||
var matchers = new List<ContentMatchSet>
|
||||
{
|
||||
// ARMDEBUG
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace BurnOutSharp.PackerType
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// Get the sections from the executable, if possible
|
||||
var sections = pex?.SectionTable;
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace BurnOutSharp.PackerType
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// Get the sections from the executable, if possible
|
||||
var sections = pex?.SectionTable;
|
||||
@@ -71,7 +71,7 @@ namespace BurnOutSharp.PackerType
|
||||
// Check for "Inno" in the reserved words
|
||||
if (stub.Reserved2[4] == 0x6E49 && stub.Reserved2[5] == 0x6F6E)
|
||||
{
|
||||
string version = GetOldVersion(file, fileContent);
|
||||
string version = GetOldVersion(file, pex.SourceArray);
|
||||
if (!string.IsNullOrWhiteSpace(version))
|
||||
return $"Inno Setup {version}";
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace BurnOutSharp.PackerType
|
||||
public bool ShouldScan(byte[] magic) => true;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// Get the sections from the executable, if possible
|
||||
var sections = pex?.SectionTable;
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace BurnOutSharp.PackerType
|
||||
|
||||
//TODO: Add exact version detection for Windows builds, make sure versions before 3.X are detected as well, and detect the Mac builds.
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// Get the sections from the executable, if possible
|
||||
var sections = pex?.SectionTable;
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace BurnOutSharp.PackerType
|
||||
public class IntelInstallationFramework : IPEContentCheck
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// Get the sections from the executable, if possible
|
||||
var sections = pex?.SectionTable;
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace BurnOutSharp.PackerType
|
||||
public bool ShouldScan(byte[] magic) => true;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// Get the sections from the executable, if possible
|
||||
var sections = pex?.SectionTable;
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace BurnOutSharp.PackerType
|
||||
public class NSIS : IPEContentCheck
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// Get the sections from the executable, if possible
|
||||
var sections = pex?.SectionTable;
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace BurnOutSharp.PackerType
|
||||
public class PECompact : IPEContentCheck
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// Get the sections from the executable, if possible
|
||||
var sections = pex?.SectionTable;
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace BurnOutSharp.PackerType
|
||||
public class PEtite : IPEContentCheck
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// Get the sections from the executable, if possible
|
||||
var sections = pex?.SectionTable;
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace BurnOutSharp.PackerType
|
||||
public bool ShouldScan(byte[] magic) => true;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// Get the sections from the executable, if possible
|
||||
var sections = pex?.SectionTable;
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace BurnOutSharp.PackerType
|
||||
public class UPX : IPEContentCheck
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// Get the sections from the executable, if possible
|
||||
var sections = pex?.SectionTable;
|
||||
@@ -28,7 +28,7 @@ namespace BurnOutSharp.PackerType
|
||||
"UPX"),
|
||||
};
|
||||
|
||||
return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
|
||||
return MatchUtil.GetFirstMatch(file, pex.SourceArray, matchers, includeDebug);
|
||||
}
|
||||
|
||||
// NOS Variant
|
||||
@@ -44,7 +44,7 @@ namespace BurnOutSharp.PackerType
|
||||
"UPX (NOS Variant)"),
|
||||
};
|
||||
|
||||
return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
|
||||
return MatchUtil.GetFirstMatch(file, pex.SourceArray, matchers, includeDebug);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace BurnOutSharp.PackerType
|
||||
public bool ShouldScan(byte[] magic) => true;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// Get the sections from the executable, if possible
|
||||
var sections = pex?.SectionTable;
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace BurnOutSharp.PackerType
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// Get the sections from the executable, if possible
|
||||
var sections = pex?.SectionTable;
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace BurnOutSharp.PackerType
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// Get the sections from the executable, if possible
|
||||
var sections = pex?.SectionTable;
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace BurnOutSharp.PackerType
|
||||
public class dotFuscator : IPEContentCheck
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// Get the sections from the executable, if possible
|
||||
var sections = pex?.SectionTable;
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// Get the sections from the executable, if possible
|
||||
var sections = pex?.SectionTable;
|
||||
@@ -40,7 +40,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
return null;
|
||||
|
||||
// Get the last .bss section, if it exists
|
||||
var bssSectionRaw = pex.ReadRawSection(fileContent, ".bss", first: false);
|
||||
var bssSectionRaw = pex.ReadRawSection(pex.SourceArray, ".bss", first: false);
|
||||
if (bssSectionRaw != null)
|
||||
{
|
||||
var matchers = new List<ContentMatchSet>
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
public class AlphaROM : IPEContentCheck
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// Get the sections from the executable, if possible
|
||||
var sections = pex?.SectionTable;
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
public class CDCheck : IPEContentCheck
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// Get the sections from the executable, if possible
|
||||
var sections = pex?.SectionTable;
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// Get the sections from the executable, if possible
|
||||
var sections = pex?.SectionTable;
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
public class CDKey : IPEContentCheck
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// Get the sections from the executable, if possible
|
||||
var sections = pex?.SectionTable;
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
public class CDLock : IPEContentCheck, IPathCheck
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// Get the sections from the executable, if possible
|
||||
var sections = pex?.SectionTable;
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
public class CDSHiELDSE : IPEContentCheck
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// Get the sections from the executable, if possible
|
||||
var sections = pex?.SectionTable;
|
||||
@@ -15,7 +15,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
return null;
|
||||
|
||||
// Get the code/CODE section, if it exists
|
||||
var codeSectionRaw = pex.ReadRawSection(fileContent, "code", first: true) ?? pex.ReadRawSection(fileContent, "CODE", first: true);
|
||||
var codeSectionRaw = pex.ReadRawSection(pex.SourceArray, "code", first: true) ?? pex.ReadRawSection(pex.SourceArray, "CODE", first: true);
|
||||
if (codeSectionRaw != null)
|
||||
{
|
||||
var matchers = new List<ContentMatchSet>
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// Get the sections from the executable, if possible
|
||||
var sections = pex?.SectionTable;
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
public class CengaProtectDVD : IPEContentCheck
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// Get the sections from the executable, if possible
|
||||
var sections = pex?.SectionTable;
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// Get the sections from the executable, if possible
|
||||
var sections = pex?.SectionTable;
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
public class ElectronicArts : IPEContentCheck
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// Get the sections from the executable, if possible
|
||||
var sections = pex?.SectionTable;
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
public class GFWL : IPEContentCheck, IPathCheck
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// Get the sections from the executable, if possible
|
||||
var sections = pex?.SectionTable;
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
public class ImpulseReactor : IPEContentCheck, IPathCheck
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// Get the sections from the executable, if possible
|
||||
var sections = pex?.SectionTable;
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
*/
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// Get the sections from the executable, if possible
|
||||
var sections = pex?.SectionTable;
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
public class JoWood : IPEContentCheck
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// Get the sections from the executable, if possible
|
||||
var sections = pex?.SectionTable;
|
||||
@@ -24,7 +24,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
if (extSection)
|
||||
{
|
||||
// Get the .dcrtext section, if it exists
|
||||
var dcrtextSectionRaw = pex.ReadRawSection(fileContent, ".dcrtext");
|
||||
var dcrtextSectionRaw = pex.ReadRawSection(pex.SourceArray, ".dcrtext");
|
||||
if (dcrtextSectionRaw != null)
|
||||
{
|
||||
var matchers = new List<ContentMatchSet>
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
public class Key2AudioXS : IPEContentCheck
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// Get the sections from the executable, if possible
|
||||
var sections = pex?.SectionTable;
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
public class LaserLok : IPEContentCheck, IPathCheck
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// TODO: Additional checks that may or may not be useful with the below
|
||||
//
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
public class MediaMaxCD3 : IPEContentCheck, IPathCheck
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// Get the sections from the executable, if possible
|
||||
var sections = pex?.SectionTable;
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
public class OnlineRegistration : IPEContentCheck
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// Get the sections from the executable, if possible
|
||||
var sections = pex?.SectionTable;
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
public class Origin : IPEContentCheck, IPathCheck
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// Get the sections from the executable, if possible
|
||||
var sections = pex?.SectionTable;
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
public class ProtectDISC : IPEContentCheck
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// Get the sections from the executable, if possible
|
||||
var sections = pex?.SectionTable;
|
||||
@@ -31,7 +31,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
GetVersion6till8, "ProtectDISC"),
|
||||
};
|
||||
|
||||
string match = MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
|
||||
string match = MatchUtil.GetFirstMatch(file, pex.SourceArray, matchers, includeDebug);
|
||||
if (!string.IsNullOrWhiteSpace(match))
|
||||
return match;
|
||||
}
|
||||
@@ -68,7 +68,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
GetOldVersion, "VOB ProtectCD/DVD"),
|
||||
};
|
||||
|
||||
string match = MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
|
||||
string match = MatchUtil.GetFirstMatch(file, pex.SourceArray, matchers, includeDebug);
|
||||
if (!string.IsNullOrWhiteSpace(match))
|
||||
return match;
|
||||
}
|
||||
@@ -92,7 +92,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
GetVersion3till6, "VOB ProtectCD/DVD"),
|
||||
};
|
||||
|
||||
string match = MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
|
||||
string match = MatchUtil.GetFirstMatch(file, pex.SourceArray, matchers, includeDebug);
|
||||
if (!string.IsNullOrWhiteSpace(match))
|
||||
return match;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
};
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// Get the sections from the executable, if possible
|
||||
var sections = pex?.SectionTable;
|
||||
@@ -59,22 +59,22 @@ namespace BurnOutSharp.ProtectionType
|
||||
return $"SafeCast";
|
||||
|
||||
// Get the .text section, if it exists
|
||||
string match = CheckSectionForProtection(file, fileContent, includeDebug, pex, ".text");
|
||||
string match = CheckSectionForProtection(file, pex.SourceArray, includeDebug, pex, ".text");
|
||||
if (!string.IsNullOrWhiteSpace(match))
|
||||
return match;
|
||||
|
||||
// Get the .txt2 section, if it exists
|
||||
match = CheckSectionForProtection(file, fileContent, includeDebug, pex, ".txt2");
|
||||
match = CheckSectionForProtection(file, pex.SourceArray, includeDebug, pex, ".txt2");
|
||||
if (!string.IsNullOrWhiteSpace(match))
|
||||
return match;
|
||||
|
||||
// Get the CODE section, if it exists
|
||||
match = CheckSectionForProtection(file, fileContent, includeDebug, pex, "CODE");
|
||||
match = CheckSectionForProtection(file, pex.SourceArray, includeDebug, pex, "CODE");
|
||||
if (!string.IsNullOrWhiteSpace(match))
|
||||
return match;
|
||||
|
||||
// Get the .data section, if it exists
|
||||
match = CheckSectionForProtection(file, fileContent, includeDebug, pex, ".data");
|
||||
match = CheckSectionForProtection(file, pex.SourceArray, includeDebug, pex, ".data");
|
||||
if (!string.IsNullOrWhiteSpace(match))
|
||||
return match;
|
||||
|
||||
@@ -82,7 +82,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
bool stxt371Section = pex.ContainsSection("stxt371", exact: true);
|
||||
bool stxt774Section = pex.ContainsSection("stxt774", exact: true);
|
||||
if (stxt371Section || stxt774Section)
|
||||
return $"SafeDisc {Get320to4xVersion(file, fileContent, null)}";
|
||||
return $"SafeDisc {Get320to4xVersion(file, pex.SourceArray, null)}";
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
public class SecuROM : IPEContentCheck, IPathCheck
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// Get the sections from the executable, if possible
|
||||
var sections = pex?.SectionTable;
|
||||
@@ -25,7 +25,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
// Get the .securom section, if it exists
|
||||
bool securomSection = pex.ContainsSection(".securom", exact: true);
|
||||
if (securomSection)
|
||||
return $"SecuROM {GetV7Version(fileContent)}";
|
||||
return $"SecuROM {GetV7Version(pex.SourceArray)}";
|
||||
|
||||
// Search after the last section
|
||||
var lastSection = sections.LastOrDefault();
|
||||
@@ -41,7 +41,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
GetV4Version, "SecuROM"),
|
||||
};
|
||||
|
||||
string match = MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
|
||||
string match = MatchUtil.GetFirstMatch(file, pex.SourceArray, matchers, includeDebug);
|
||||
if (!string.IsNullOrWhiteSpace(match))
|
||||
return match;
|
||||
}
|
||||
@@ -63,7 +63,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
GetV5Version, "SecuROM"),
|
||||
};
|
||||
|
||||
string match = MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
|
||||
string match = MatchUtil.GetFirstMatch(file, pex.SourceArray, matchers, includeDebug);
|
||||
if (!string.IsNullOrWhiteSpace(match))
|
||||
return match;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
public class SmartE : IPEContentCheck, IPathCheck
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// Get the sections from the executable, if possible
|
||||
var sections = pex?.SectionTable;
|
||||
@@ -33,7 +33,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
return match;
|
||||
|
||||
// Get the .tls section, if it exists
|
||||
var tlsSectionRaw = pex.ReadRawSection(fileContent, ".tls", first: false);
|
||||
var tlsSectionRaw = pex.ReadRawSection(pex.SourceArray, ".tls", first: false);
|
||||
match = GetMatchForSection(file, tlsSectionRaw, includeDebug);
|
||||
if (!string.IsNullOrWhiteSpace(match))
|
||||
return match;
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
public class SolidShield : IPEContentCheck, IPathCheck
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// Get the sections from the executable, if possible
|
||||
var sections = pex?.SectionTable;
|
||||
@@ -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(fileContent, ".init", first: true);
|
||||
var initSectionRaw = pex.ReadRawSection(pex.SourceArray, ".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(fileContent, sectionNames[i], first: false);
|
||||
var nthSectionRaw = pex.ReadRawSection(pex.SourceArray, sectionNames[i], first: false);
|
||||
if (nthSectionRaw != null)
|
||||
{
|
||||
var matchers = new List<ContentMatchSet>
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
public class StarForce : IPEContentCheck, IPathCheck
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// Get the sections from the executable, if possible
|
||||
var sections = pex?.SectionTable;
|
||||
@@ -53,7 +53,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
"StarForce 5 [Protected Module]"),
|
||||
};
|
||||
|
||||
string match = MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug);
|
||||
string match = MatchUtil.GetFirstMatch(file, pex.SourceArray, matchers, includeDebug);
|
||||
if (!string.IsNullOrWhiteSpace(match))
|
||||
return match;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
public class Steam : IPEContentCheck, IPathCheck
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// Get the sections from the executable, if possible
|
||||
var sections = pex?.SectionTable;
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
public class Sysiphus : IPEContentCheck
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// Get the sections from the executable, if possible
|
||||
var sections = pex?.SectionTable;
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// Get the sections from the executable, if possible
|
||||
var sections = pex?.SectionTable;
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
public class ThreePLock : IPEContentCheck
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// Get the sections from the executable, if possible
|
||||
var sections = pex?.SectionTable;
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
public class ThreeTwoOneStudios : IPEContentCheck
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// Get the sections from the executable, if possible
|
||||
var sections = pex?.SectionTable;
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
public class Uplay : IPEContentCheck, IPathCheck
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// Get the sections from the executable, if possible
|
||||
var sections = pex?.SectionTable;
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
public class WTMCDProtect : IPEContentCheck, IPathCheck
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// Get the sections from the executable, if possible
|
||||
var sections = pex?.SectionTable;
|
||||
@@ -25,7 +25,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
return "WTM Protection Viewer";
|
||||
|
||||
// Get the CODE section, if it exists
|
||||
var codeSectionRaw = pex.ReadRawSection(fileContent, "CODE", first: true);
|
||||
var codeSectionRaw = pex.ReadRawSection(pex.SourceArray, "CODE", first: true);
|
||||
if (codeSectionRaw != null)
|
||||
{
|
||||
var matchers = new List<ContentMatchSet>
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace BurnOutSharp.ProtectionType
|
||||
public class XCP : IPEContentCheck, IPathCheck
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public string CheckPEContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex)
|
||||
public string CheckPEContents(string file, bool includeDebug, PortableExecutable pex)
|
||||
{
|
||||
// Get the sections from the executable, if possible
|
||||
var sections = pex?.SectionTable;
|
||||
|
||||
Reference in New Issue
Block a user