From 3ab0bcc0ae7c2c888121677090ddd5c9536cb204 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Wed, 25 Aug 2021 19:37:32 -0700 Subject: [PATCH] ContentMatchSets are now expected in IContentCheck --- BurnOutSharp/FileType/Executable.cs | 2 + BurnOutSharp/IContentCheck.cs | 11 +++- BurnOutSharp/Matching/ContentMatch.cs | 2 +- BurnOutSharp/Matching/ContentMatchSet.cs | 2 +- BurnOutSharp/Matching/IMatch.cs | 2 +- BurnOutSharp/Matching/MatchSet.cs | 2 +- BurnOutSharp/PackerType/AdvancedInstaller.cs | 9 +++- BurnOutSharp/PackerType/Armadillo.cs | 9 +++- BurnOutSharp/PackerType/CExe.cs | 11 ++-- BurnOutSharp/PackerType/EXEStealth.cs | 9 +++- BurnOutSharp/PackerType/InnoSetup.cs | 9 +++- BurnOutSharp/PackerType/InstallerVISE.cs | 12 +++-- .../PackerType/IntelInstallationFramework.cs | 45 +++++++++------- BurnOutSharp/PackerType/MicrosoftCABSFX.cs | 53 ++++++++++--------- BurnOutSharp/PackerType/NSIS.cs | 9 +++- BurnOutSharp/PackerType/PECompact.cs | 9 +++- BurnOutSharp/PackerType/SetupFactory.cs | 10 +++- BurnOutSharp/PackerType/UPX.cs | 9 +++- BurnOutSharp/PackerType/WinRARSFX.cs | 9 +++- BurnOutSharp/PackerType/WinZipSFX.cs | 9 +++- BurnOutSharp/PackerType/WiseInstaller.cs | 9 +++- BurnOutSharp/PackerType/dotFuscator.cs | 9 +++- BurnOutSharp/ProtectionType/ActiveMARK.cs | 9 +++- BurnOutSharp/ProtectionType/AlphaROM.cs | 9 +++- BurnOutSharp/ProtectionType/Bitpool.cs | 9 +++- BurnOutSharp/ProtectionType/CDCheck.cs | 9 +++- BurnOutSharp/ProtectionType/CDCops.cs | 9 +++- BurnOutSharp/ProtectionType/CDKey.cs | 9 +++- BurnOutSharp/ProtectionType/CDLock.cs | 9 +++- BurnOutSharp/ProtectionType/CDSHiELDSE.cs | 9 +++- .../ProtectionType/CactusDataShield.cs | 9 +++- .../ProtectionType/CengaProtectDVD.cs | 9 +++- BurnOutSharp/ProtectionType/CodeLock.cs | 9 +++- BurnOutSharp/ProtectionType/CopyKiller.cs | 9 +++- BurnOutSharp/ProtectionType/DVDCops.cs | 9 +++- BurnOutSharp/ProtectionType/ElectronicArts.cs | 9 +++- BurnOutSharp/ProtectionType/GFWL.cs | 9 +++- BurnOutSharp/ProtectionType/ImpulseReactor.cs | 9 +++- BurnOutSharp/ProtectionType/Intenium.cs | 9 +++- BurnOutSharp/ProtectionType/JoWooDXProt.cs | 9 +++- BurnOutSharp/ProtectionType/KeyLock.cs | 9 +++- BurnOutSharp/ProtectionType/LaserLock.cs | 45 +++++++++------- BurnOutSharp/ProtectionType/MediaMaxCD3.cs | 9 +++- .../ProtectionType/OnlineRegistration.cs | 9 +++- BurnOutSharp/ProtectionType/Origin.cs | 9 +++- BurnOutSharp/ProtectionType/PSXAntiModchip.cs | 13 +++-- BurnOutSharp/ProtectionType/ProtectDisc.cs | 9 +++- BurnOutSharp/ProtectionType/RingPROTECH.cs | 9 +++- BurnOutSharp/ProtectionType/SVKProtector.cs | 9 +++- BurnOutSharp/ProtectionType/SafeDisc.cs | 9 +++- BurnOutSharp/ProtectionType/SafeLock.cs | 9 +++- BurnOutSharp/ProtectionType/SecuROM.cs | 9 +++- BurnOutSharp/ProtectionType/SmartE.cs | 9 +++- BurnOutSharp/ProtectionType/SolidShield.cs | 9 +++- BurnOutSharp/ProtectionType/StarForce.cs | 9 +++- BurnOutSharp/ProtectionType/Sysiphus.cs | 9 +++- BurnOutSharp/ProtectionType/Tages.cs | 9 +++- BurnOutSharp/ProtectionType/ThreePLock.cs | 9 +++- .../ProtectionType/ThreeTwoOneStudios.cs | 9 +++- .../ProtectionType/VOBProtectCDDVD.cs | 9 +++- BurnOutSharp/ProtectionType/WTMCDProtect.cs | 9 +++- BurnOutSharp/ProtectionType/XCP.cs | 9 +++- .../ProtectionType/XtremeProtector.cs | 9 +++- 63 files changed, 478 insertions(+), 182 deletions(-) diff --git a/BurnOutSharp/FileType/Executable.cs b/BurnOutSharp/FileType/Executable.cs index 31fa58f5..cac47442 100644 --- a/BurnOutSharp/FileType/Executable.cs +++ b/BurnOutSharp/FileType/Executable.cs @@ -91,6 +91,8 @@ namespace BurnOutSharp.FileType // Iterate through all content checks Parallel.ForEach(contentCheckClasses, contentCheckClass => { + // TODO: Find a way to combine the outputs of GetContentMatchSet + // TODO: Have CheckContents take priority over GetContentMatchSet results string protection = contentCheckClass.CheckContents(file, fileContent, scanner.IncludeDebug); // If we have a valid content check based on settings diff --git a/BurnOutSharp/IContentCheck.cs b/BurnOutSharp/IContentCheck.cs index c7c66897..434b7cab 100644 --- a/BurnOutSharp/IContentCheck.cs +++ b/BurnOutSharp/IContentCheck.cs @@ -1,9 +1,18 @@ -namespace BurnOutSharp +using System.Collections.Generic; +using BurnOutSharp.Matching; + +namespace BurnOutSharp { // TODO: This should either include an override that takes a Stream instead of the byte[] // OR have a completely separate check for when it's an executable specifically internal interface IContentCheck { + /// + /// Get a list of content match sets that represent a protection + /// + /// List of content match sets, null if not applicable + List GetContentMatchSets(); + /// /// Check a path for protections based on file contents /// diff --git a/BurnOutSharp/Matching/ContentMatch.cs b/BurnOutSharp/Matching/ContentMatch.cs index 0abce19c..71a697a7 100644 --- a/BurnOutSharp/Matching/ContentMatch.cs +++ b/BurnOutSharp/Matching/ContentMatch.cs @@ -3,7 +3,7 @@ namespace BurnOutSharp.Matching /// /// Content matching criteria /// - internal class ContentMatch : IMatch + public class ContentMatch : IMatch { /// /// Content to match diff --git a/BurnOutSharp/Matching/ContentMatchSet.cs b/BurnOutSharp/Matching/ContentMatchSet.cs index 2735e56b..8930852c 100644 --- a/BurnOutSharp/Matching/ContentMatchSet.cs +++ b/BurnOutSharp/Matching/ContentMatchSet.cs @@ -7,7 +7,7 @@ namespace BurnOutSharp.Matching /// /// A set of content matches that work together /// - internal class ContentMatchSet : MatchSet + public class ContentMatchSet : MatchSet { /// /// Function to get a content version diff --git a/BurnOutSharp/Matching/IMatch.cs b/BurnOutSharp/Matching/IMatch.cs index d56f6244..6bc0a20a 100644 --- a/BurnOutSharp/Matching/IMatch.cs +++ b/BurnOutSharp/Matching/IMatch.cs @@ -1,6 +1,6 @@ namespace BurnOutSharp.Matching { - internal interface IMatch + public interface IMatch { T Needle { get; set; } } diff --git a/BurnOutSharp/Matching/MatchSet.cs b/BurnOutSharp/Matching/MatchSet.cs index 6ac05f86..d6eb8410 100644 --- a/BurnOutSharp/Matching/MatchSet.cs +++ b/BurnOutSharp/Matching/MatchSet.cs @@ -5,7 +5,7 @@ namespace BurnOutSharp.Matching /// /// Wrapper for a single set of matching criteria /// - internal abstract class MatchSet where T : IMatch + public abstract class MatchSet where T : IMatch { /// /// Set of all matchers diff --git a/BurnOutSharp/PackerType/AdvancedInstaller.cs b/BurnOutSharp/PackerType/AdvancedInstaller.cs index c15b3bf2..304888b3 100644 --- a/BurnOutSharp/PackerType/AdvancedInstaller.cs +++ b/BurnOutSharp/PackerType/AdvancedInstaller.cs @@ -7,9 +7,9 @@ namespace BurnOutSharp.PackerType public class AdvancedInstaller : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { // Software\Caphyon\Advanced Installer new ContentMatchSet(new byte?[] @@ -21,7 +21,12 @@ namespace BurnOutSharp.PackerType 0x6C, 0x65, 0x72 }, "Caphyon Advanced Installer"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } } diff --git a/BurnOutSharp/PackerType/Armadillo.cs b/BurnOutSharp/PackerType/Armadillo.cs index 6832c7a1..f4bc005c 100644 --- a/BurnOutSharp/PackerType/Armadillo.cs +++ b/BurnOutSharp/PackerType/Armadillo.cs @@ -6,9 +6,9 @@ namespace BurnOutSharp.PackerType public class Armadillo : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { // .nicode + (char)0x00 new ContentMatchSet(new byte?[] { 0x2E, 0x6E, 0x69, 0x63, 0x6F, 0x64, 0x65, 0x00 }, "Armadillo"), @@ -16,7 +16,12 @@ namespace BurnOutSharp.PackerType // ARMDEBUG new ContentMatchSet(new byte?[] { 0x41, 0x52, 0x4D, 0x44, 0x45, 0x42, 0x55, 0x47 }, "Armadillo"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } } diff --git a/BurnOutSharp/PackerType/CExe.cs b/BurnOutSharp/PackerType/CExe.cs index ebc89424..d63632bc 100644 --- a/BurnOutSharp/PackerType/CExe.cs +++ b/BurnOutSharp/PackerType/CExe.cs @@ -11,11 +11,11 @@ namespace BurnOutSharp.PackerType { /// public bool ShouldScan(byte[] magic) => true; - + /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { // %Wo�a6.�a6.�a6.�a6.�{6.�.).�f6.��).�`6.��0.�`6.� new ContentMatchSet( @@ -29,7 +29,12 @@ namespace BurnOutSharp.PackerType 0xD9, 0x30, 0x07, 0x92, 0x60, 0x36, 0x01, 0x92 }, end: 200), "CExe"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } diff --git a/BurnOutSharp/PackerType/EXEStealth.cs b/BurnOutSharp/PackerType/EXEStealth.cs index 4fb0b79a..21a6fc13 100644 --- a/BurnOutSharp/PackerType/EXEStealth.cs +++ b/BurnOutSharp/PackerType/EXEStealth.cs @@ -6,9 +6,9 @@ namespace BurnOutSharp.PackerType public class EXEStealth : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { // ??[[__[[_ + (char)0x00 + {{ + (char)0x0 + (char)0x00 + {{ + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x0 + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00 + ?;??;?? new ContentMatchSet(new byte?[] @@ -20,7 +20,12 @@ namespace BurnOutSharp.PackerType 0x3F }, "EXE Stealth"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } } diff --git a/BurnOutSharp/PackerType/InnoSetup.cs b/BurnOutSharp/PackerType/InnoSetup.cs index c749c3f5..82a973d0 100644 --- a/BurnOutSharp/PackerType/InnoSetup.cs +++ b/BurnOutSharp/PackerType/InnoSetup.cs @@ -14,9 +14,9 @@ namespace BurnOutSharp.PackerType public bool ShouldScan(byte[] magic) => true; /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { // Inno Setup Setup Data ( new ContentMatchSet(new byte?[] @@ -32,7 +32,12 @@ namespace BurnOutSharp.PackerType GetOldVersion, "Inno Setup"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } diff --git a/BurnOutSharp/PackerType/InstallerVISE.cs b/BurnOutSharp/PackerType/InstallerVISE.cs index a2ad8743..fabf906e 100644 --- a/BurnOutSharp/PackerType/InstallerVISE.cs +++ b/BurnOutSharp/PackerType/InstallerVISE.cs @@ -11,18 +11,22 @@ namespace BurnOutSharp.PackerType public bool ShouldScan(byte[] magic) => true; /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { - //TODO: Add exact version detection for Windows builds, make sure versions before 3.X are detected as well, and detect the Mac builds. - // ViseMain new ContentMatchSet( new ContentMatch(new byte?[] { 0x56, 0x69, 0x73, 0x65, 0x4D, 0x61, 0x69, 0x6E }, start: 0xE0A4, end: 0xE0A5), "Installer VISE"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + //TODO: Add exact version detection for Windows builds, make sure versions before 3.X are detected as well, and detect the Mac builds. + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } diff --git a/BurnOutSharp/PackerType/IntelInstallationFramework.cs b/BurnOutSharp/PackerType/IntelInstallationFramework.cs index c791062d..3045c8ce 100644 --- a/BurnOutSharp/PackerType/IntelInstallationFramework.cs +++ b/BurnOutSharp/PackerType/IntelInstallationFramework.cs @@ -9,27 +9,9 @@ namespace BurnOutSharp.PackerType public class IntelInstallationFramework : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var fvinfo = Utilities.GetFileVersionInfo(file); - - string name = fvinfo?.FileDescription?.Trim(); - if (!string.IsNullOrWhiteSpace(name) - && (name.Equals("Intel(R) Installation Framework", StringComparison.OrdinalIgnoreCase) - || name.Equals("Intel Installation Framework", StringComparison.OrdinalIgnoreCase))) - { - return $"Intel Installation Framework {Utilities.GetFileVersion(file)}"; - } - - name = fvinfo?.ProductName?.Trim(); - if (!string.IsNullOrWhiteSpace(name) - && (name.Equals("Intel(R) Installation Framework", StringComparison.OrdinalIgnoreCase) - || name.Equals("Intel Installation Framework", StringComparison.OrdinalIgnoreCase))) - { - return $"Intel Installation Framework {Utilities.GetFileVersion(file)}"; - } - - var matchers = new List + return new List { // I + (char)0x00 + n + (char)0x00 + t + (char)0x00 + e + (char)0x00 + l + (char)0x00 + ( + (char)0x00 + R + (char)0x00 + ) + (char)0x00 + + (char)0x00 + I + (char)0x00 + n + (char)0x00 + s + (char)0x00 + t + (char)0x00 + a + (char)0x00 + l + (char)0x00 + l + (char)0x00 + a + (char)0x00 + t + (char)0x00 + i + (char)0x00 + o + (char)0x00 + n + (char)0x00 + + (char)0x00 + F + (char)0x00 + r + (char)0x00 + a + (char)0x00 + m + (char)0x00 + e + (char)0x00 + w + (char)0x00 + o + (char)0x00 + r + (char)0x00 + k + (char)0x00 new ContentMatchSet(new byte?[] @@ -56,7 +38,30 @@ namespace BurnOutSharp.PackerType 0x77, 0x00, 0x6F, 0x00, 0x72, 0x00, 0x6B, 0x00, }, Utilities.GetFileVersion, "Intel Installation Framework"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var fvinfo = Utilities.GetFileVersionInfo(file); + + string name = fvinfo?.FileDescription?.Trim(); + if (!string.IsNullOrWhiteSpace(name) + && (name.Equals("Intel(R) Installation Framework", StringComparison.OrdinalIgnoreCase) + || name.Equals("Intel Installation Framework", StringComparison.OrdinalIgnoreCase))) + { + return $"Intel Installation Framework {Utilities.GetFileVersion(file)}"; + } + + name = fvinfo?.ProductName?.Trim(); + if (!string.IsNullOrWhiteSpace(name) + && (name.Equals("Intel(R) Installation Framework", StringComparison.OrdinalIgnoreCase) + || name.Equals("Intel Installation Framework", StringComparison.OrdinalIgnoreCase))) + { + return $"Intel Installation Framework {Utilities.GetFileVersion(file)}"; + } + + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } } diff --git a/BurnOutSharp/PackerType/MicrosoftCABSFX.cs b/BurnOutSharp/PackerType/MicrosoftCABSFX.cs index 353ab9e5..a6b301c4 100644 --- a/BurnOutSharp/PackerType/MicrosoftCABSFX.cs +++ b/BurnOutSharp/PackerType/MicrosoftCABSFX.cs @@ -14,31 +14,9 @@ namespace BurnOutSharp.PackerType public bool ShouldScan(byte[] magic) => true; /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var fvinfo = Utilities.GetFileVersionInfo(file); - - string name = fvinfo?.InternalName?.Trim(); - if (!string.IsNullOrWhiteSpace(name) && name.Equals("Wextract", StringComparison.OrdinalIgnoreCase)) - { - string version = GetVersion(file, fileContent, null); - if (!string.IsNullOrWhiteSpace(version)) - return $"Microsoft CAB SFX v{Utilities.GetFileVersion(file)}"; - - return "Microsoft CAB SFX"; - } - - name = fvinfo?.OriginalFilename?.Trim(); - if (!string.IsNullOrWhiteSpace(name) && name.Equals("WEXTRACT.EXE", StringComparison.OrdinalIgnoreCase)) - { - string version = GetVersion(file, fileContent, null); - if (!string.IsNullOrWhiteSpace(version)) - return $"Microsoft CAB SFX v{Utilities.GetFileVersion(file)}"; - - return "Microsoft CAB SFX"; - } - - var matchers = new List + return new List { // wextract_cleanup new ContentMatchSet(new byte?[] @@ -67,7 +45,34 @@ namespace BurnOutSharp.PackerType // MSCFu new ContentMatchSet(new byte?[] { 0x4D, 0x53, 0x43, 0x46, 0x75 }, GetVersion, "Microsoft CAB SFX"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var fvinfo = Utilities.GetFileVersionInfo(file); + + string name = fvinfo?.InternalName?.Trim(); + if (!string.IsNullOrWhiteSpace(name) && name.Equals("Wextract", StringComparison.OrdinalIgnoreCase)) + { + string version = GetVersion(file, fileContent, null); + if (!string.IsNullOrWhiteSpace(version)) + return $"Microsoft CAB SFX v{Utilities.GetFileVersion(file)}"; + + return "Microsoft CAB SFX"; + } + + name = fvinfo?.OriginalFilename?.Trim(); + if (!string.IsNullOrWhiteSpace(name) && name.Equals("WEXTRACT.EXE", StringComparison.OrdinalIgnoreCase)) + { + string version = GetVersion(file, fileContent, null); + if (!string.IsNullOrWhiteSpace(version)) + return $"Microsoft CAB SFX v{Utilities.GetFileVersion(file)}"; + + return "Microsoft CAB SFX"; + } + + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } diff --git a/BurnOutSharp/PackerType/NSIS.cs b/BurnOutSharp/PackerType/NSIS.cs index 18c69710..738189a6 100644 --- a/BurnOutSharp/PackerType/NSIS.cs +++ b/BurnOutSharp/PackerType/NSIS.cs @@ -9,9 +9,9 @@ namespace BurnOutSharp.PackerType public class NSIS : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { // Nullsoft Install System new ContentMatchSet(new byte?[] @@ -28,7 +28,12 @@ namespace BurnOutSharp.PackerType 0x49, 0x6e, 0x73, 0x74 }, "NSIS"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } diff --git a/BurnOutSharp/PackerType/PECompact.cs b/BurnOutSharp/PackerType/PECompact.cs index 11164924..e64163a7 100644 --- a/BurnOutSharp/PackerType/PECompact.cs +++ b/BurnOutSharp/PackerType/PECompact.cs @@ -8,10 +8,10 @@ namespace BurnOutSharp.PackerType public class PECompact : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { // Another possible version string for version 1 is "PECO" (50 45 43 4F) - var matchers = new List + return new List { // pec1 new ContentMatchSet(new ContentMatch(new byte?[] { 0x70, 0x65, 0x63, 0x31 }, end: 2048), "PE Compact 1"), @@ -26,7 +26,12 @@ namespace BurnOutSharp.PackerType 0x74, 0x32 }, "PE Compact 2"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } diff --git a/BurnOutSharp/PackerType/SetupFactory.cs b/BurnOutSharp/PackerType/SetupFactory.cs index 3182b08f..ea8e76cd 100644 --- a/BurnOutSharp/PackerType/SetupFactory.cs +++ b/BurnOutSharp/PackerType/SetupFactory.cs @@ -12,9 +12,10 @@ namespace BurnOutSharp.PackerType public bool ShouldScan(byte[] magic) => true; /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + // Another possible version string for version 1 is "PECO" (50 45 43 4F) + return new List { // S.e.t.u.p. .F.a.c.t.o.r.y. new ContentMatchSet(new byte?[] @@ -45,7 +46,12 @@ namespace BurnOutSharp.PackerType // 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00 // }, GetVersion, "Setup Factory"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } diff --git a/BurnOutSharp/PackerType/UPX.cs b/BurnOutSharp/PackerType/UPX.cs index 19859209..97e1efdd 100644 --- a/BurnOutSharp/PackerType/UPX.cs +++ b/BurnOutSharp/PackerType/UPX.cs @@ -7,9 +7,9 @@ namespace BurnOutSharp.PackerType public class UPX : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { // UPX! new ContentMatchSet(new byte?[] { 0x55, 0x50, 0x58, 0x21 }, GetVersion, "UPX"), @@ -44,7 +44,12 @@ namespace BurnOutSharp.PackerType "UPX (NOS Variant) (Unknown Version)" ), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } diff --git a/BurnOutSharp/PackerType/WinRARSFX.cs b/BurnOutSharp/PackerType/WinRARSFX.cs index d334ef35..0501189b 100644 --- a/BurnOutSharp/PackerType/WinRARSFX.cs +++ b/BurnOutSharp/PackerType/WinRARSFX.cs @@ -15,9 +15,9 @@ namespace BurnOutSharp.PackerType public bool ShouldScan(byte[] magic) => true; /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { // Software\WinRAR SFX new ContentMatchSet(new byte?[] @@ -27,7 +27,12 @@ namespace BurnOutSharp.PackerType 0x53, 0x46, 0x58 }, "WinRAR SFX"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } diff --git a/BurnOutSharp/PackerType/WinZipSFX.cs b/BurnOutSharp/PackerType/WinZipSFX.cs index 6abb6371..fd968f92 100644 --- a/BurnOutSharp/PackerType/WinZipSFX.cs +++ b/BurnOutSharp/PackerType/WinZipSFX.cs @@ -15,9 +15,9 @@ namespace BurnOutSharp.PackerType public bool ShouldScan(byte[] magic) => true; /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { // WinZip Self-Extractor new ContentMatchSet(new byte?[] @@ -30,7 +30,12 @@ namespace BurnOutSharp.PackerType // _winzip_ new ContentMatchSet(new byte?[] { 0x5F, 0x77, 0x69, 0x6E, 0x7A, 0x69, 0x70, 0x5F }, GetVersion, "WinZip SFX"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } diff --git a/BurnOutSharp/PackerType/WiseInstaller.cs b/BurnOutSharp/PackerType/WiseInstaller.cs index 1ff75ee5..1ef7c1dc 100644 --- a/BurnOutSharp/PackerType/WiseInstaller.cs +++ b/BurnOutSharp/PackerType/WiseInstaller.cs @@ -14,14 +14,19 @@ namespace BurnOutSharp.PackerType public bool ShouldScan(byte[] magic) => true; /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { // WiseMain new ContentMatchSet(new byte?[] { 0x57, 0x69, 0x73, 0x65, 0x4D, 0x61, 0x69, 0x6E }, "Wise Installation Wizard Module"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } diff --git a/BurnOutSharp/PackerType/dotFuscator.cs b/BurnOutSharp/PackerType/dotFuscator.cs index c3ffbf5b..06da0b68 100644 --- a/BurnOutSharp/PackerType/dotFuscator.cs +++ b/BurnOutSharp/PackerType/dotFuscator.cs @@ -6,9 +6,9 @@ namespace BurnOutSharp.PackerType public class dotFuscator : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { // DotfuscatorAttribute new ContentMatchSet(new byte?[] @@ -18,7 +18,12 @@ namespace BurnOutSharp.PackerType 0x62, 0x75, 0x74, 0x65 }, "dotFuscator"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } } diff --git a/BurnOutSharp/ProtectionType/ActiveMARK.cs b/BurnOutSharp/ProtectionType/ActiveMARK.cs index b6ad10b8..9ac2d9d8 100644 --- a/BurnOutSharp/ProtectionType/ActiveMARK.cs +++ b/BurnOutSharp/ProtectionType/ActiveMARK.cs @@ -6,9 +6,9 @@ namespace BurnOutSharp.ProtectionType public class ActiveMARK : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { // TMSAMVOF new ContentMatchSet(new byte?[] { 0x54, 0x4D, 0x53, 0x41, 0x4D, 0x56, 0x4F, 0x46 }, "ActiveMARK"), @@ -21,7 +21,12 @@ namespace BurnOutSharp.ProtectionType 0x9A, 0xC1, 0x16, 0x00, 0x10, 0xC2, 0x16, 0x00 }, "ActiveMARK 5"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } } diff --git a/BurnOutSharp/ProtectionType/AlphaROM.cs b/BurnOutSharp/ProtectionType/AlphaROM.cs index c2a4f978..d867f909 100644 --- a/BurnOutSharp/ProtectionType/AlphaROM.cs +++ b/BurnOutSharp/ProtectionType/AlphaROM.cs @@ -6,14 +6,19 @@ namespace BurnOutSharp.ProtectionType public class AlphaROM : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { // SETTEC new ContentMatchSet(new byte?[] { 0x53, 0x45, 0x54, 0x54, 0x45, 0x43 }, "Alpha-ROM"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } } diff --git a/BurnOutSharp/ProtectionType/Bitpool.cs b/BurnOutSharp/ProtectionType/Bitpool.cs index 255ba131..a0d1e0e4 100644 --- a/BurnOutSharp/ProtectionType/Bitpool.cs +++ b/BurnOutSharp/ProtectionType/Bitpool.cs @@ -13,9 +13,9 @@ namespace BurnOutSharp.ProtectionType public class Bitpool : IContentCheck, IPathCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { // Sometimes found in CD.IDX // BITPOOL.RSC @@ -25,7 +25,12 @@ namespace BurnOutSharp.ProtectionType 0x52, 0x53, 0x43 }, "Bitpool"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } diff --git a/BurnOutSharp/ProtectionType/CDCheck.cs b/BurnOutSharp/ProtectionType/CDCheck.cs index dd350333..58d64f36 100644 --- a/BurnOutSharp/ProtectionType/CDCheck.cs +++ b/BurnOutSharp/ProtectionType/CDCheck.cs @@ -6,9 +6,9 @@ namespace BurnOutSharp.ProtectionType public class CDCheck : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { // MGS CDCheck new ContentMatchSet(new byte?[] @@ -20,7 +20,12 @@ namespace BurnOutSharp.ProtectionType // CDCheck new ContentMatchSet(new byte?[] { 0x43, 0x44, 0x43, 0x68, 0x65, 0x63, 0x6B }, "Executable-Based CD Check"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } diff --git a/BurnOutSharp/ProtectionType/CDCops.cs b/BurnOutSharp/ProtectionType/CDCops.cs index 8b99b170..c2acff18 100644 --- a/BurnOutSharp/ProtectionType/CDCops.cs +++ b/BurnOutSharp/ProtectionType/CDCops.cs @@ -9,9 +9,9 @@ namespace BurnOutSharp.ProtectionType public class CDCops : IContentCheck, IPathCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { // CD-Cops, ver. new ContentMatchSet(new byte?[] @@ -23,7 +23,12 @@ namespace BurnOutSharp.ProtectionType // .grand + (char)0x00 new ContentMatchSet(new byte?[] { 0x2E, 0x67, 0x72, 0x61, 0x6E, 0x64, 0x00 }, "CD-Cops"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } diff --git a/BurnOutSharp/ProtectionType/CDKey.cs b/BurnOutSharp/ProtectionType/CDKey.cs index a220a1f5..2c03772d 100644 --- a/BurnOutSharp/ProtectionType/CDKey.cs +++ b/BurnOutSharp/ProtectionType/CDKey.cs @@ -7,9 +7,9 @@ namespace BurnOutSharp.ProtectionType public class CDKey : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { // I + (char)0x00 + n + (char)0x00 + t + (char)0x00 + e + (char)0x00 + r + (char)0x00 + n + (char)0x00 + a + (char)0x00 + l + (char)0x00 + N + (char)0x00 + a + (char)0x00 + m + (char)0x00 + e + (char)0x00 + + (char)0x00 + + (char)0x00 + C + (char)0x00 + D + (char)0x00 + K + (char)0x00 + e + (char)0x00 + y + (char)0x00 new ContentMatchSet(new byte?[] @@ -21,7 +21,12 @@ namespace BurnOutSharp.ProtectionType 0x65, 0x00, 0x79, 0x00 }, Utilities.GetFileVersion, "CD-Key / Serial"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } } diff --git a/BurnOutSharp/ProtectionType/CDLock.cs b/BurnOutSharp/ProtectionType/CDLock.cs index 76e765f5..af01c942 100644 --- a/BurnOutSharp/ProtectionType/CDLock.cs +++ b/BurnOutSharp/ProtectionType/CDLock.cs @@ -7,9 +7,9 @@ namespace BurnOutSharp.ProtectionType public class CDLock : IContentCheck, IPathCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { // 2 + (char)0xF2 + (char)0x02 + (char)0x82 + (char)0xC3 + (char)0xBC + (char)0x0B + $ + (char)0x99 + (char)0xAD + 'C + (char)0xE4 + (char)0x9D + st + (char)0x99 + (char)0xFA + 2$ + (char)0x9D + )4 + (char)0xFF + t new ContentMatchSet(new byte?[] @@ -20,7 +20,12 @@ namespace BurnOutSharp.ProtectionType 0x74 }, "CD-Lock"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } diff --git a/BurnOutSharp/ProtectionType/CDSHiELDSE.cs b/BurnOutSharp/ProtectionType/CDSHiELDSE.cs index 1b103b90..17e9d4ae 100644 --- a/BurnOutSharp/ProtectionType/CDSHiELDSE.cs +++ b/BurnOutSharp/ProtectionType/CDSHiELDSE.cs @@ -6,14 +6,19 @@ namespace BurnOutSharp.ProtectionType public class CDSHiELDSE : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { // ~0017.tmp new ContentMatchSet(new byte?[] { 0x7E, 0x30, 0x30, 0x31, 0x37, 0x2E, 0x74, 0x6D, 0x70 }, "CDSHiELD SE"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } } diff --git a/BurnOutSharp/ProtectionType/CactusDataShield.cs b/BurnOutSharp/ProtectionType/CactusDataShield.cs index 8b1bc15b..f89c65d1 100644 --- a/BurnOutSharp/ProtectionType/CactusDataShield.cs +++ b/BurnOutSharp/ProtectionType/CactusDataShield.cs @@ -11,9 +11,9 @@ namespace BurnOutSharp.ProtectionType public class CactusDataShield : IContentCheck, IPathCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { // DATA.CDS new ContentMatchSet(new byte?[] { 0x44, 0x41, 0x54, 0x41, 0x2E, 0x43, 0x44, 0x53 }, "Cactus Data Shield 200"), @@ -24,7 +24,12 @@ namespace BurnOutSharp.ProtectionType // CDSPlayer new ContentMatchSet(new byte?[] { 0x43, 0x44, 0x53, 0x50, 0x6C, 0x61, 0x79, 0x65, 0x72 }, "Cactus Data Shield 200"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } diff --git a/BurnOutSharp/ProtectionType/CengaProtectDVD.cs b/BurnOutSharp/ProtectionType/CengaProtectDVD.cs index f1ddd2dd..f3244156 100644 --- a/BurnOutSharp/ProtectionType/CengaProtectDVD.cs +++ b/BurnOutSharp/ProtectionType/CengaProtectDVD.cs @@ -6,14 +6,19 @@ namespace BurnOutSharp.ProtectionType public class CengaProtectDVD : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { // .cenega new ContentMatchSet(new byte?[] { 0x2E, 0x63, 0x65, 0x6E, 0x65, 0x67, 0x61 }, "Cenega ProtectDVD"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } } diff --git a/BurnOutSharp/ProtectionType/CodeLock.cs b/BurnOutSharp/ProtectionType/CodeLock.cs index 9dee13e7..0fc5f0d6 100644 --- a/BurnOutSharp/ProtectionType/CodeLock.cs +++ b/BurnOutSharp/ProtectionType/CodeLock.cs @@ -6,10 +6,10 @@ namespace BurnOutSharp.ProtectionType public class CodeLock : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { // TODO: Verify if these are OR or AND - var matchers = new List + return new List { // icd1 + (char)0x00 new ContentMatchSet(new byte?[] { 0x69, 0x63, 0x64, 0x31, 0x00 }, "Code Lock"), @@ -24,7 +24,12 @@ namespace BurnOutSharp.ProtectionType 0x4B, 0x2E, 0x4F, 0x43, 0x58 }, "Code Lock"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } } diff --git a/BurnOutSharp/ProtectionType/CopyKiller.cs b/BurnOutSharp/ProtectionType/CopyKiller.cs index 898ffde7..b78d9bbb 100644 --- a/BurnOutSharp/ProtectionType/CopyKiller.cs +++ b/BurnOutSharp/ProtectionType/CopyKiller.cs @@ -7,9 +7,9 @@ namespace BurnOutSharp.ProtectionType public class CopyKiller : IContentCheck, IPathCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { // Tom Commander new ContentMatchSet(new byte?[] @@ -18,7 +18,12 @@ namespace BurnOutSharp.ProtectionType 0x61, 0x6E, 0x64, 0x65, 0x72 }, "CopyKiller"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } diff --git a/BurnOutSharp/ProtectionType/DVDCops.cs b/BurnOutSharp/ProtectionType/DVDCops.cs index a108f248..73a3dee3 100644 --- a/BurnOutSharp/ProtectionType/DVDCops.cs +++ b/BurnOutSharp/ProtectionType/DVDCops.cs @@ -8,9 +8,9 @@ namespace BurnOutSharp.ProtectionType public class DVDCops : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { // DVD-Cops, ver. new ContentMatchSet(new byte?[] @@ -19,7 +19,12 @@ namespace BurnOutSharp.ProtectionType 0x2C, 0x20, 0x20, 0x76, 0x65, 0x72, 0x2E, 0x20 }, GetVersion, "DVD-Cops"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } diff --git a/BurnOutSharp/ProtectionType/ElectronicArts.cs b/BurnOutSharp/ProtectionType/ElectronicArts.cs index f995b322..81c9ac9a 100644 --- a/BurnOutSharp/ProtectionType/ElectronicArts.cs +++ b/BurnOutSharp/ProtectionType/ElectronicArts.cs @@ -11,9 +11,9 @@ namespace BurnOutSharp.ProtectionType // - Reference to `EASTL` and `EAStdC` are standard for EA products and does not indicate Cucko by itself // - There's little information outside of PiD detection that actually knows about Cucko /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { // EASTL //new ContentMatchSet(new byte?[] { 0x45, 0x41, 0x53, 0x54, 0x4C }, "Cucko (EA Custom)"), @@ -96,7 +96,12 @@ namespace BurnOutSharp.ProtectionType 0x72, 0x00 }, "EA DRM Protection"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } } diff --git a/BurnOutSharp/ProtectionType/GFWL.cs b/BurnOutSharp/ProtectionType/GFWL.cs index b36fdf8b..3d8e8ab7 100644 --- a/BurnOutSharp/ProtectionType/GFWL.cs +++ b/BurnOutSharp/ProtectionType/GFWL.cs @@ -8,9 +8,9 @@ namespace BurnOutSharp.ProtectionType public class GFWL : IContentCheck, IPathCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { // xlive.dll new ContentMatchSet(new byte?[] { 0x78, 0x6C, 0x69, 0x76, 0x65, 0x2E, 0x64, 0x6C, 0x6C }, "Games for Windows LIVE"), @@ -44,7 +44,12 @@ namespace BurnOutSharp.ProtectionType 0x4C, 0x00, 0x49, 0x00, 0x56, 0x00, 0x45, 0x00, }, Utilities.GetFileVersion, "Games for Windows LIVE"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } diff --git a/BurnOutSharp/ProtectionType/ImpulseReactor.cs b/BurnOutSharp/ProtectionType/ImpulseReactor.cs index dd32e116..5d2ccc21 100644 --- a/BurnOutSharp/ProtectionType/ImpulseReactor.cs +++ b/BurnOutSharp/ProtectionType/ImpulseReactor.cs @@ -8,9 +8,9 @@ namespace BurnOutSharp.ProtectionType public class ImpulseReactor : IContentCheck, IPathCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { new ContentMatchSet(new List { @@ -42,7 +42,12 @@ namespace BurnOutSharp.ProtectionType 0x65, 0x6E, 0x74 }, "Impulse Reactor"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } diff --git a/BurnOutSharp/ProtectionType/Intenium.cs b/BurnOutSharp/ProtectionType/Intenium.cs index 8524350e..21cefd89 100644 --- a/BurnOutSharp/ProtectionType/Intenium.cs +++ b/BurnOutSharp/ProtectionType/Intenium.cs @@ -22,14 +22,19 @@ namespace BurnOutSharp.ProtectionType */ /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { // Trial + (char)0x00 + P new ContentMatchSet(new byte?[] { 0x54, 0x72, 0x69, 0x61, 0x6C, 0x00, 0x50 }, "INTENIUM Trial & Buy Protection"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } } diff --git a/BurnOutSharp/ProtectionType/JoWooDXProt.cs b/BurnOutSharp/ProtectionType/JoWooDXProt.cs index 5fe80ce9..0523c9f6 100644 --- a/BurnOutSharp/ProtectionType/JoWooDXProt.cs +++ b/BurnOutSharp/ProtectionType/JoWooDXProt.cs @@ -8,9 +8,9 @@ namespace BurnOutSharp.ProtectionType public class JoWooDXProt : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { // @HC09 new ContentMatchSet(new byte?[] { 0x40, 0x48, 0x43, 0x30, 0x39, 0x20, 0x20, 0x20, 0x20 }, "JoWooD X-Prot v2"), @@ -33,7 +33,12 @@ namespace BurnOutSharp.ProtectionType // .ext new ContentMatchSet(new byte?[] { 0x2E, 0x65, 0x78, 0x74, 0x20, 0x20, 0x20, 0x20 }, "JoWooD X-Prot v1"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } diff --git a/BurnOutSharp/ProtectionType/KeyLock.cs b/BurnOutSharp/ProtectionType/KeyLock.cs index c4205f05..1dc3e657 100644 --- a/BurnOutSharp/ProtectionType/KeyLock.cs +++ b/BurnOutSharp/ProtectionType/KeyLock.cs @@ -6,9 +6,9 @@ namespace BurnOutSharp.ProtectionType public class KeyLock : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { // KEY-LOCK COMMAND new ContentMatchSet(new byte?[] @@ -17,7 +17,12 @@ namespace BurnOutSharp.ProtectionType 0x20, 0x43, 0x4F, 0x4D, 0x4D, 0x41, 0x4E, 0x44 }, "Key-Lock (Dongle)"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } } diff --git a/BurnOutSharp/ProtectionType/LaserLock.cs b/BurnOutSharp/ProtectionType/LaserLock.cs index 03786ccf..0b0c3096 100644 --- a/BurnOutSharp/ProtectionType/LaserLock.cs +++ b/BurnOutSharp/ProtectionType/LaserLock.cs @@ -12,27 +12,9 @@ namespace BurnOutSharp.ProtectionType public class LaserLock : IContentCheck, IPathCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - // "Packed by SPEEnc V2 Asterios Parlamentas.PE" - byte?[] check = new byte?[] { 0x50, 0x61, 0x63, 0x6B, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x53, 0x50, 0x45, 0x45, 0x6E, 0x63, 0x20, 0x56, 0x32, 0x20, 0x41, 0x73, 0x74, 0x65, 0x72, 0x69, 0x6F, 0x73, 0x20, 0x50, 0x61, 0x72, 0x6C, 0x61, 0x6D, 0x65, 0x6E, 0x74, 0x61, 0x73, 0x2E, 0x50, 0x45 }; - bool containsCheck = fileContent.FirstPosition(check, out int position); - - // "GetModuleHandleA" + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00 + "GetProcAddress" + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00 + "LoadLibraryA" + (char)0x00 + (char)0x00 + "KERNEL32.dll" + (char)0x00 + "ëy" + (char)0x01 + "SNIF" - byte?[] check2 = { 0x47, 0x65, 0x74, 0x4D, 0x6F, 0x64, 0x75, 0x6C, 0x65, 0x48, 0x61, 0x6E, 0x64, 0x6C, 0x65, 0x41, 0x00, 0x00, 0x00, 0x00, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6F, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x00, 0x00, 0x00, 0x00, 0x4C, 0x6F, 0x61, 0x64, 0x4C, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x41, 0x00, 0x00, 0x4B, 0x45, 0x52, 0x4E, 0x45, 0x4C, 0x33, 0x32, 0x2E, 0x64, 0x6C, 0x6C, 0x00, 0xEB, 0x79, 0x01, 0x53, 0x4E, 0x49, 0x46 }; - bool containsCheck2 = fileContent.FirstPosition(check2, out int position2); - - if (containsCheck && containsCheck2) - return $"LaserLock {GetVersion(fileContent, position2)} {GetBuild(fileContent, true)}" + (includeDebug ? $" (Index {position}, {position2})" : string.Empty); - else if (containsCheck && !containsCheck2) - return $"LaserLock Marathon {GetBuild(fileContent, false)}" + (includeDebug ? $" (Index {position})" : string.Empty); - else if (!containsCheck && containsCheck2) - return $"LaserLock {GetVersion(fileContent, --position2)} {GetBuild(fileContent, false)}" + (includeDebug ? $" (Index {position2})" : string.Empty); - - if (file != null && string.Equals(Path.GetFileName(file), "NOMOUSE.SP", StringComparison.OrdinalIgnoreCase)) - return $"LaserLock {GetVersion16Bit(fileContent)}" + (includeDebug ? $" (Index 71)" : string.Empty); - - var matchers = new List + return new List { // :\\LASERLOK\\LASERLOK.IN + (char)0x00 + C:\\NOMOUSE.SP new ContentMatchSet(new byte?[] @@ -59,7 +41,30 @@ namespace BurnOutSharp.ProtectionType 0x33 }, "LaserLock 5"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + // "Packed by SPEEnc V2 Asterios Parlamentas.PE" + byte?[] check = new byte?[] { 0x50, 0x61, 0x63, 0x6B, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x53, 0x50, 0x45, 0x45, 0x6E, 0x63, 0x20, 0x56, 0x32, 0x20, 0x41, 0x73, 0x74, 0x65, 0x72, 0x69, 0x6F, 0x73, 0x20, 0x50, 0x61, 0x72, 0x6C, 0x61, 0x6D, 0x65, 0x6E, 0x74, 0x61, 0x73, 0x2E, 0x50, 0x45 }; + bool containsCheck = fileContent.FirstPosition(check, out int position); + + // "GetModuleHandleA" + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00 + "GetProcAddress" + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00 + "LoadLibraryA" + (char)0x00 + (char)0x00 + "KERNEL32.dll" + (char)0x00 + "ëy" + (char)0x01 + "SNIF" + byte?[] check2 = { 0x47, 0x65, 0x74, 0x4D, 0x6F, 0x64, 0x75, 0x6C, 0x65, 0x48, 0x61, 0x6E, 0x64, 0x6C, 0x65, 0x41, 0x00, 0x00, 0x00, 0x00, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6F, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x00, 0x00, 0x00, 0x00, 0x4C, 0x6F, 0x61, 0x64, 0x4C, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x41, 0x00, 0x00, 0x4B, 0x45, 0x52, 0x4E, 0x45, 0x4C, 0x33, 0x32, 0x2E, 0x64, 0x6C, 0x6C, 0x00, 0xEB, 0x79, 0x01, 0x53, 0x4E, 0x49, 0x46 }; + bool containsCheck2 = fileContent.FirstPosition(check2, out int position2); + + if (containsCheck && containsCheck2) + return $"LaserLock {GetVersion(fileContent, position2)} {GetBuild(fileContent, true)}" + (includeDebug ? $" (Index {position}, {position2})" : string.Empty); + else if (containsCheck && !containsCheck2) + return $"LaserLock Marathon {GetBuild(fileContent, false)}" + (includeDebug ? $" (Index {position})" : string.Empty); + else if (!containsCheck && containsCheck2) + return $"LaserLock {GetVersion(fileContent, --position2)} {GetBuild(fileContent, false)}" + (includeDebug ? $" (Index {position2})" : string.Empty); + + if (file != null && string.Equals(Path.GetFileName(file), "NOMOUSE.SP", StringComparison.OrdinalIgnoreCase)) + return $"LaserLock {GetVersion16Bit(fileContent)}" + (includeDebug ? $" (Index 71)" : string.Empty); + + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } diff --git a/BurnOutSharp/ProtectionType/MediaMaxCD3.cs b/BurnOutSharp/ProtectionType/MediaMaxCD3.cs index 59d6c790..559c4db5 100644 --- a/BurnOutSharp/ProtectionType/MediaMaxCD3.cs +++ b/BurnOutSharp/ProtectionType/MediaMaxCD3.cs @@ -7,9 +7,9 @@ namespace BurnOutSharp.ProtectionType public class MediaMaxCD3 : IContentCheck, IPathCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { // Cd3Ctl new ContentMatchSet(new byte?[] { 0x43, 0x64, 0x33, 0x43, 0x74, 0x6C }, "MediaMax CD-3"), @@ -21,7 +21,12 @@ namespace BurnOutSharp.ProtectionType 0x6C, 0x6C, 0x53, 0x62, 0x63, 0x70 }, "MediaMax CD-3"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } diff --git a/BurnOutSharp/ProtectionType/OnlineRegistration.cs b/BurnOutSharp/ProtectionType/OnlineRegistration.cs index 520c31fe..8644e967 100644 --- a/BurnOutSharp/ProtectionType/OnlineRegistration.cs +++ b/BurnOutSharp/ProtectionType/OnlineRegistration.cs @@ -7,9 +7,9 @@ namespace BurnOutSharp.ProtectionType public class OnlineRegistration : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { // I + (char)0x00 + n + (char)0x00 + t + (char)0x00 + e + (char)0x00 + r + (char)0x00 + n + (char)0x00 + a + (char)0x00 + l + (char)0x00 + N + (char)0x00 + a + (char)0x00 + m + (char)0x00 + e + (char)0x00 + + (char)0x00 + + (char)0x00 + E + (char)0x00 + R + (char)0x00 + e + (char)0x00 + g + (char)0x00 new ContentMatchSet(new byte?[] @@ -21,7 +21,12 @@ namespace BurnOutSharp.ProtectionType 0x67, 0x00 }, Utilities.GetFileVersion, "Executable-Based Online Registration"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } } diff --git a/BurnOutSharp/ProtectionType/Origin.cs b/BurnOutSharp/ProtectionType/Origin.cs index 3df4fec4..e408d0d3 100644 --- a/BurnOutSharp/ProtectionType/Origin.cs +++ b/BurnOutSharp/ProtectionType/Origin.cs @@ -7,14 +7,19 @@ namespace BurnOutSharp.ProtectionType public class Origin : IContentCheck, IPathCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { // O + (char)0x00 + r + (char)0x00 + i + (char)0x00 + g + (char)0x00 + i + (char)0x00 + n + (char)0x00 + S + (char)0x00 + e + (char)0x00 + t + (char)0x00 + u + (char)0x00 + p + (char)0x00 + . + (char)0x00 + e + (char)0x00 + x + (char)0x00 + e + (char)0x00 new ContentMatchSet(new byte?[] { 0x4F, 0x00, 0x72, 0x00, 0x69, 0x00, 0x67, 0x00, 0x69, 0x00, 0x6E, 0x00, 0x53, 0x00, 0x65, 0x00, 0x74, 0x00, 0x75, 0x00, 0x70, 0x00, 0x2E, 0x00, 0x65, 0x00, 0x78, 0x00, 0x65, 0x00 }, "Origin"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } diff --git a/BurnOutSharp/ProtectionType/PSXAntiModchip.cs b/BurnOutSharp/ProtectionType/PSXAntiModchip.cs index 655dd308..7d3bdb57 100644 --- a/BurnOutSharp/ProtectionType/PSXAntiModchip.cs +++ b/BurnOutSharp/ProtectionType/PSXAntiModchip.cs @@ -5,12 +5,10 @@ namespace BurnOutSharp.ProtectionType { public class PSXAntiModchip : IContentCheck { - // TODO: Figure out PSX binary header so this can be checked explicitly - // TODO: Detect Red Hand protection /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { // SOFTWARE TERMINATED\nCONSOLE MAY HAVE BEEN MODIFIED\n CALL 1-888-780-7690 new ContentMatchSet(new byte?[] @@ -41,7 +39,14 @@ namespace BurnOutSharp.ProtectionType 0x30, 0x59, 0x30, 0x02 }, "PlayStation Anti-modchip (Japanese)"), }; + } + // TODO: Figure out PSX binary header so this can be checked explicitly + // TODO: Detect Red Hand protection + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } } diff --git a/BurnOutSharp/ProtectionType/ProtectDisc.cs b/BurnOutSharp/ProtectionType/ProtectDisc.cs index 092e07ce..9ebf0e80 100644 --- a/BurnOutSharp/ProtectionType/ProtectDisc.cs +++ b/BurnOutSharp/ProtectionType/ProtectDisc.cs @@ -12,9 +12,9 @@ namespace BurnOutSharp.ProtectionType public class ProtectDisc : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { // HúMETINF new ContentMatchSet(new byte?[] { 0x48, 0xFA, 0x4D, 0x45, 0x54, 0x49, 0x4E, 0x46 }, GetVersion76till10, "ProtectDisc"), @@ -22,7 +22,12 @@ namespace BurnOutSharp.ProtectionType // ACE-PCD new ContentMatchSet(new byte?[] { 0x41, 0x43, 0x45, 0x2D, 0x50, 0x43, 0x44 }, GetVersion6till8, "ProtectDisc"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } diff --git a/BurnOutSharp/ProtectionType/RingPROTECH.cs b/BurnOutSharp/ProtectionType/RingPROTECH.cs index 79b025c7..00734d1e 100644 --- a/BurnOutSharp/ProtectionType/RingPROTECH.cs +++ b/BurnOutSharp/ProtectionType/RingPROTECH.cs @@ -6,9 +6,9 @@ namespace BurnOutSharp.ProtectionType public class RingPROTECH : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { // (char)0x00 + Allocator + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00 new ContentMatchSet(new byte?[] @@ -17,7 +17,12 @@ namespace BurnOutSharp.ProtectionType 0x6F, 0x72, 0x00, 0x00, 0x00, 0x00 }, "Ring PROTECH [Check disc for physical ring]"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } } diff --git a/BurnOutSharp/ProtectionType/SVKProtector.cs b/BurnOutSharp/ProtectionType/SVKProtector.cs index 02cf1d7a..c6c51a88 100644 --- a/BurnOutSharp/ProtectionType/SVKProtector.cs +++ b/BurnOutSharp/ProtectionType/SVKProtector.cs @@ -6,14 +6,19 @@ namespace BurnOutSharp.ProtectionType public class SVKProtector : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { // ?SVKP + (char)0x00 + (char)0x00 new ContentMatchSet(new byte?[] { 0x3F, 0x53, 0x56, 0x4B, 0x50, 0x00, 0x00 }, "SVK Protector"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } } diff --git a/BurnOutSharp/ProtectionType/SafeDisc.cs b/BurnOutSharp/ProtectionType/SafeDisc.cs index 86f748fa..7a8e7539 100644 --- a/BurnOutSharp/ProtectionType/SafeDisc.cs +++ b/BurnOutSharp/ProtectionType/SafeDisc.cs @@ -40,9 +40,9 @@ namespace BurnOutSharp.ProtectionType }; /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { new ContentMatchSet(new List { @@ -81,7 +81,12 @@ namespace BurnOutSharp.ProtectionType // stxt371 new ContentMatchSet(new byte?[] { 0x73, 0x74, 0x78, 0x74, 0x33, 0x37, 0x31 }, Get320to4xVersion, "SafeDisc"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } diff --git a/BurnOutSharp/ProtectionType/SafeLock.cs b/BurnOutSharp/ProtectionType/SafeLock.cs index 10cee201..6e91c1ab 100644 --- a/BurnOutSharp/ProtectionType/SafeLock.cs +++ b/BurnOutSharp/ProtectionType/SafeLock.cs @@ -7,14 +7,19 @@ namespace BurnOutSharp.ProtectionType public class SafeLock : IContentCheck, IPathCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { // SafeLock new ContentMatchSet(new byte?[] { 0x53, 0x61, 0x66, 0x65, 0x4C, 0x6F, 0x63, 0x6B }, "SafeLock"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } diff --git a/BurnOutSharp/ProtectionType/SecuROM.cs b/BurnOutSharp/ProtectionType/SecuROM.cs index 13f9f199..f14fd863 100644 --- a/BurnOutSharp/ProtectionType/SecuROM.cs +++ b/BurnOutSharp/ProtectionType/SecuROM.cs @@ -10,9 +10,9 @@ namespace BurnOutSharp.ProtectionType public class SecuROM : IContentCheck, IPathCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { // AddD + (char)0x03 + (char)0x00 + (char)0x00 + (char)0x00) new ContentMatchSet(new byte?[] { 0x41, 0x64, 0x64, 0x44, 0x03, 0x00, 0x00, 0x00 }, GetV4Version, "SecuROM"), @@ -53,7 +53,12 @@ namespace BurnOutSharp.ProtectionType // .cms_d + (char)0x00 new ContentMatchSet(new byte?[] { 0x2E, 0x63, 0x6D, 0x73, 0x5F, 0x64, 0x00 }, "SecuROM 1-3"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } diff --git a/BurnOutSharp/ProtectionType/SmartE.cs b/BurnOutSharp/ProtectionType/SmartE.cs index 63fdfd27..3ce85471 100644 --- a/BurnOutSharp/ProtectionType/SmartE.cs +++ b/BurnOutSharp/ProtectionType/SmartE.cs @@ -8,14 +8,19 @@ namespace BurnOutSharp.ProtectionType public class SmartE : IContentCheck, IPathCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { // BITARTS new ContentMatchSet(new byte?[] { 0x42, 0x49, 0x54, 0x41, 0x52, 0x54, 0x53 }, "SmartE"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } diff --git a/BurnOutSharp/ProtectionType/SolidShield.cs b/BurnOutSharp/ProtectionType/SolidShield.cs index 0382c7fa..31d840de 100644 --- a/BurnOutSharp/ProtectionType/SolidShield.cs +++ b/BurnOutSharp/ProtectionType/SolidShield.cs @@ -21,9 +21,9 @@ namespace BurnOutSharp.ProtectionType }; /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { // D + (char)0x00 + V + (char)0x00 + M + (char)0x00 + + (char)0x00 + L + (char)0x00 + i + (char)0x00 + b + (char)0x00 + r + (char)0x00 + a + (char)0x00 + r + (char)0x00 + y + (char)0x00 new ContentMatchSet(new byte?[] @@ -90,7 +90,12 @@ namespace BurnOutSharp.ProtectionType 0x53, 0x00, 0x47, 0x00, 0x54, 0x00 }, "SolidShield"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } diff --git a/BurnOutSharp/ProtectionType/StarForce.cs b/BurnOutSharp/ProtectionType/StarForce.cs index 09434f69..e38fd4da 100644 --- a/BurnOutSharp/ProtectionType/StarForce.cs +++ b/BurnOutSharp/ProtectionType/StarForce.cs @@ -9,9 +9,9 @@ namespace BurnOutSharp.ProtectionType public class StarForce : IContentCheck, IPathCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { new ContentMatchSet(new List { @@ -114,7 +114,12 @@ namespace BurnOutSharp.ProtectionType 0x64, 0x00, 0x75, 0x00, 0x6c, 0x00, 0x65, 0x00 }, "StarForce 5"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } diff --git a/BurnOutSharp/ProtectionType/Sysiphus.cs b/BurnOutSharp/ProtectionType/Sysiphus.cs index 627ff000..132b4ea1 100644 --- a/BurnOutSharp/ProtectionType/Sysiphus.cs +++ b/BurnOutSharp/ProtectionType/Sysiphus.cs @@ -6,9 +6,9 @@ namespace BurnOutSharp.ProtectionType public class Sysiphus : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { // V SUHPISYSDVD new ContentMatchSet(new byte?[] @@ -24,7 +24,12 @@ namespace BurnOutSharp.ProtectionType 0x59, 0x53 }, GetVersion, "Sysiphus"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } diff --git a/BurnOutSharp/ProtectionType/Tages.cs b/BurnOutSharp/ProtectionType/Tages.cs index 784bec88..c9e986b1 100644 --- a/BurnOutSharp/ProtectionType/Tages.cs +++ b/BurnOutSharp/ProtectionType/Tages.cs @@ -12,9 +12,9 @@ namespace BurnOutSharp.ProtectionType public class Tages : IContentCheck, IPathCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { // protected-tages-runtime.exe new ContentMatchSet(new byte?[] @@ -36,7 +36,12 @@ namespace BurnOutSharp.ProtectionType // (char)0xE8 + u + (char)0x00 + (char)0x00 + (char)0x00 + (char)0xE8 new ContentMatchSet(new byte?[] { 0xE8, 0x75, 0x00, 0x00, 0x00, 0xE8 }, GetVersion, "TAGES"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } diff --git a/BurnOutSharp/ProtectionType/ThreePLock.cs b/BurnOutSharp/ProtectionType/ThreePLock.cs index 972b82a9..da4a27fd 100644 --- a/BurnOutSharp/ProtectionType/ThreePLock.cs +++ b/BurnOutSharp/ProtectionType/ThreePLock.cs @@ -6,9 +6,9 @@ namespace BurnOutSharp.ProtectionType public class ThreePLock : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { new ContentMatchSet(new List { @@ -27,7 +27,12 @@ namespace BurnOutSharp.ProtectionType // 0x53, 0x56, 0x57 // }, "3PLock"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } } diff --git a/BurnOutSharp/ProtectionType/ThreeTwoOneStudios.cs b/BurnOutSharp/ProtectionType/ThreeTwoOneStudios.cs index 69bb8a7b..ccde7b5e 100644 --- a/BurnOutSharp/ProtectionType/ThreeTwoOneStudios.cs +++ b/BurnOutSharp/ProtectionType/ThreeTwoOneStudios.cs @@ -6,9 +6,9 @@ namespace BurnOutSharp.ProtectionType public class ThreeTwoOneStudios : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { // 3 + (char)0x00 + 1 + 2 + (char)0x00 + 1 + (char)0x00 + S + (char)0x00 + t + (char)0x00 + u + (char)0x00 + d + (char)0x00 + i + (char)0x00 + o + (char)0x00 + s + (char)0x00 + + (char)0x00 + A + (char)0x00 + c + (char)0x00 + t + (char)0x00 + i + (char)0x00 + v + (char)0x00 + a + (char)0x00 + t + (char)0x00 + i + (char)0x00 + o + (char)0x00 + n + (char)0x00 new ContentMatchSet(new byte?[] @@ -21,7 +21,12 @@ namespace BurnOutSharp.ProtectionType 0x6E, 0x00 }, "321Studios Online Activation"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } } diff --git a/BurnOutSharp/ProtectionType/VOBProtectCDDVD.cs b/BurnOutSharp/ProtectionType/VOBProtectCDDVD.cs index 43eeffac..0aa192e3 100644 --- a/BurnOutSharp/ProtectionType/VOBProtectCDDVD.cs +++ b/BurnOutSharp/ProtectionType/VOBProtectCDDVD.cs @@ -13,9 +13,9 @@ namespace BurnOutSharp.ProtectionType public class VOBProtectCDDVD : IContentCheck, IPathCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { // VOB ProtectCD new ContentMatchSet(new byte?[] @@ -30,7 +30,12 @@ namespace BurnOutSharp.ProtectionType // .vob.pcd new ContentMatchSet(new byte?[] { 0x2E, 0x76, 0x6F, 0x62, 0x2E, 0x70, 0x63, 0x64 }, "VOB ProtectCD"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } diff --git a/BurnOutSharp/ProtectionType/WTMCDProtect.cs b/BurnOutSharp/ProtectionType/WTMCDProtect.cs index b5f929c6..9f47507c 100644 --- a/BurnOutSharp/ProtectionType/WTMCDProtect.cs +++ b/BurnOutSharp/ProtectionType/WTMCDProtect.cs @@ -7,9 +7,9 @@ namespace BurnOutSharp.ProtectionType public class WTMCDProtect : IContentCheck, IPathCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { // This string is found in the .imp files associated with this protection. // WTM76545 @@ -34,7 +34,12 @@ namespace BurnOutSharp.ProtectionType 0x48, 0x61, 0x6E, 0x73, 0x70, 0x65, 0x74, 0x65, 0x72 }, "WTM Protection Viewer"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } diff --git a/BurnOutSharp/ProtectionType/XCP.cs b/BurnOutSharp/ProtectionType/XCP.cs index 6c625048..ee590950 100644 --- a/BurnOutSharp/ProtectionType/XCP.cs +++ b/BurnOutSharp/ProtectionType/XCP.cs @@ -12,9 +12,9 @@ namespace BurnOutSharp.ProtectionType public class XCP : IContentCheck, IPathCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { // Found in GO.EXE // XCP.DAT @@ -42,7 +42,12 @@ namespace BurnOutSharp.ProtectionType 0x78, 0x63, 0x70, 0x64, 0x72, 0x69, 0x76, 0x65 }, "XCP"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } diff --git a/BurnOutSharp/ProtectionType/XtremeProtector.cs b/BurnOutSharp/ProtectionType/XtremeProtector.cs index 6e6e43a9..d027e83b 100644 --- a/BurnOutSharp/ProtectionType/XtremeProtector.cs +++ b/BurnOutSharp/ProtectionType/XtremeProtector.cs @@ -6,14 +6,19 @@ namespace BurnOutSharp.ProtectionType public class XtremeProtector : IContentCheck { /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + public List GetContentMatchSets() { - var matchers = new List + return new List { // XPROT new ContentMatchSet(new byte?[] { 0x58, 0x50, 0x52, 0x4F, 0x54, 0x20, 0x20, 0x20 }, "Xtreme-Protector"), }; + } + /// + public string CheckContents(string file, byte[] fileContent, bool includeDebug = false) + { + var matchers = GetContentMatchSets(); return MatchUtil.GetFirstMatch(file, fileContent, matchers, includeDebug); } }