Add IContentCheck interface

This commit is contained in:
Matt Nadareski
2021-02-26 01:26:49 -08:00
parent c6eaafebbe
commit 7cfa9649e4
47 changed files with 195 additions and 136 deletions

View File

@@ -62,177 +62,177 @@ namespace BurnOutSharp.FileType
#region Protections
// 3PLock
protection = ThreePLock.CheckContents(fileContent, scanner.IncludePosition);
protection = new ThreePLock().CheckContents(file, fileContent, scanner.IncludePosition);
if (!string.IsNullOrWhiteSpace(protection))
Utilities.AppendToDictionary(protections, file, protection);
// 321Studios Online Activation
protection = ThreeTwoOneStudios.CheckContents(fileContent, scanner.IncludePosition);
protection = new ThreeTwoOneStudios().CheckContents(file, fileContent, scanner.IncludePosition);
if (!string.IsNullOrWhiteSpace(protection))
Utilities.AppendToDictionary(protections, file, protection);
// ActiveMARK
protection = ActiveMARK.CheckContents(fileContent, scanner.IncludePosition);
protection = new ActiveMARK().CheckContents(file, fileContent, scanner.IncludePosition);
if (!string.IsNullOrWhiteSpace(protection))
Utilities.AppendToDictionary(protections, file, protection);
// Alpha-ROM
protection = AlphaROM.CheckContents(fileContent, scanner.IncludePosition);
protection = new AlphaROM().CheckContents(file, fileContent, scanner.IncludePosition);
if (!string.IsNullOrWhiteSpace(protection))
Utilities.AppendToDictionary(protections, file, protection);
// Cactus Data Shield
protection = CactusDataShield.CheckContents(fileContent, scanner.IncludePosition);
protection = new CactusDataShield().CheckContents(file, fileContent, scanner.IncludePosition);
if (!string.IsNullOrWhiteSpace(protection))
Utilities.AppendToDictionary(protections, file, protection);
// CD-Cops
protection = CDCops.CheckContents(fileContent, scanner.IncludePosition);
protection = new CDCops().CheckContents(file, fileContent, scanner.IncludePosition);
if (!string.IsNullOrWhiteSpace(protection))
Utilities.AppendToDictionary(protections, file, protection);
// CD-Lock
protection = CDLock.CheckContents(fileContent, scanner.IncludePosition);
protection = new CDLock().CheckContents(file, fileContent, scanner.IncludePosition);
if (!string.IsNullOrWhiteSpace(protection))
Utilities.AppendToDictionary(protections, file, protection);
// CDSHiELD SE
protection = CDSHiELDSE.CheckContents(fileContent, scanner.IncludePosition);
protection = new CDSHiELDSE().CheckContents(file, fileContent, scanner.IncludePosition);
if (!string.IsNullOrWhiteSpace(protection))
Utilities.AppendToDictionary(protections, file, protection);
// CD Check
protection = CDCheck.CheckContents(fileContent, scanner.IncludePosition);
protection = new CDCheck().CheckContents(file, fileContent, scanner.IncludePosition);
if (!string.IsNullOrWhiteSpace(protection))
Utilities.AppendToDictionary(protections, file, protection);
// Cenega ProtectDVD
protection = CengaProtectDVD.CheckContents(fileContent, scanner.IncludePosition);
protection = new CengaProtectDVD().CheckContents(file, fileContent, scanner.IncludePosition);
if (!string.IsNullOrWhiteSpace(protection))
Utilities.AppendToDictionary(protections, file, protection);
// Code Lock
protection = CodeLock.CheckContents(fileContent, scanner.IncludePosition);
protection = new CodeLock().CheckContents(file, fileContent, scanner.IncludePosition);
if (!string.IsNullOrWhiteSpace(protection))
Utilities.AppendToDictionary(protections, file, protection);
// CopyKiller
protection = CopyKiller.CheckContents(fileContent, scanner.IncludePosition);
protection = new CopyKiller().CheckContents(file, fileContent, scanner.IncludePosition);
if (!string.IsNullOrWhiteSpace(protection))
Utilities.AppendToDictionary(protections, file, protection);
// DVD-Cops
protection = DVDCops.CheckContents(fileContent, scanner.IncludePosition);
protection = new DVDCops().CheckContents(file, fileContent, scanner.IncludePosition);
if (!string.IsNullOrWhiteSpace(protection))
Utilities.AppendToDictionary(protections, file, protection);
// EA Protections
protection = ElectronicArts.CheckContents(file, fileContent, scanner.IncludePosition);
protection = new ElectronicArts().CheckContents(file, fileContent, scanner.IncludePosition);
if (!string.IsNullOrWhiteSpace(protection))
Utilities.AppendToDictionary(protections, file, protection);
// Games for Windows - Live
protection = GFWL.CheckContents(fileContent, scanner.IncludePosition);
protection = new GFWL().CheckContents(file, fileContent, scanner.IncludePosition);
if (!string.IsNullOrWhiteSpace(protection))
Utilities.AppendToDictionary(protections, file, protection);
// Impulse Reactor
protection = ImpulseReactor.CheckContents(file, fileContent, scanner.IncludePosition);
protection = new ImpulseReactor().CheckContents(file, fileContent, scanner.IncludePosition);
if (!string.IsNullOrWhiteSpace(protection))
Utilities.AppendToDictionary(protections, file, protection);
// Inno Setup
protection = InnoSetup.CheckContents(fileContent, scanner.IncludePosition);
protection = new InnoSetup().CheckContents(file, fileContent, scanner.IncludePosition);
if (!string.IsNullOrWhiteSpace(protection))
Utilities.AppendToDictionary(protections, file, protection);
// INTENIUM Trial & Buy Protection
protection = Intenium.CheckContents(fileContent, scanner.IncludePosition);
protection = new Intenium().CheckContents(file, fileContent, scanner.IncludePosition);
if (!string.IsNullOrWhiteSpace(protection))
Utilities.AppendToDictionary(protections, file, protection);
// JoWooD X-Prot
protection = JoWooDXProt.CheckContents(fileContent, scanner.IncludePosition);
protection = new JoWooDXProt().CheckContents(file, fileContent, scanner.IncludePosition);
if (!string.IsNullOrWhiteSpace(protection))
Utilities.AppendToDictionary(protections, file, protection);
// Key-Lock (Dongle)
protection = KeyLock.CheckContents(fileContent, scanner.IncludePosition);
protection = new KeyLock().CheckContents(file, fileContent, scanner.IncludePosition);
if (!string.IsNullOrWhiteSpace(protection))
Utilities.AppendToDictionary(protections, file, protection);
// LaserLock
protection = LaserLock.CheckContents(file, fileContent, scanner.IncludePosition);
protection = new LaserLock().CheckContents(file, fileContent, scanner.IncludePosition);
if (!string.IsNullOrWhiteSpace(protection))
Utilities.AppendToDictionary(protections, file, protection);
// MediaMax CD-3
protection = MediaMaxCD3.CheckContents(fileContent, scanner.IncludePosition);
protection = new MediaMaxCD3().CheckContents(file, fileContent, scanner.IncludePosition);
if (!string.IsNullOrWhiteSpace(protection))
Utilities.AppendToDictionary(protections, file, protection);
// Origin
protection = Origin.CheckContents(fileContent, scanner.IncludePosition);
protection = new Origin().CheckContents(file, fileContent, scanner.IncludePosition);
if (!string.IsNullOrWhiteSpace(protection))
Utilities.AppendToDictionary(protections, file, protection);
// ProtectDisc
protection = ProtectDisc.CheckContents(file, fileContent, scanner.IncludePosition);
protection = new ProtectDisc().CheckContents(file, fileContent, scanner.IncludePosition);
if (!string.IsNullOrWhiteSpace(protection))
Utilities.AppendToDictionary(protections, file, protection);
// Ring PROTECH
protection = RingPROTECH.CheckContents(fileContent, scanner.IncludePosition);
protection = new RingPROTECH().CheckContents(file, fileContent, scanner.IncludePosition);
if (!string.IsNullOrWhiteSpace(protection))
Utilities.AppendToDictionary(protections, file, protection);
// SafeDisc / SafeCast
protection = SafeDisc.CheckContents(file, fileContent, scanner.IncludePosition);
protection = new SafeDisc().CheckContents(file, fileContent, scanner.IncludePosition);
if (!string.IsNullOrWhiteSpace(protection))
Utilities.AppendToDictionary(protections, file, protection);
// SafeLock
protection = SafeLock.CheckContents(fileContent, scanner.IncludePosition);
protection = new SafeLock().CheckContents(file, fileContent, scanner.IncludePosition);
if (!string.IsNullOrWhiteSpace(protection))
Utilities.AppendToDictionary(protections, file, protection);
// SecuROM
protection = SecuROM.CheckContents(file, fileContent, scanner.IncludePosition);
protection = new SecuROM().CheckContents(file, fileContent, scanner.IncludePosition);
if (!string.IsNullOrWhiteSpace(protection))
Utilities.AppendToDictionary(protections, file, protection);
// SmartE
protection = SmartE.CheckContents(fileContent, scanner.IncludePosition);
protection = new SmartE().CheckContents(file, fileContent, scanner.IncludePosition);
if (!string.IsNullOrWhiteSpace(protection))
Utilities.AppendToDictionary(protections, file, protection);
// SolidShield
protection = SolidShield.CheckContents(file, fileContent, scanner.IncludePosition);
protection = new SolidShield().CheckContents(file, fileContent, scanner.IncludePosition);
if (!string.IsNullOrWhiteSpace(protection))
Utilities.AppendToDictionary(protections, file, protection);
// StarForce
protection = StarForce.CheckContents(file, fileContent, scanner.IncludePosition);
protection = new StarForce().CheckContents(file, fileContent, scanner.IncludePosition);
if (!string.IsNullOrWhiteSpace(protection))
Utilities.AppendToDictionary(protections, file, protection);
// SVK Protector
protection = SVKProtector.CheckContents(fileContent, scanner.IncludePosition);
protection = new SVKProtector().CheckContents(file, fileContent, scanner.IncludePosition);
if (!string.IsNullOrWhiteSpace(protection))
Utilities.AppendToDictionary(protections, file, protection);
// Sysiphus / Sysiphus DVD
protection = Sysiphus.CheckContents(fileContent, scanner.IncludePosition);
protection = new Sysiphus().CheckContents(file, fileContent, scanner.IncludePosition);
if (!string.IsNullOrWhiteSpace(protection))
Utilities.AppendToDictionary(protections, file, protection);
// TAGES
protection = Tages.CheckContents(file, fileContent, scanner.IncludePosition);
protection = new Tages().CheckContents(file, fileContent, scanner.IncludePosition);
if (!string.IsNullOrWhiteSpace(protection))
Utilities.AppendToDictionary(protections, file, protection);
// VOB ProtectCD/DVD
protection = VOBProtectCDDVD.CheckContents(file, fileContent, scanner.IncludePosition);
protection = new VOBProtectCDDVD().CheckContents(file, fileContent, scanner.IncludePosition);
if (!string.IsNullOrWhiteSpace(protection))
Utilities.AppendToDictionary(protections, file, protection);
@@ -242,17 +242,17 @@ namespace BurnOutSharp.FileType
Utilities.AppendToDictionary(protections, subProtections);
// WTM CD Protect
protection = WTMCDProtect.CheckContents(fileContent, scanner.IncludePosition);
protection = new WTMCDProtect().CheckContents(file, fileContent, scanner.IncludePosition);
if (!string.IsNullOrWhiteSpace(protection))
Utilities.AppendToDictionary(protections, file, protection);
// XCP 1/2
protection = XCP.CheckContents(fileContent, scanner.IncludePosition);
protection = new XCP().CheckContents(file, fileContent, scanner.IncludePosition);
if (!string.IsNullOrWhiteSpace(protection))
Utilities.AppendToDictionary(protections, file, protection);
// Xtreme-Protector
protection = XtremeProtector.CheckContents(fileContent, scanner.IncludePosition);
protection = new XtremeProtector().CheckContents(file, fileContent, scanner.IncludePosition);
if (!string.IsNullOrWhiteSpace(protection))
Utilities.AppendToDictionary(protections, file, protection);
@@ -264,32 +264,32 @@ namespace BurnOutSharp.FileType
if (scanner.ScanPackers)
{
// Armadillo
protection = Armadillo.CheckContents(fileContent, scanner.IncludePosition);
protection = new Armadillo().CheckContents(file, fileContent, scanner.IncludePosition);
if (!string.IsNullOrWhiteSpace(protection))
Utilities.AppendToDictionary(protections, file, protection);
// dotFuscator
protection = dotFuscator.CheckContents(fileContent, scanner.IncludePosition);
protection = new dotFuscator().CheckContents(file, fileContent, scanner.IncludePosition);
if (!string.IsNullOrWhiteSpace(protection))
Utilities.AppendToDictionary(protections, file, protection);
// EXE Stealth
protection = EXEStealth.CheckContents(fileContent, scanner.IncludePosition);
protection = new EXEStealth().CheckContents(file, fileContent, scanner.IncludePosition);
if (!string.IsNullOrWhiteSpace(protection))
Utilities.AppendToDictionary(protections, file, protection);
// NSIS
protection = NSIS.CheckContents(fileContent, scanner.IncludePosition);
protection = new NSIS().CheckContents(file, fileContent, scanner.IncludePosition);
if (!string.IsNullOrWhiteSpace(protection))
Utilities.AppendToDictionary(protections, file, protection);
// PE Compact
protection = PECompact.CheckContents(fileContent, scanner.IncludePosition);
protection = new PECompact().CheckContents(file, fileContent, scanner.IncludePosition);
if (!string.IsNullOrWhiteSpace(protection))
Utilities.AppendToDictionary(protections, file, protection);
// UPX
protection = UPX.CheckContents(fileContent, scanner.IncludePosition);
protection = new UPX().CheckContents(file, fileContent, scanner.IncludePosition);
if (!string.IsNullOrWhiteSpace(protection))
Utilities.AppendToDictionary(protections, file, protection);
}

View File

@@ -0,0 +1,14 @@
namespace BurnOutSharp
{
public interface IContentCheck
{
/// <summary>
/// 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="includePosition">True to include positional data, false otherwise</param>
/// <returns>String containing any protections found in the file</returns>
string CheckContents(string file, byte[] fileContent, bool includePosition);
}
}

View File

@@ -1,8 +1,9 @@
namespace BurnOutSharp.PackerType
{
public class Armadillo
public class Armadillo : IContentCheck
{
public static string CheckContents(byte[] fileContent, bool includePosition = false)
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
// ".nicode" + (char)0x00
byte[] check = new byte[] { 0x2E, 0x6E, 0x69, 0x63, 0x6F, 0x64, 0x65, 0x00 };

View File

@@ -1,8 +1,9 @@
namespace BurnOutSharp.PackerType
{
public class EXEStealth
public class EXEStealth : IContentCheck
{
public static string CheckContents(byte[] fileContent, bool includePosition = false)
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
// "??[[__[[_" + (char)0x00 + "{{" + (char)0x0 + (char)0x00 + "{{" + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x0 + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00 + "?;??;??"
byte[] check = new byte[] { 0x3F, 0x3F, 0x5B, 0x5B, 0x5F, 0x5F, 0x5B, 0x5B, 0x5F, 0x00, 0x7B, 0x7B, 0x00, 0x00, 0x7B, 0x7B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x3F, 0x3B, 0x3F, 0x3F, 0x3B, 0x3F, 0x3F };

View File

@@ -4,9 +4,10 @@ using System.Text;
namespace BurnOutSharp.PackerType
{
public class NSIS
public class NSIS : IContentCheck
{
public static string CheckContents(byte[] fileContent, bool includePosition = false)
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
// Nullsoft Install System
byte[] check = new byte[] { 0x4e, 0x75, 0x6c, 0x6c, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x20, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d };

View File

@@ -1,8 +1,9 @@
namespace BurnOutSharp.PackerType
{
public class PECompact
public class PECompact : IContentCheck
{
public static string CheckContents(byte[] fileContent, bool includePosition = false)
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
// "PEC2"
byte[] check = new byte[] { 0x50, 0x45, 0x43, 0x32 };

View File

@@ -2,9 +2,10 @@ using System.Text;
namespace BurnOutSharp.PackerType
{
public class UPX
public class UPX : IContentCheck
{
public static string CheckContents(byte[] fileContent, bool includePosition = false)
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
// UPX!
byte[] check = new byte[] { 0x55, 0x50, 0x58, 0x21 };

View File

@@ -1,8 +1,9 @@
namespace BurnOutSharp.PackerType
{
public class dotFuscator
public class dotFuscator : IContentCheck
{
public static string CheckContents(byte[] fileContent, bool includePosition = false)
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
// "DotfuscatorAttribute"
byte[] check = new byte[] { 0x44, 0x6F, 0x74, 0x66, 0x75, 0x73, 0x63, 0x61, 0x74, 0x6F, 0x72, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65 };

View File

@@ -1,8 +1,9 @@
namespace BurnOutSharp.ProtectionType
{
public class ActiveMARK
public class ActiveMARK : IContentCheck
{
public static string CheckContents(byte[] fileContent, bool includePosition = false)
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
// "TMSAMVOF"
byte[] check = new byte[] { 0x54, 0x4D, 0x53, 0x41, 0x4D, 0x56, 0x4F, 0x46 };

View File

@@ -1,8 +1,9 @@
namespace BurnOutSharp.ProtectionType
{
public class AlphaROM
public class AlphaROM : IContentCheck
{
public static string CheckContents(byte[] fileContent, bool includePosition = false)
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
// "SETTEC"
byte[] check = new byte[] { 0x53, 0x45, 0x54, 0x54, 0x45, 0x43 };

View File

@@ -1,8 +1,9 @@
namespace BurnOutSharp.ProtectionType
{
public class CDCheck
public class CDCheck : IContentCheck
{
public static string CheckContents(byte[] fileContent, bool includePosition = false)
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
// MGS CDCheck
byte[] check = new byte[] { 0x4D, 0x47, 0x53, 0x20, 0x43, 0x44, 0x43, 0x68, 0x65, 0x63, 0x6B };

View File

@@ -5,9 +5,10 @@ using System.Linq;
namespace BurnOutSharp.ProtectionType
{
public class CDCops : IPathCheck
public class CDCops : IContentCheck, IPathCheck
{
public static string CheckContents(byte[] fileContent, bool includePosition = false)
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
// "CD-Cops, ver. "
byte[] check = new byte[] { 0x43, 0x44, 0x2D, 0x43, 0x6F, 0x70, 0x73, 0x2C, 0x20, 0x20, 0x76, 0x65, 0x72, 0x2E, 0x20 };

View File

@@ -5,9 +5,10 @@ using System.Linq;
namespace BurnOutSharp.ProtectionType
{
public class CDLock : IPathCheck
public class CDLock : IContentCheck, IPathCheck
{
public static string CheckContents(byte[] fileContent, bool includePosition = false)
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
// "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"
byte[] check = new byte[] { 0x32, 0xF2, 0x02, 0x82, 0xC3, 0xBC, 0x0B, 0x24, 0x99, 0xAD, 0x27, 0x43, 0xE4, 0x9D, 0x73, 0x74, 0x99, 0xFA, 0x32, 0x24, 0x9D, 0x29, 0x34, 0xFF, 0x74 };

View File

@@ -1,8 +1,9 @@
namespace BurnOutSharp.ProtectionType
{
public class CDSHiELDSE
public class CDSHiELDSE : IContentCheck
{
public static string CheckContents(byte[] fileContent, bool includePosition = false)
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
// "~0017.tmp"
byte[] check = new byte[] { 0x7E, 0x30, 0x30, 0x31, 0x37, 0x2E, 0x74, 0x6D, 0x70 };

View File

@@ -6,9 +6,10 @@ using System.Text;
namespace BurnOutSharp.ProtectionType
{
public class CactusDataShield : IPathCheck
public class CactusDataShield : IContentCheck, IPathCheck
{
public static string CheckContents(byte[] fileContent, bool includePosition = false)
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
// DATA.CDS
byte[] check = new byte[] { 0x44, 0x41, 0x54, 0x41, 0x2E, 0x43, 0x44, 0x53 };

View File

@@ -1,8 +1,9 @@
namespace BurnOutSharp.ProtectionType
{
public class CengaProtectDVD
public class CengaProtectDVD : IContentCheck
{
public static string CheckContents(byte[] fileContent, bool includePosition = false)
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
// ".cenega"
byte[] check = new byte[] { 0x2E, 0x63, 0x65, 0x6E, 0x65, 0x67, 0x61 };

View File

@@ -1,9 +1,10 @@
namespace BurnOutSharp.ProtectionType
{
public class CodeLock
public class CodeLock : IContentCheck
{
// TODO: Verify if these are OR or AND
public static string CheckContents(byte[] fileContent, bool includePosition = false)
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
// "icd1" + (char)0x00
byte[] check = new byte[] { 0x69, 0x63, 0x64, 0x31, 0x00 };

View File

@@ -5,9 +5,10 @@ using System.Linq;
namespace BurnOutSharp.ProtectionType
{
public class CopyKiller : IPathCheck
public class CopyKiller : IContentCheck, IPathCheck
{
public static string CheckContents(byte[] fileContent, bool includePosition = false)
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
// "Tom Commander"
byte[] check = new byte[] { 0x54, 0x6F, 0x6D, 0x20, 0x43, 0x6F, 0x6D, 0x6D, 0x61, 0x6E, 0x64, 0x65, 0x72 };

View File

@@ -3,9 +3,10 @@ using System.Linq;
namespace BurnOutSharp.ProtectionType
{
public class DVDCops
public class DVDCops : IContentCheck
{
public static string CheckContents(byte[] fileContent, bool includePosition = false)
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
// "DVD-Cops, ver. "
byte[] check = new byte[] { 0x44, 0x56, 0x44, 0x2D, 0x43, 0x6F, 0x70, 0x73, 0x2C, 0x20, 0x20, 0x76, 0x65, 0x72, 0x2E, 0x20 };

View File

@@ -1,12 +1,13 @@
namespace BurnOutSharp.ProtectionType
{
public class ElectronicArts
public class ElectronicArts : IContentCheck
{
// TODO: Verify this doesn't over-match
// TODO: Do more research into the Cucko protection:
// - 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 static string CheckContents(string file, byte[] fileContent, bool includePosition = false)
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
// EASTL
// byte[] check = new byte[] { 0x45, 0x41, 0x53, 0x54, 0x4C };

View File

@@ -5,9 +5,10 @@ using System.Linq;
namespace BurnOutSharp.ProtectionType
{
public class GFWL : IPathCheck
public class GFWL : IContentCheck, IPathCheck
{
public static string CheckContents(byte[] fileContent, bool includePosition = false)
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
// "xlive.dll"
byte[] check = new byte[] { 0x78, 0x6C, 0x69, 0x76, 0x65, 0x2E, 0x64, 0x6C, 0x6C };

View File

@@ -5,9 +5,10 @@ using System.Linq;
namespace BurnOutSharp.ProtectionType
{
public class ImpulseReactor : IPathCheck
public class ImpulseReactor : IContentCheck, IPathCheck
{
public static string CheckContents(string file, byte[] fileContent, bool includePosition = false)
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
// "CVPInitializeClient"
byte[] check = new byte[] { 0x43, 0x56, 0x50, 0x49, 0x6E, 0x69, 0x74, 0x69, 0x61, 0x6C, 0x69, 0x7A, 0x65, 0x43, 0x6C, 0x69, 0x65, 0x6E, 0x74 };

View File

@@ -3,11 +3,12 @@ using System.Linq;
namespace BurnOutSharp.ProtectionType
{
public class InnoSetup
public class InnoSetup : IContentCheck
{
// TOOO: Add Inno Setup extraction
// https://github.com/dscharrer/InnoExtract
public static string CheckContents(byte[] fileContent, bool includePosition = false)
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
// "Inno"
byte[] check = new byte[] { 0x49, 0x6E, 0x6E, 0x6F };

View File

@@ -1,6 +1,6 @@
namespace BurnOutSharp.ProtectionType
{
public class Intenium
public class Intenium : IContentCheck
{
/*
* Possible strings for finding INTENIUM Trial & Buy Protection
@@ -18,7 +18,8 @@
* - NO NESTED PRMS SUPPORTED - 4E 4F 20 4E 45 53 54 45 44 20 50 52 4D 53 20 53 55 50 50 4F 52 54 45 44
*/
public static string CheckContents(byte[] fileContent, bool includePosition = false)
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
// Trial + (char)0x00 + P
byte[] check = new byte[] { 0x54, 0x72, 0x69, 0x61, 0x6C, 0x00, 0x50 };

View File

@@ -3,9 +3,10 @@ using System.Linq;
namespace BurnOutSharp.ProtectionType
{
public class JoWooDXProt
public class JoWooDXProt : IContentCheck
{
public static string CheckContents(byte[] fileContent, bool includePosition = false)
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
// ".ext "
byte[] check = new byte[] { 0x2E, 0x65, 0x78, 0x74, 0x20, 0x20, 0x20, 0x20 };

View File

@@ -1,8 +1,9 @@
namespace BurnOutSharp.ProtectionType
{
public class KeyLock
public class KeyLock : IContentCheck
{
public static string CheckContents(byte[] fileContent, bool includePosition = false)
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
// "KEY-LOCK COMMAND"
byte[] check = new byte[] { 0x4B, 0x45, 0x59, 0x2D, 0x4C, 0x4F, 0x43, 0x4B, 0x20, 0x43, 0x4F, 0x4D, 0x4D, 0x41, 0x4E, 0x44 };

View File

@@ -5,9 +5,10 @@ using System.Linq;
namespace BurnOutSharp.ProtectionType
{
public class LaserLock : IPathCheck
public class LaserLock : IContentCheck, IPathCheck
{
public static string CheckContents(string file, byte[] fileContent, bool includePosition = false)
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = 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 };

View File

@@ -5,9 +5,10 @@ using System.Linq;
namespace BurnOutSharp.ProtectionType
{
public class MediaMaxCD3 : IPathCheck
public class MediaMaxCD3 : IContentCheck, IPathCheck
{
public static string CheckContents(byte[] fileContent, bool includePosition = false)
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
// Cd3Ctl
byte[] check = new byte[] { 0x43, 0x64, 0x33, 0x43, 0x74, 0x6C };

View File

@@ -5,9 +5,10 @@ using System.Linq;
namespace BurnOutSharp.ProtectionType
{
public class Origin : IPathCheck
public class Origin : IContentCheck, IPathCheck
{
public static string CheckContents(byte[] fileContent, bool includePosition = false)
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
// 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
byte[] check = 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 };

View File

@@ -1,20 +1,21 @@
namespace BurnOutSharp.ProtectionType
{
public class PSXAntiModchip
public class PSXAntiModchip : IContentCheck
{
// TODO: Figure out PSX binary header so this can be checked explicitly
// TODO: Detect Red Hand protection
public static string CheckContents(byte[] fileContent)
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
// " SOFTWARE TERMINATED\nCONSOLE MAY HAVE BEEN MODIFIED\n CALL 1-888-780-7690"
byte[] check = new byte[] { 0x20, 0x20, 0x20, 0x20, 0x20, 0x53, 0x4F, 0x46, 0x54, 0x57, 0x41, 0x52, 0x45, 0x20, 0x54, 0x45, 0x52, 0x4D, 0x49, 0x4E, 0x41, 0x54, 0x45, 0x44, 0x5C, 0x6E, 0x43, 0x4F, 0x4E, 0x53, 0x4F, 0x4C, 0x45, 0x20, 0x4D, 0x41, 0x59, 0x20, 0x48, 0x41, 0x56, 0x45, 0x20, 0x42, 0x45, 0x45, 0x4E, 0x20, 0x4D, 0x4F, 0x44, 0x49, 0x46, 0x49, 0x45, 0x44, 0x5C, 0x6E, 0x20, 0x20, 0x20, 0x20, 0x20, 0x43, 0x41, 0x4C, 0x4C, 0x20, 0x31, 0x2D, 0x38, 0x38, 0x38, 0x2D, 0x37, 0x38, 0x30, 0x2D, 0x37, 0x36, 0x39, 0x30 };
if (fileContent.Contains(check, out int position))
return $"PlayStation Anti-modchip (English) (Index {position})";
return $"PlayStation Anti-modchip (English)" + (includePosition ? $"(Index {position})" : string.Empty);
// "強制終了しました。\n本体が改造されている\nおそれがあります。"
check = new byte[] { 0x5F, 0x37, 0x52, 0x36, 0x7D, 0x42, 0x4E, 0x86, 0x30, 0x57, 0x30, 0x7E, 0x30, 0x57, 0x30, 0x5F, 0x30, 0x02, 0x5C, 0x6E, 0x67, 0x2C, 0x4F, 0x53, 0x30, 0x4C, 0x65, 0x39, 0x90, 0x20, 0x30, 0x55, 0x30, 0x8C, 0x30, 0x66, 0x30, 0x44, 0x30, 0x8B, 0x5C, 0x6E, 0x30, 0x4A, 0x30, 0x5D, 0x30, 0x8C, 0x30, 0x4C, 0x30, 0x42, 0x30, 0x8A, 0x30, 0x7E, 0x30, 0x59, 0x30, 0x02 };
if (fileContent.Contains(check, out position))
return $"PlayStation Anti-modchip (Japanese) (Index {position})";
return $"PlayStation Anti-modchip (Japanese)" + (includePosition ? $"(Index {position})" : string.Empty);
return null;
}

View File

@@ -6,9 +6,10 @@ using System.Threading;
namespace BurnOutSharp.ProtectionType
{
public class ProtectDisc
public class ProtectDisc : IContentCheck
{
public static string CheckContents(string file, byte[] fileContent, bool includePosition = false)
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
// "HúMETINF"
byte[] check = new byte[] { 0x48, 0xFA, 0x4D, 0x45, 0x54, 0x49, 0x4E, 0x46 };

View File

@@ -1,8 +1,9 @@
namespace BurnOutSharp.ProtectionType
{
public class RingPROTECH
public class RingPROTECH : IContentCheck
{
public static string CheckContents(byte[] fileContent, bool includePosition = false)
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
// (char)0x00 + "Allocator" + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00
byte[] check = new byte[] { 0x00, 0x41, 0x6C, 0x6C, 0x6F, 0x63, 0x61, 0x74, 0x6F, 0x72, 0x00, 0x00, 0x00, 0x00 };

View File

@@ -1,8 +1,9 @@
namespace BurnOutSharp.ProtectionType
{
public class SVKProtector
public class SVKProtector : IContentCheck
{
public static string CheckContents(byte[] fileContent, bool includePosition = false)
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
// "?SVKP" + (char)0x00 + (char)0x00
byte[] check = new byte[] { 0x3F, 0x53, 0x56, 0x4B, 0x50, 0x00, 0x00 };

View File

@@ -7,9 +7,10 @@ using System.Text;
namespace BurnOutSharp.ProtectionType
{
public class SafeDisc : IPathCheck
public class SafeDisc : IContentCheck, IPathCheck
{
public static string CheckContents(string file, byte[] fileContent, bool includePosition = false)
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
// "BoG_ *90.0&!! Yy>"
byte[] check = new byte[] { 0x42, 0x6F, 0x47, 0x5F, 0x20, 0x2A, 0x39, 0x30, 0x2E, 0x30, 0x26, 0x21, 0x21, 0x20, 0x20, 0x59, 0x79, 0x3E };

View File

@@ -5,9 +5,10 @@ using System.Linq;
namespace BurnOutSharp.ProtectionType
{
public class SafeLock : IPathCheck
public class SafeLock : IContentCheck, IPathCheck
{
public static string CheckContents(byte[] fileContent, bool includePosition = false)
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
// "SafeLock"
byte[] check = new byte[] { 0x53, 0x61, 0x66, 0x65, 0x4C, 0x6F, 0x63, 0x6B };

View File

@@ -6,9 +6,10 @@ using System.Text;
namespace BurnOutSharp.ProtectionType
{
public class SecuROM : IPathCheck
public class SecuROM : IContentCheck, IPathCheck
{
public static string CheckContents(string file, byte[] fileContent, bool includePosition = false)
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
// "AddD" + (char)0x03 + (char)0x00 + (char)0x00 + (char)0x00)
byte[] check = new byte[] { 0x41, 0x64, 0x64, 0x44, 0x03, 0x00, 0x00, 0x00 };

View File

@@ -5,9 +5,10 @@ using System.Linq;
namespace BurnOutSharp.ProtectionType
{
public class SmartE : IPathCheck
public class SmartE : IContentCheck, IPathCheck
{
public static string CheckContents(byte[] fileContent, bool includePosition = false)
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
// BITARTS
byte[] check = new byte[] { 0x42, 0x49, 0x54, 0x41, 0x52, 0x54, 0x53 };

View File

@@ -6,9 +6,10 @@ using System.Linq;
namespace BurnOutSharp.ProtectionType
{
public class SolidShield : IPathCheck
public class SolidShield : IContentCheck, IPathCheck
{
public static string CheckContents(string file, byte[] fileContent, bool includePosition = false)
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
// "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"
byte[] check = new byte[] { 0x44, 0x00, 0x56, 0x00, 0x4D, 0x00, 0x20, 0x00, 0x4C, 0x00, 0x69, 0x00, 0x62, 0x00, 0x72, 0x00, 0x61, 0x00, 0x72, 0x00, 0x79 };

View File

@@ -5,9 +5,10 @@ using System.Linq;
namespace BurnOutSharp.ProtectionType
{
public class StarForce : IPathCheck
public class StarForce : IContentCheck, IPathCheck
{
public static string CheckContents(string file, byte[] fileContent, bool includePosition = false)
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
// "(" + (char)0x00 + "c" + (char)0x00 + ")" + (char)0x00 + " " + (char)0x00 + "P" + (char)0x00 + "r" + (char)0x00 + "o" + (char)0x00 + "t" + (char)0x00 + "e" + (char)0x00 + "c" + (char)0x00 + "t" + (char)0x00 + "i" + (char)0x00 + "o" + (char)0x00 + "n" + (char)0x00 + " " + (char)0x00 + "T" + (char)0x00 + "e" + (char)0x00 + "c" + (char)0x00 + "h" + (char)0x00 + "n" + (char)0x00 + "o" + (char)0x00 + "l" + (char)0x00 + "o" + (char)0x00 + "g" + (char)0x00 + "y" + (char)0x00
byte[] check = new byte[] { 0x28, 0x00, 0x63, 0x00, 0x29, 0x00, 0x20, 0x00, 0x50, 0x00, 0x72, 0x00, 0x6F, 0x00, 0x74, 0x00, 0x65, 0x00, 0x63, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x20, 0x00, 0x54, 0x00, 0x65, 0x00, 0x63, 0x00, 0x68, 0x00, 0x6E, 0x00, 0x6F, 0x00, 0x6C, 0x00, 0x6F, 0x00, 0x67, 0x00, 0x79, 0x00 };

View File

@@ -1,8 +1,9 @@
namespace BurnOutSharp.ProtectionType
{
public class Sysiphus
public class Sysiphus : IContentCheck
{
public static string CheckContents(byte[] fileContent, bool includePosition = false)
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
// "V SUHPISYSDVD"
byte[] check = new byte[] { 0x56, 0x20, 0x53, 0x55, 0x48, 0x50, 0x49, 0x53, 0x59, 0x53, 0x44, 0x56, 0x44 };

View File

@@ -5,9 +5,10 @@ using System.Linq;
namespace BurnOutSharp.ProtectionType
{
public class Tages : IPathCheck
public class Tages : IContentCheck, IPathCheck
{
public static string CheckContents(string file, byte[] fileContent, bool includePosition = false)
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
// "protected-tages-runtime.exe"
byte[] check = new byte[] { 0x70, 0x72, 0x6F, 0x74, 0x65, 0x63, 0x74, 0x65, 0x64, 0x2D, 0x74, 0x61, 0x67, 0x65, 0x73, 0x2D, 0x72, 0x75, 0x6E, 0x74, 0x69, 0x6D, 0x65, 0x2E, 0x65, 0x78, 0x65 };

View File

@@ -1,8 +1,9 @@
namespace BurnOutSharp.ProtectionType
{
public class ThreePLock
public class ThreePLock : IContentCheck
{
public static string CheckContents(byte[] fileContent, bool includePosition = false)
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
// .ldr
byte[] check = new byte[] { 0x2E, 0x6C, 0x64, 0x72 };

View File

@@ -1,8 +1,9 @@
namespace BurnOutSharp.ProtectionType
{
public class ThreeTwoOneStudios
public class ThreeTwoOneStudios : IContentCheck
{
public static string CheckContents(byte[] fileContent, bool includePosition = false)
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
// 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
byte[] check = new byte[] { 0x33, 0x00, 0x32, 0x00, 0x31, 0x00, 0x53, 0x00, 0x74, 0x00, 0x75, 0x00, 0x64, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x73, 0x00, 0x20, 0x00, 0x41, 0x00, 0x63, 0x00, 0x74, 0x00, 0x69, 0x00, 0x76, 0x00, 0x61, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00 };

View File

@@ -7,9 +7,10 @@ using System.Threading;
namespace BurnOutSharp.ProtectionType
{
public class VOBProtectCDDVD : IPathCheck
public class VOBProtectCDDVD : IContentCheck, IPathCheck
{
public static string CheckContents(string file, byte[] fileContent, bool includePosition = false)
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
// "VOB ProtectCD"
byte[] check = new byte[] { 0x56, 0x4F, 0x42, 0x20, 0x50, 0x72, 0x6F, 0x74, 0x65, 0x63, 0x74, 0x43, 0x44 };

View File

@@ -5,9 +5,10 @@ using System.Linq;
namespace BurnOutSharp.ProtectionType
{
public class WTMCDProtect : IPathCheck
public class WTMCDProtect : IContentCheck, IPathCheck
{
public static string CheckContents(byte[] fileContent, bool includePosition = false)
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
// "WTM76545"
byte[] check = new byte[] { 0x57, 0x54, 0x4D, 0x37, 0x36, 0x35, 0x34, 0x35 };

View File

@@ -6,9 +6,10 @@ using BurnOutSharp.FileType;
namespace BurnOutSharp.ProtectionType
{
public class XCP : IPathCheck
public class XCP : IContentCheck, IPathCheck
{
public static string CheckContents(byte[] fileContent, bool includePosition = false)
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
// XCP.DAT
byte[] check = new byte[] { 0x58, 0x43, 0x50, 0x2E, 0x44, 0x41, 0x54 };

View File

@@ -1,8 +1,9 @@
namespace BurnOutSharp.ProtectionType
{
public class XtremeProtector
public class XtremeProtector : IContentCheck
{
public static string CheckContents(byte[] fileContent, bool includePosition = false)
/// <inheritdoc/>
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
// "XPROT "
byte[] check = new byte[] { 0x58, 0x50, 0x52, 0x4F, 0x54, 0x20, 0x20, 0x20 };