Make protection location optional (default off)

This commit is contained in:
Matt Nadareski
2020-09-10 21:43:18 -07:00
parent c4f8fa4b0d
commit 0c137e97f0
54 changed files with 224 additions and 219 deletions

View File

@@ -17,7 +17,7 @@ namespace BurnOutSharp.FileType
return false;
}
public static List<string> Scan(Stream stream)
public static List<string> Scan(Stream stream, bool includePosition = false)
{
List<string> protections = new List<string>();
@@ -88,7 +88,7 @@ namespace BurnOutSharp.FileType
}
}
string protection = ProtectionFind.ScanContent(tempFile);
string protection = ProtectionFind.ScanContent(tempFile, includePosition);
// If tempfile cleanup fails
try

View File

@@ -16,7 +16,7 @@ namespace BurnOutSharp.FileType
return false;
}
public static List<string> Scan(Stream stream)
public static List<string> Scan(Stream stream, bool includePosition = false)
{
List<string> protections = new List<string>();
@@ -37,7 +37,7 @@ namespace BurnOutSharp.FileType
bz2File.CopyTo(fs);
}
string protection = ProtectionFind.ScanContent(tempfile);
string protection = ProtectionFind.ScanContent(tempfile, includePosition);
// If tempfile cleanup fails
try

View File

@@ -40,7 +40,7 @@ namespace BurnOutSharp.FileType
return false;
}
public static List<string> Scan(Stream stream, string file)
public static List<string> Scan(Stream stream, string file = null, bool includePosition = false)
{
// Load the current file content
byte[] fileContent = null;
@@ -59,192 +59,192 @@ namespace BurnOutSharp.FileType
string protection;
// 3PLock
protection = ThreePLock.CheckContents(fileContent);
protection = ThreePLock.CheckContents(fileContent, includePosition);
if (!string.IsNullOrWhiteSpace(protection))
protections.Add(protection);
// ActiveMARK
protection = ActiveMARK.CheckContents(fileContent);
protection = ActiveMARK.CheckContents(fileContent, includePosition);
if (!string.IsNullOrWhiteSpace(protection))
protections.Add(protection);
// Alpha-ROM
protection = AlphaROM.CheckContents(fileContent);
protection = AlphaROM.CheckContents(fileContent, includePosition);
if (!string.IsNullOrWhiteSpace(protection))
protections.Add(protection);
// Armadillo
protection = Armadillo.CheckContents(fileContent);
protection = Armadillo.CheckContents(fileContent, includePosition);
if (!string.IsNullOrWhiteSpace(protection))
protections.Add(protection);
// CD-Cops
protection = CDCops.CheckContents(fileContent);
protection = CDCops.CheckContents(fileContent, includePosition);
if (!string.IsNullOrWhiteSpace(protection))
protections.Add(protection);
// CD-Lock
protection = CDLock.CheckContents(fileContent);
protection = CDLock.CheckContents(fileContent, includePosition);
if (!string.IsNullOrWhiteSpace(protection))
protections.Add(protection);
// CDSHiELD SE
protection = CDSHiELDSE.CheckContents(fileContent);
protection = CDSHiELDSE.CheckContents(fileContent, includePosition);
if (!string.IsNullOrWhiteSpace(protection))
protections.Add(protection);
// CD Check
protection = CDCheck.CheckContents(fileContent);
protection = CDCheck.CheckContents(fileContent, includePosition);
if (!string.IsNullOrWhiteSpace(protection))
protections.Add(protection);
// Cenega ProtectDVD
protection = CengaProtectDVD.CheckContents(fileContent);
protection = CengaProtectDVD.CheckContents(fileContent, includePosition);
if (!string.IsNullOrWhiteSpace(protection))
protections.Add(protection);
// Code Lock
protection = CodeLock.CheckContents(fileContent);
protection = CodeLock.CheckContents(fileContent, includePosition);
if (!string.IsNullOrWhiteSpace(protection))
protections.Add(protection);
// CopyKiller
protection = CopyKiller.CheckContents(fileContent);
protection = CopyKiller.CheckContents(fileContent, includePosition);
if (!string.IsNullOrWhiteSpace(protection))
protections.Add(protection);
// Cucko (EA Custom)
protection = Cucko.CheckContents(fileContent);
protection = Cucko.CheckContents(fileContent, includePosition);
if (!string.IsNullOrWhiteSpace(protection))
protections.Add(protection);
// dotFuscator
protection = dotFuscator.CheckContents(fileContent);
protection = dotFuscator.CheckContents(fileContent, includePosition);
if (!string.IsNullOrWhiteSpace(protection))
protections.Add(protection);
// DVD-Cops
protection = DVDCops.CheckContents(fileContent);
protection = DVDCops.CheckContents(fileContent, includePosition);
if (!string.IsNullOrWhiteSpace(protection))
protections.Add(protection);
// EA CdKey Registration Module
protection = EACdKey.CheckContents(fileContent);
protection = EACdKey.CheckContents(fileContent, includePosition);
if (!string.IsNullOrWhiteSpace(protection))
protections.Add(protection);
// EXE Stealth
protection = EXEStealth.CheckContents(fileContent);
protection = EXEStealth.CheckContents(fileContent, includePosition);
if (!string.IsNullOrWhiteSpace(protection))
protections.Add(protection);
// Games for Windows - Live
protection = GFWL.CheckContents(fileContent);
protection = GFWL.CheckContents(fileContent, includePosition);
if (!string.IsNullOrWhiteSpace(protection))
protections.Add(protection);
// Impulse Reactor
protection = ImpulseReactor.CheckContents(file, fileContent);
protection = ImpulseReactor.CheckContents(file, fileContent, includePosition);
if (!string.IsNullOrWhiteSpace(protection))
protections.Add(protection);
// Inno Setup
protection = InnoSetup.CheckContents(fileContent);
protection = InnoSetup.CheckContents(fileContent, includePosition);
if (!string.IsNullOrWhiteSpace(protection))
protections.Add(protection);
// JoWooD X-Prot
protection = JoWooDXProt.CheckContents(fileContent);
protection = JoWooDXProt.CheckContents(fileContent, includePosition);
if (!string.IsNullOrWhiteSpace(protection))
protections.Add(protection);
// Key-Lock (Dongle)
protection = KeyLock.CheckContents(fileContent);
protection = KeyLock.CheckContents(fileContent, includePosition);
if (!string.IsNullOrWhiteSpace(protection))
protections.Add(protection);
// LaserLock
protection = LaserLock.CheckContents(file, fileContent);
protection = LaserLock.CheckContents(file, fileContent, includePosition);
if (!string.IsNullOrWhiteSpace(protection))
protections.Add(protection);
// PE Compact
protection = PECompact.CheckContents(fileContent);
protection = PECompact.CheckContents(fileContent, includePosition);
if (!string.IsNullOrWhiteSpace(protection))
protections.Add(protection);
// ProtectDisc
protection = ProtectDisc.CheckContents(file, fileContent);
protection = ProtectDisc.CheckContents(file, fileContent, includePosition);
if (!string.IsNullOrWhiteSpace(protection))
protections.Add(protection);
// Ring PROTECH
protection = RingPROTECH.CheckContents(fileContent);
protection = RingPROTECH.CheckContents(fileContent, includePosition);
if (!string.IsNullOrWhiteSpace(protection))
protections.Add(protection);
// SafeDisc / SafeCast
protection = SafeDisc.CheckContents(file, fileContent);
protection = SafeDisc.CheckContents(file, fileContent, includePosition);
if (!string.IsNullOrWhiteSpace(protection))
protections.Add(protection);
// SafeLock
protection = SafeLock.CheckContents(fileContent);
protection = SafeLock.CheckContents(fileContent, includePosition);
if (!string.IsNullOrWhiteSpace(protection))
protections.Add(protection);
// SecuROM
protection = SecuROM.CheckContents(file, fileContent);
protection = SecuROM.CheckContents(file, fileContent, includePosition);
if (!string.IsNullOrWhiteSpace(protection))
protections.Add(protection);
// SmartE
protection = SmartE.CheckContents(fileContent);
protection = SmartE.CheckContents(fileContent, includePosition);
if (!string.IsNullOrWhiteSpace(protection))
protections.Add(protection);
// SolidShield
protection = SolidShield.CheckContents(file, fileContent);
protection = SolidShield.CheckContents(file, fileContent, includePosition);
if (!string.IsNullOrWhiteSpace(protection))
protections.Add(protection);
// StarForce
protection = StarForce.CheckContents(file, fileContent);
protection = StarForce.CheckContents(file, fileContent, includePosition);
if (!string.IsNullOrWhiteSpace(protection))
protections.Add(protection);
// SVK Protector
protection = SVKProtector.CheckContents(fileContent);
protection = SVKProtector.CheckContents(fileContent, includePosition);
if (!string.IsNullOrWhiteSpace(protection))
protections.Add(protection);
// Sysiphus / Sysiphus DVD
protection = Sysiphus.CheckContents(fileContent);
protection = Sysiphus.CheckContents(fileContent, includePosition);
if (!string.IsNullOrWhiteSpace(protection))
protections.Add(protection);
// TAGES
protection = Tages.CheckContents(file, fileContent);
protection = Tages.CheckContents(file, fileContent, includePosition);
if (!string.IsNullOrWhiteSpace(protection))
protections.Add(protection);
// VOB ProtectCD/DVD
protection = VOBProtectCDDVD.CheckContents(file, fileContent);
protection = VOBProtectCDDVD.CheckContents(file, fileContent, includePosition);
if (!string.IsNullOrWhiteSpace(protection))
protections.Add(protection);
// Wise Installer
subProtections = WiseInstaller.CheckContents(file, fileContent);
subProtections = WiseInstaller.CheckContents(file, fileContent, includePosition);
if (subProtections != null && subProtections.Count > 0)
protections.AddRange(subProtections);
// WTM CD Protect
protection = WTMCDProtect.CheckContents(fileContent);
protection = WTMCDProtect.CheckContents(fileContent, includePosition);
if (!string.IsNullOrWhiteSpace(protection))
protections.Add(protection);
// Xtreme-Protector
protection = XtremeProtector.CheckContents(fileContent);
protection = XtremeProtector.CheckContents(fileContent, includePosition);
if (!string.IsNullOrWhiteSpace(protection))
protections.Add(protection);

View File

@@ -16,7 +16,7 @@ namespace BurnOutSharp.FileType
return false;
}
public static List<string> Scan(Stream stream)
public static List<string> Scan(Stream stream, bool includePosition = false)
{
List<string> protections = new List<string>();
@@ -39,7 +39,7 @@ namespace BurnOutSharp.FileType
string tempfile = Path.Combine(tempPath, entry.Key);
entry.WriteToFile(tempfile);
string protection = ProtectionFind.ScanContent(tempfile);
string protection = ProtectionFind.ScanContent(tempfile, includePosition);
// If tempfile cleanup fails
try

View File

@@ -17,7 +17,7 @@ namespace BurnOutSharp.FileType
}
// TODO: Add stream opening support
public static List<string> Scan(string file)
public static List<string> Scan(string file, bool includePosition = false)
{
List<string> protections = new List<string>();
@@ -50,7 +50,7 @@ namespace BurnOutSharp.FileType
string tempFile = Path.Combine(tempPath, cabfile.FileName(i));
if (cabfile.FileSave(i, tempFile))
{
string protection = ProtectionFind.ScanContent(tempFile);
string protection = ProtectionFind.ScanContent(tempFile, includePosition);
// If tempfile cleanup fails
try

View File

@@ -16,7 +16,7 @@ namespace BurnOutSharp.FileType
}
// TODO: Add stream opening support
public static List<string> Scan(string file)
public static List<string> Scan(string file, bool includePosition = false)
{
List<string> protections = new List<string>();
@@ -47,7 +47,7 @@ namespace BurnOutSharp.FileType
string tempfile = Path.Combine(tempPath, sub);
Directory.CreateDirectory(Path.GetDirectoryName(tempfile));
mpqArchive.ExtractFile(sub, tempfile);
string protection = ProtectionFind.ScanContent(tempfile);
string protection = ProtectionFind.ScanContent(tempfile, includePosition);
// If tempfile cleanup fails
try

View File

@@ -16,7 +16,7 @@ namespace BurnOutSharp.FileType
}
// TODO: Add stream opening support
public static List<string> Scan(string file)
public static List<string> Scan(string file, bool includePosition = false)
{
List<string> protections = new List<string>();
@@ -35,7 +35,7 @@ namespace BurnOutSharp.FileType
{
string tempfile = Path.Combine(tempPath, sub.Filename);
sub.ExtractTo(tempfile);
string protection = ProtectionFind.ScanContent(tempfile);
string protection = ProtectionFind.ScanContent(tempfile, includePosition);
// If tempfile cleanup fails
try

View File

@@ -25,7 +25,7 @@ namespace BurnOutSharp.FileType
return false;
}
public static List<string> Scan(Stream stream)
public static List<string> Scan(Stream stream, bool includePosition = false)
{
List<string> protections = new List<string>();
@@ -48,7 +48,7 @@ namespace BurnOutSharp.FileType
string tempfile = Path.Combine(tempPath, entry.Key);
entry.WriteToFile(tempfile);
string protection = ProtectionFind.ScanContent(tempfile);
string protection = ProtectionFind.ScanContent(tempfile, includePosition);
// If tempfile cleanup fails
try

View File

@@ -21,7 +21,7 @@ namespace BurnOutSharp.FileType
return false;
}
public static List<string> Scan(Stream stream)
public static List<string> Scan(Stream stream, bool includePosition = false)
{
List<string> protections = new List<string>();
@@ -44,7 +44,7 @@ namespace BurnOutSharp.FileType
string tempfile = Path.Combine(tempPath, entry.Key);
entry.WriteToFile(tempfile);
string protection = ProtectionFind.ScanContent(tempfile);
string protection = ProtectionFind.ScanContent(tempfile, includePosition);
// If tempfile cleanup fails
try

View File

@@ -16,7 +16,7 @@ namespace BurnOutSharp.FileType
return false;
}
public static List<string> Scan(Stream stream)
public static List<string> Scan(Stream stream, bool includePosition = false)
{
List<string> protections = new List<string>();
@@ -39,7 +39,7 @@ namespace BurnOutSharp.FileType
string tempfile = Path.Combine(tempPath, entry.Key);
entry.WriteToFile(tempfile);
string protection = ProtectionFind.ScanContent(tempfile);
string protection = ProtectionFind.ScanContent(tempfile, includePosition);
// If tempfile cleanup fails
try

View File

@@ -19,7 +19,7 @@ namespace BurnOutSharp.FileType
return false;
}
public static List<string> Scan(Stream stream)
public static List<string> Scan(Stream stream, bool includePosition = false)
{
List<string> protections = new List<string>();
@@ -42,7 +42,7 @@ namespace BurnOutSharp.FileType
string tempfile = Path.Combine(tempPath, entry.Key);
entry.WriteToFile(tempfile);
string protection = ProtectionFind.ScanContent(tempfile);
string protection = ProtectionFind.ScanContent(tempfile, includePosition);
// If tempfile cleanup fails
try

View File

@@ -32,7 +32,7 @@ namespace BurnOutSharp.FileType
return false;
}
public static List<string> Scan(Stream stream)
public static List<string> Scan(Stream stream, bool includePosition = false)
{
List<string> protections = new List<string>();

View File

@@ -33,7 +33,7 @@ namespace BurnOutSharp.FileType
}
// TODO: Add stream opening support
public static List<string> Scan(string file)
public static List<string> Scan(string file, bool includePosition = false)
{
List<string> protections = new List<string>();
@@ -55,7 +55,7 @@ namespace BurnOutSharp.FileType
{
foreach (string tempFile in Directory.EnumerateFiles(tempPath, "*", SearchOption.AllDirectories))
{
string protection = ProtectionFind.ScanContent(tempFile);
string protection = ProtectionFind.ScanContent(tempFile, includePosition);
// If tempfile cleanup fails
try

View File

@@ -15,7 +15,7 @@ namespace BurnOutSharp.FileType
return false;
}
public static List<string> Scan(Stream stream)
public static List<string> Scan(Stream stream, bool includePosition = false)
{
List<string> protections = new List<string>();
@@ -36,7 +36,7 @@ namespace BurnOutSharp.FileType
xzFile.CopyTo(fs);
}
string protection = ProtectionFind.ScanContent(tempfile);
string protection = ProtectionFind.ScanContent(tempfile, includePosition);
// If tempfile cleanup fails
try

View File

@@ -34,7 +34,7 @@ namespace BurnOutSharp
/// <param name="path">Path to scan for protection(s)</param>
/// <param name="progress">Optional progress indicator that will return a float in the range from 0 to 1</param>
/// <returns>Dictionary of filename to protection mappings, if possible</returns>
public static Dictionary<string, string> Scan(string path, IProgress<FileProtection> progress = null)
public static Dictionary<string, string> Scan(string path, bool includePosition = false, IProgress<FileProtection> progress = null)
{
var protections = new Dictionary<string, string>();
@@ -50,7 +50,7 @@ namespace BurnOutSharp
protections[path] = fileProtection;
// Now check to see if the file contains any additional information
string contentProtection = ScanContent(path)?.Replace("" + (char)0x00, "");
string contentProtection = ScanContent(path, includePosition)?.Replace("" + (char)0x00, "");
if (!string.IsNullOrWhiteSpace(contentProtection))
{
if (protections.ContainsKey(path))
@@ -85,7 +85,7 @@ namespace BurnOutSharp
protections[file] = fileProtection;
// Now check to see if the file contains any additional information
string contentProtection = ScanContent(file)?.Replace("" + (char)0x00, "");
string contentProtection = ScanContent(file, includePosition)?.Replace("" + (char)0x00, "");
if (!string.IsNullOrWhiteSpace(contentProtection))
{
if (protections.ContainsKey(file))
@@ -343,15 +343,18 @@ namespace BurnOutSharp
return string.Join(", ", protections);
}
// TODO: Make `includePosition` optional in the two methods below
/// <summary>
/// Scan an individual file for copy protection
/// </summary>
/// <param name="file">File path for scanning</param>
public static string ScanContent(string file)
/// <param name="includePosition">True to include scanned copy protection position, false otherwise (default)</param>
public static string ScanContent(string file, bool includePosition = false)
{
using (FileStream fs = File.OpenRead(file))
{
return ScanContent(fs, file);
return ScanContent(fs, file, includePosition);
}
}
@@ -360,7 +363,8 @@ namespace BurnOutSharp
/// </summary>
/// <param name="stream">Generic stream to scan</param>
/// <param name="file">File path to be used for name checks (optional)</param>
public static string ScanContent(Stream stream, string file = null)
/// <param name="includePosition">True to include scanned copy protection position, false otherwise (default)</param>
public static string ScanContent(Stream stream, string file = null, bool includePosition = false)
{
// Get the extension for certain checks
string extension = Path.GetExtension(file).ToLower().TrimStart('.');
@@ -383,59 +387,59 @@ namespace BurnOutSharp
// 7-Zip archive
if (SevenZip.ShouldScan(magic))
protections.AddRange(SevenZip.Scan(stream));
protections.AddRange(SevenZip.Scan(stream, includePosition));
// BFPK archive
if (BFPK.ShouldScan(magic))
protections.AddRange(BFPK.Scan(stream));
protections.AddRange(BFPK.Scan(stream, includePosition));
// BZip2
if (BZip2.ShouldScan(magic))
protections.AddRange(BZip2.Scan(stream));
protections.AddRange(BZip2.Scan(stream, includePosition));
// Executable
if (Executable.ShouldScan(magic))
protections.AddRange(Executable.Scan(stream, file));
protections.AddRange(Executable.Scan(stream, file, includePosition));
// GZIP
if (GZIP.ShouldScan(magic))
protections.AddRange(GZIP.Scan(stream));
protections.AddRange(GZIP.Scan(stream, includePosition));
// InstallShield Cabinet
if (file != null && InstallShieldCAB.ShouldScan(magic))
protections.AddRange(InstallShieldCAB.Scan(file));
protections.AddRange(InstallShieldCAB.Scan(file, includePosition));
// Microsoft Cabinet
if (file != null && MicrosoftCAB.ShouldScan(magic))
protections.AddRange(MicrosoftCAB.Scan(file));
protections.AddRange(MicrosoftCAB.Scan(file, includePosition));
// MPQ archive
if (file != null && MPQ.ShouldScan(magic))
protections.AddRange(MPQ.Scan(file));
protections.AddRange(MPQ.Scan(file, includePosition));
// PKZIP archive (and derivatives)
if (PKZIP.ShouldScan(magic))
protections.AddRange(PKZIP.Scan(stream));
protections.AddRange(PKZIP.Scan(stream, includePosition));
// RAR archive
if (RAR.ShouldScan(magic))
protections.AddRange(RAR.Scan(stream));
protections.AddRange(RAR.Scan(stream, includePosition));
// Tape Archive
if (TapeArchive.ShouldScan(magic))
protections.AddRange(TapeArchive.Scan(stream));
protections.AddRange(TapeArchive.Scan(stream, includePosition));
// Text-based files
if (Textfile.ShouldScan(magic, extension))
protections.AddRange(Textfile.Scan(stream));
protections.AddRange(Textfile.Scan(stream, includePosition));
// Valve archive formats
if (file != null && Valve.ShouldScan(magic))
protections.AddRange(Valve.Scan(file));
protections.AddRange(Valve.Scan(file, includePosition));
// XZ
if (XZ.ShouldScan(magic))
protections.AddRange(XZ.Scan(stream));
protections.AddRange(XZ.Scan(stream, includePosition));
// Return blank if nothing found, or comma-separated list of protections
if (protections.Count() == 0)

View File

@@ -2,17 +2,17 @@
{
public class ActiveMARK
{
public static string CheckContents(byte[] fileContent)
public static string CheckContents(byte[] fileContent, bool includePosition = false)
{
// "TMSAMVOF"
byte[] check = new byte[] { 0x54, 0x4D, 0x53, 0x41, 0x4D, 0x56, 0x4F, 0x46 };
if (fileContent.Contains(check, out int position))
return $"ActiveMARK (Index {position})";
return "ActiveMARK" + (includePosition ? $" (Index {position})" : string.Empty);
// " " + (char)0xC2 + (char)0x16 + (char)0x00 + (char)0xA8 + (char)0xC1 + (char)0x16 + (char)0x00 + (char)0xB8 + (char)0xC1 + (char)0x16 + (char)0x00 + (char)0x86 + (char)0xC8 + (char)0x16 + (char)0x0 + (char)0x9A + (char)0xC1 + (char)0x16 + (char)0x00 + (char)0x10 + (char)0xC2 + (char)0x16 + (char)0x00
check = new byte[] { 0x20, 0xC2, 0x16, 0x00, 0xA8, 0xC1, 0x16, 0x00, 0xB8, 0xC1, 0x16, 0x00, 0x86, 0xC8, 0x16, 0x0, 0x9A, 0xC1, 0x16, 0x00, 0x10, 0xC2, 0x16, 0x00 };
if (fileContent.Contains(check, out position))
return $"ActiveMARK 5 (Index {position})";
return "ActiveMARK 5" + (includePosition ? $" (Index {position})" : string.Empty);
return null;
}

View File

@@ -2,12 +2,12 @@
{
public class AlphaROM
{
public static string CheckContents(byte[] fileContent)
public static string CheckContents(byte[] fileContent, bool includePosition = false)
{
// "SETTEC"
byte[] check = new byte[] { 0x53, 0x45, 0x54, 0x54, 0x45, 0x43 };
if (fileContent.Contains(check, out int position))
return $"Alpha-ROM (Index {position})";
return "Alpha-ROM" + (includePosition ? $" (Index {position})" : string.Empty);
return null;
}

View File

@@ -2,17 +2,17 @@
{
public class Armadillo
{
public static string CheckContents(byte[] fileContent)
public static string CheckContents(byte[] fileContent, bool includePosition = false)
{
// ".nicode" + (char)0x00
byte[] check = new byte[] { 0x2E, 0x6E, 0x69, 0x63, 0x6F, 0x64, 0x65, 0x00 };
if (fileContent.Contains(check, out int position))
return $"Armadillo (Index {position})";
return $"Armadillo" + (includePosition ? $" (Index {position})" : string.Empty);
// "ARMDEBUG"
check = new byte[] { 0x41, 0x52, 0x4D, 0x44, 0x45, 0x42, 0x55, 0x47 };
if (fileContent.Contains(check, out position))
return $"Armadillo (Index {position})";
return $"Armadillo" + (includePosition ? $" (Index {position})" : string.Empty);
return null;
}

View File

@@ -2,17 +2,17 @@
{
public class CDCheck
{
public static string CheckContents(byte[] fileContent)
public static string CheckContents(byte[] fileContent, bool includePosition = false)
{
// "GetDriveType"
byte[] check = new byte[] { 0x47, 0x65, 0x74, 0x44, 0x72, 0x69, 0x76, 0x65, 0x54, 0x79, 0x70, 0x65 };
if (fileContent.Contains(check, out int position))
return $"CD Check (Index {position})";
return "CD Check" + (includePosition ? $" (Index {position})" : string.Empty);
// "GetVolumeInformation"
check = new byte[] { 0x47, 0x65, 0x74, 0x56, 0x6F, 0x6C, 0x75, 0x6D, 0x65, 0x49, 0x6E, 0x66, 0x6F, 0x72, 0x6D, 0x61, 0x74, 0x69, 0x6F, 0x6E };
if (fileContent.Contains(check, out position))
return $"CD Check (Index {position})";
return "CD Check" + (includePosition ? $" (Index {position})" : string.Empty);
return null;
}

View File

@@ -7,17 +7,17 @@ namespace BurnOutSharp.ProtectionType
{
public class CDCops
{
public static string CheckContents(byte[] fileContent)
public static string CheckContents(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 };
if (fileContent.Contains(check, out int position))
return $"CD-Cops {GetVersion(fileContent, position)} (Index {position})";
return $"CD-Cops {GetVersion(fileContent, position)}" + (includePosition ? $" (Index {position})" : string.Empty);
// ".grand" + (char)0x00
check = new byte[] { 0x2E, 0x67, 0x72, 0x61, 0x6E, 0x64, 0x00};
if (fileContent.Contains(check, out position))
return $"CD-Cops (Index {position})";
return "CD-Cops" + (includePosition ? $" (Index {position})" : string.Empty);
return null;
}

View File

@@ -7,12 +7,12 @@ namespace BurnOutSharp.ProtectionType
{
public class CDLock
{
public static string CheckContents(byte[] fileContent)
public static string CheckContents(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 };
if (fileContent.Contains(check, out int position))
return $"CD-Lock (Index {position})";
return "CD-Lock" + (includePosition ? $" (Index {position})" : string.Empty);
return null;
}

View File

@@ -2,12 +2,12 @@
{
public class CDSHiELDSE
{
public static string CheckContents(byte[] fileContent)
public static string CheckContents(byte[] fileContent, bool includePosition = false)
{
// "~0017.tmp"
byte[] check = new byte[] { 0x7E, 0x30, 0x30, 0x31, 0x37, 0x2E, 0x74, 0x6D, 0x70 };
if (fileContent.Contains(check, out int position))
return $"CDSHiELD SE (Index {position})";
return "CDSHiELD SE" + (includePosition ? $" (Index {position})" : string.Empty);
return null;
}

View File

@@ -2,12 +2,12 @@
{
public class CengaProtectDVD
{
public static string CheckContents(byte[] fileContent)
public static string CheckContents(byte[] fileContent, bool includePosition = false)
{
// ".cenega"
byte[] check = new byte[] { 0x2E, 0x63, 0x65, 0x6E, 0x65, 0x67, 0x61 };
if (fileContent.Contains(check, out int position))
return $"Cenega ProtectDVD (Index {position})";
return "Cenega ProtectDVD" + (includePosition ? $" (Index {position})" : string.Empty);
return null;
}

View File

@@ -3,22 +3,22 @@
public class CodeLock
{
// TODO: Verify if these are OR or AND
public static string CheckContents(byte[] fileContent)
public static string CheckContents(byte[] fileContent, bool includePosition = false)
{
// "icd1" + (char)0x00
byte[] check = new byte[] { 0x69, 0x63, 0x64, 0x31, 0x00 };
if (fileContent.Contains(check, out int position))
return $"Code Lock (Index {position})";
return "Code Lock" + (includePosition ? $" (Index {position})" : string.Empty);
// "icd2" + (char)0x00
check = new byte[] { 0x69, 0x63, 0x64, 0x32, 0x00 };
if (fileContent.Contains(check, out position))
return $"Code Lock (Index {position})";
return "Code Lock" + (includePosition ? $" (Index {position})" : string.Empty);
// "CODE-LOCK.OCX"
check = new byte[] { 0x43, 0x4F, 0x44, 0x45, 0x2D, 0x4C, 0x4F, 0x43, 0x4B, 0x2E, 0x4F, 0x43, 0x58 };
if (fileContent.Contains(check, out position))
return $"Code Lock (Index {position})";
return "Code Lock" + (includePosition ? $" (Index {position})" : string.Empty);
return null;
}

View File

@@ -7,12 +7,12 @@ namespace BurnOutSharp.ProtectionType
{
public class CopyKiller
{
public static string CheckContents(byte[] fileContent)
public static string CheckContents(byte[] fileContent, bool includePosition = false)
{
// "Tom Commander"
byte[] check = new byte[] { 0x54, 0x6F, 0x6D, 0x20, 0x43, 0x6F, 0x6D, 0x6D, 0x61, 0x6E, 0x64, 0x65, 0x72 };
if (fileContent.Contains(check, out int position))
return $"CopyKiller (Index {position})";
return "CopyKiller" + (includePosition ? $" (Index {position})" : string.Empty);
return null;
}

View File

@@ -3,12 +3,12 @@
public class Cucko
{
// TODO: Verify this doesn't over-match
public static string CheckContents(byte[] fileContent)
public static string CheckContents(byte[] fileContent, bool includePosition = false)
{
// "EASTL"
byte[] check = new byte[] { 0x45, 0x41, 0x53, 0x54, 0x4C };
if (fileContent.Contains(check, out int position))
return $"Cucko (EA Custom) (Index {position})";
return "Cucko (EA Custom)" + (includePosition ? $" (Index {position})" : string.Empty);
return null;
}

View File

@@ -5,12 +5,12 @@ namespace BurnOutSharp.ProtectionType
{
public class DVDCops
{
public static string CheckContents(byte[] fileContent)
public static string CheckContents(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 };
if (fileContent.Contains(check, out int position))
return $"DVD-Cops {GetVersion(fileContent, position)} (Index {position})";
return $"DVD-Cops {GetVersion(fileContent, position)}" + (includePosition ? $" (Index {position})" : string.Empty);
return null;
}

View File

@@ -2,12 +2,12 @@
{
public class EACdKey
{
public static string CheckContents(byte[] fileContent)
public static string CheckContents(byte[] fileContent, bool includePosition = false)
{
// "ereg.ea-europe.com"
byte[] check = new byte[] { 0x65, 0x72, 0x65, 0x67, 0x2E, 0x65, 0x61, 0x2D, 0x65, 0x75, 0x72, 0x6F, 0x70, 0x65, 0x2E, 0x63, 0x6F, 0x6D };
if (fileContent.Contains(check, out int position))
return $"EA CdKey Registration Module (Index {position})";
return "EA CdKey Registration Module" + (includePosition ? $" (Index {position})" : string.Empty);
return null;
}

View File

@@ -2,12 +2,12 @@
{
public class EXEStealth
{
public static string CheckContents(byte[] fileContent)
public static string CheckContents(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 };
if (fileContent.Contains(check, out int position))
return $"EXE Stealth (Index {position})";
return $"EXE Stealth" + (includePosition ? $" (Index {position})" : string.Empty);
return null;
}

View File

@@ -7,12 +7,12 @@ namespace BurnOutSharp.ProtectionType
{
public class GFWL
{
public static string CheckContents(byte[] fileContent)
public static string CheckContents(byte[] fileContent, bool includePosition = false)
{
// "xlive.dll"
byte[] check = new byte[] { 0x78, 0x6C, 0x69, 0x76, 0x65, 0x2E, 0x64, 0x6C, 0x6C };
if (fileContent.Contains(check, out int position))
return $"Games for Windows - Live (Index {position})";
return "Games for Windows - Live" + (includePosition ? $" (Index {position})" : string.Empty);
return null;
}

View File

@@ -7,7 +7,7 @@ namespace BurnOutSharp.ProtectionType
{
public class ImpulseReactor
{
public static string CheckContents(string file, byte[] fileContent)
public static 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 };
@@ -16,9 +16,9 @@ namespace BurnOutSharp.ProtectionType
// "A" + (char)0x00 + "T" + (char)0x00 + "T" + (char)0x00 + "L" + (char)0x00 + "I" + (char)0x00 + "S" + (char)0x00 + "T" + (char)0x00 + (char)0x00 + (char)0x00 + "E" + (char)0x00 + "L" + (char)0x00 + "E" + (char)0x00 + "M" + (char)0x00 + "E" + (char)0x00 + "N" + (char)0x00 + "T" + (char)0x00 + (char)0x00 + (char)0x00 + "N" + (char)0x00 + "O" + (char)0x00 + "T" + (char)0x00 + "A" + (char)0x00 + "T" + (char)0x00 + "I" + (char)0x00 + "O" + (char)0x00 + "N"
byte[] check2 = new byte[] { 0x41, 0x00, 0x54, 0x00, 0x54, 0x00, 0x4C, 0x00, 0x49, 0x00, 0x53, 0x00, 0x54, 0x00, 0x00, 0x00, 0x45, 0x00, 0x4C, 0x00, 0x45, 0x00, 0x4D, 0x00, 0x45, 0x00, 0x4E, 0x00, 0x54, 0x00, 0x00, 0x00, 0x4E, 0x00, 0x4F, 0x00, 0x54, 0x00, 0x41, 0x00, 0x54, 0x00, 0x49, 0x00, 0x4F, 0x00, 0x4E };
if (fileContent.Contains(check2, out int position2))
return $"Impulse Reactor {Utilities.GetFileVersion(file)} (Index {position}, {position2}";
return $"Impulse Reactor {Utilities.GetFileVersion(file)}" + (includePosition ? $" (Index {position}, {position2})" : string.Empty);
else
return $"Impulse Reactor (Index {position})";
return "Impulse Reactor" + (includePosition ? $" (Index {position})" : string.Empty);
}
return null;

View File

@@ -7,12 +7,12 @@ namespace BurnOutSharp.ProtectionType
{
// TOOO: Add Inno Setup extraction
// https://github.com/dscharrer/InnoExtract
public static string CheckContents(byte[] fileContent)
public static string CheckContents(byte[] fileContent, bool includePosition = false)
{
// "Inno"
byte[] check = new byte[] { 0x49, 0x6E, 0x6E, 0x6F };
if (fileContent.Contains(check, out int position) && position == 0x30)
return $"Inno Setup {GetVersion(fileContent)} (Index {position})";
return $"Inno Setup {GetVersion(fileContent)}" + (includePosition ? $" (Index {position})" : string.Empty);
return null;
}

View File

@@ -5,7 +5,7 @@ namespace BurnOutSharp.ProtectionType
{
public class JoWooDXProt
{
public static string CheckContents(byte[] fileContent)
public static string CheckContents(byte[] fileContent, bool includePosition = false)
{
// ".ext "
byte[] check = new byte[] { 0x2E, 0x65, 0x78, 0x74, 0x20, 0x20, 0x20, 0x20 };
@@ -14,15 +14,15 @@ namespace BurnOutSharp.ProtectionType
// "kernel32.dll" + (char)0x00 + (char)0x00 + (char)0x00 + "VirtualProtect"
byte[] check2 = new byte[] { 0x6B, 0x65, 0x72, 0x6E, 0x65, 0x6C, 0x33, 0x32, 0x2E, 0x64, 0x6C, 0x6C, 0x00, 0x00, 0x00, 0x56, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6C, 0x50, 0x72, 0x6F, 0x74, 0x65, 0x63, 0x74 };
if (fileContent.Contains(check2, out int position2))
return $"JoWooD X-Prot {GetVersion(fileContent, --position2)} (Index {position}, {position2})";
return $"JoWooD X-Prot {GetVersion(fileContent, --position2)}" + (includePosition ? $" (Index {position}, {position2})" : string.Empty);
else
return $"JoWooD X-Prot v1 (Index {position})";
return $"JoWooD X-Prot v1" + (includePosition ? $" (Index {position})" : string.Empty);
}
// "@HC09 "
check = new byte[] { 0x40, 0x48, 0x43, 0x30, 0x39, 0x20, 0x20, 0x20, 0x20 };
if (fileContent.Contains(check, out position))
return $"JoWooD X-Prot v2 (Index {position})";
return $"JoWooD X-Prot v2" + (includePosition ? $" (Index {position})" : string.Empty);
return null;
}

View File

@@ -2,12 +2,12 @@
{
public class KeyLock
{
public static string CheckContents(byte[] fileContent)
public static string CheckContents(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 };
if (fileContent.Contains(check, out int position))
return $"Key-Lock (Dongle) (Index {position})";
return $"Key-Lock (Dongle)" + (includePosition ? $" (Index {position})" : string.Empty);
return null;
}

View File

@@ -7,7 +7,7 @@ namespace BurnOutSharp.ProtectionType
{
public class LaserLock
{
public static string CheckContents(string file, byte[] fileContent)
public static 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 };
@@ -18,24 +18,24 @@ namespace BurnOutSharp.ProtectionType
bool containsCheck2 = fileContent.Contains(check2, out int position2);
if (containsCheck && containsCheck2)
return $"LaserLock {GetVersion(fileContent, position2)} {GetBuild(fileContent, true)} (Index {position}, {position2})";
return $"LaserLock {GetVersion(fileContent, position2)} {GetBuild(fileContent, true)}" + (includePosition ? $" (Index {position}, {position2})" : string.Empty);
else if (containsCheck && !containsCheck2)
return $"LaserLock Marathon {GetBuild(fileContent, false)} (Index {position})";
return $"LaserLock Marathon {GetBuild(fileContent, false)}" + (includePosition ? $" (Index {position})" : string.Empty);
else if (!containsCheck && containsCheck2)
return $"LaserLock {GetVersion(fileContent, --position2)} {GetBuild(fileContent, false)} (Index {position2})";
return $"LaserLock {GetVersion(fileContent, --position2)} {GetBuild(fileContent, false)}" + (includePosition ? $" (Index {position2})" : string.Empty);
if (file != null && string.Equals(Path.GetFileName(file), "NOMOUSE.SP", StringComparison.OrdinalIgnoreCase))
return $"LaserLock {GetVersion16Bit(fileContent)} (Index 71)";
return $"LaserLock {GetVersion16Bit(fileContent)}" + (includePosition ? $" (Index 71)" : string.Empty);
// ":\\LASERLOK\\LASERLOK.IN" + (char)0x00 + "C:\\NOMOUSE.SP"
check = new byte[] { 0x3A, 0x5C, 0x5C, 0x4C, 0x41, 0x53, 0x45, 0x52, 0x4C, 0x4F, 0x4B, 0x5C, 0x5C, 0x4C, 0x41, 0x53, 0x45, 0x52, 0x4C, 0x4F, 0x4B, 0x2E, 0x49, 0x4E, 0x00, 0x43, 0x3A, 0x5C, 0x5C, 0x4E, 0x4F, 0x4D, 0x4F, 0x55, 0x53, 0x45, 0x2E, 0x53, 0x50 };
if (fileContent.Contains(check, out position))
return $"LaserLock 3 (Index {position})";
return "LaserLock 3" + (includePosition ? $" (Index {position})" : string.Empty);
// "LASERLOK_INIT" + (char)0xC + "LASERLOK_RUN" + (char)0xE + "LASERLOK_CHECK" + (char)0xF + "LASERLOK_CHECK2" + (char)0xF + "LASERLOK_CHECK3"
check = new byte[] { 0x4C, 0x41, 0x53, 0x45, 0x52, 0x4C, 0x4F, 0x4B, 0x5F, 0x49, 0x4E, 0x49, 0x54, 0x0C, 0x4C, 0x41, 0x53, 0x45, 0x52, 0x4C, 0x4F, 0x4B, 0x5F, 0x52, 0x55, 0x4E, 0x0E, 0x4C, 0x41, 0x53, 0x45, 0x52, 0x4C, 0x4F, 0x4B, 0x5F, 0x43, 0x48, 0x45, 0x43, 0x4B, 0x0F, 0x4C, 0x41, 0x53, 0x45, 0x52, 0x4C, 0x4F, 0x4B, 0x5F, 0x43, 0x48, 0x45, 0x43, 0x4B, 0x32, 0x0F, 0x4C, 0x41, 0x53, 0x45, 0x52, 0x4C, 0x4F, 0x4B, 0x5F, 0x43, 0x48, 0x45, 0x43, 0x4B, 0x33 };
if (fileContent.Contains(check, out position))
return $"LaserLock 5 (Index {position})";
return "LaserLock 5" + (includePosition ? $" (Index {position})" : string.Empty);
return null;
}

View File

@@ -2,12 +2,12 @@
{
public class PECompact
{
public static string CheckContents(byte[] fileContent)
public static string CheckContents(byte[] fileContent, bool includePosition = false)
{
// "PEC2"
byte[] check = new byte[] { 0x50, 0x45, 0x43, 0x32 };
if (fileContent.Contains(check, out int position))
return $"PE Compact 2 (Index {position})";
return "PE Compact 2" + (includePosition ? $" (Index {position})" : string.Empty);
return null;
}

View File

@@ -5,7 +5,7 @@ namespace BurnOutSharp.ProtectionType
{
public class ProtectDisc
{
public static string CheckContents(string file, byte[] fileContent)
public static string CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
// "HúMETINF"
byte[] check = new byte[] { 0x48, 0xFA, 0x4D, 0x45, 0x54, 0x49, 0x4E, 0x46 };
@@ -18,11 +18,11 @@ namespace BurnOutSharp.ProtectionType
if (astrVersionArray[0] == "9")
{
if (GetVersionBuild76till10(fileContent, position, out int ibuild).Length > 0)
return $"ProtectDisc {astrVersionArray[0]}.{astrVersionArray[1]}{astrVersionArray[2]}.{astrVersionArray[3]} (Build {ibuild}) (Index {position})";
return $"ProtectDisc {astrVersionArray[0]}.{astrVersionArray[1]}{astrVersionArray[2]}.{astrVersionArray[3]} (Build {ibuild})" + (includePosition ? $" (Index {position})" : string.Empty);
}
else
{
return $"ProtectDisc {astrVersionArray[0]}.{astrVersionArray[1]}.{astrVersionArray[2]} (Build {astrVersionArray[3]}) (Index {position})";
return $"ProtectDisc {astrVersionArray[0]}.{astrVersionArray[1]}.{astrVersionArray[2]} (Build {astrVersionArray[3]})" + (includePosition ? $" (Index {position})" : string.Empty);
}
}
}
@@ -35,10 +35,10 @@ namespace BurnOutSharp.ProtectionType
if (version.Length > 0)
{
string[] astrVersionArray = version.Split('.');
return $"ProtectDisc {astrVersionArray[0]}.{astrVersionArray[1]}.{astrVersionArray[2]} (Build {astrVersionArray[3]}) (Index {position})";
return $"ProtectDisc {astrVersionArray[0]}.{astrVersionArray[1]}.{astrVersionArray[2]} (Build {astrVersionArray[3]})" + (includePosition ? $" (Index {position})" : string.Empty);
}
return $"ProtectDisc {GetVersionBuild6till8(fileContent, position)} (Index {position})";
return $"ProtectDisc {GetVersionBuild6till8(fileContent, position)}" + (includePosition ? $" (Index {position})" : string.Empty);
}
return null;

View File

@@ -2,12 +2,12 @@
{
public class RingPROTECH
{
public static string CheckContents(byte[] fileContent)
public static string CheckContents(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 };
if (fileContent.Contains(check, out int position))
return $"Ring PROTECH (Index {position})";
return "Ring PROTECH" + (includePosition ? $" (Index {position})" : string.Empty);
return null;
}

View File

@@ -2,12 +2,12 @@
{
public class SVKProtector
{
public static string CheckContents(byte[] fileContent)
public static string CheckContents(byte[] fileContent, bool includePosition = false)
{
// "?SVKP" + (char)0x00 + (char)0x00
byte[] check = new byte[] { 0x3F, 0x53, 0x56, 0x4B, 0x50, 0x00, 0x00 };
if (fileContent.Contains(check, out int position))
return $"SVK Protector (Index {position})";
return "SVK Protector" + (includePosition ? $" (Index {position})" : string.Empty);
return null;
}

View File

@@ -7,7 +7,7 @@ namespace BurnOutSharp.ProtectionType
{
public class SafeDisc
{
public static string CheckContents(string file, byte[] fileContent)
public static 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 };
@@ -16,9 +16,9 @@ namespace BurnOutSharp.ProtectionType
// "product activation library"
byte[] check2 = new byte[] { 0x70, 0x72, 0x6F, 0x64, 0x75, 0x63, 0x74, 0x20, 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x6C, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79 };
if (fileContent.Contains(check2, out int position2))
return $"SafeCast {GetVersion(fileContent, position)} (Index {position}, {position2})";
return $"SafeCast {GetVersion(fileContent, position)}" + (includePosition ? $" (Index {position}, {position2})" : string.Empty);
else
return $"SafeDisc {GetVersion(fileContent, position)} (Index {position})";
return $"SafeDisc {GetVersion(fileContent, position)}" + (includePosition ? $" (Index {position})" : string.Empty);
}
// (char)0x00 + (char)0x00 + "BoG_"
@@ -27,9 +27,9 @@ namespace BurnOutSharp.ProtectionType
{
string version = EVORE.SearchSafeDiscVersion(file, fileContent);
if (version.Length > 0)
return $"SafeDisc {version} (Index {position})";
return $"SafeDisc {version}" + (includePosition ? $" (Index {position})" : string.Empty);
return $"SafeDisc 3.20-4.xx (version removed) (Index {position})";
return "SafeDisc 3.20-4.xx (version removed)" + (includePosition ? $" (Index {position})" : string.Empty);
}
// "stxt774"
@@ -38,9 +38,9 @@ namespace BurnOutSharp.ProtectionType
{
string version = EVORE.SearchSafeDiscVersion(file, fileContent);
if (version.Length > 0)
return $"SafeDisc {version} (Index {position})";
return $"SafeDisc {version}" + (includePosition ? $" (Index {position})" : string.Empty);
return $"SafeDisc 3.20-4.xx (version removed) (Index {position})";
return "SafeDisc 3.20-4.xx (version removed)" + (includePosition ? $" (Index {position})" : string.Empty);
}
// "stxt371"
@@ -49,9 +49,9 @@ namespace BurnOutSharp.ProtectionType
{
string version = EVORE.SearchSafeDiscVersion(file, fileContent);
if (version.Length > 0)
return $"SafeDisc {version} (Index {position})";
return $"SafeDisc {version}" + (includePosition ? $" (Index {position})" : string.Empty);
return $"SafeDisc 3.20-4.xx (version removed) (Index {position})";
return "SafeDisc 3.20-4.xx (version removed)" + (includePosition ? $" (Index {position})" : string.Empty);
}
return null;

View File

@@ -7,12 +7,12 @@ namespace BurnOutSharp.ProtectionType
{
public class SafeLock
{
public static string CheckContents(byte[] fileContent)
public static string CheckContents(byte[] fileContent, bool includePosition = false)
{
// "SafeLock"
byte[] check = new byte[] { 0x53, 0x61, 0x66, 0x65, 0x4C, 0x6F, 0x63, 0x6B };
if (fileContent.Contains(check, out int position))
return $"SafeLock (Index {position})";
return "SafeLock" + (includePosition ? $" (Index {position})" : string.Empty);
return null;
}

View File

@@ -7,42 +7,42 @@ namespace BurnOutSharp.ProtectionType
{
public class SecuROM
{
public static string CheckContents(string file, byte[] fileContent)
public static 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 };
if (fileContent.Contains(check, out int position))
return $"SecuROM {GetV4Version(fileContent, position)} (Index {position})";
return $"SecuROM {GetV4Version(fileContent, position)}" + (includePosition ? $" (Index {position})" : string.Empty);
// (char)0xCA + (char)0xDD + (char)0xDD + (char)0xAC + (char)0x03
check = new byte[] { 0xCA, 0xDD, 0xDD, 0xAC, 0x03 };
if (fileContent.Contains(check, out position))
return $"SecuROM {GetV5Version(fileContent, position)} (Index {position})";
return $"SecuROM {GetV5Version(fileContent, position)}" + (includePosition ? $" (Index {position})" : string.Empty);
// ".securom" + (char)0xE0 + (char)0xC0
check = new byte[] { 0x2E, 0x73, 0x65, 0x63, 0x75, 0x72, 0x6F, 0x6D, 0xE0, 0xC0 };
if (fileContent.Contains(check, out position) && position == 0)
return $"SecuROM {GetV7Version(fileContent)} (Index {position})";
return $"SecuROM {GetV7Version(fileContent)}" + (includePosition ? $" (Index {position})" : string.Empty);
// ".securom"
check = new byte[] { 0x2E, 0x73, 0x65, 0x63, 0x75, 0x72, 0x6F, 0x6D };
if (fileContent.Contains(check, out position))
return $"SecuROM {GetV7Version(fileContent)} (Index {position})";
return $"SecuROM {GetV7Version(fileContent)}" + (includePosition ? $" (Index {position})" : string.Empty);
// "_and_play.dll" + (char)0x00 + "drm_pagui_doit"
check = new byte[] { 0x5F, 0x61, 0x6E, 0x64, 0x5F, 0x70, 0x6C, 0x61, 0x79, 0x2E, 0x64, 0x6C, 0x6C, 0x00, 0x64, 0x72, 0x6D, 0x5F, 0x70, 0x61, 0x67, 0x75, 0x69, 0x5F, 0x64, 0x6F, 0x69, 0x74 };
if (fileContent.Contains(check, out position))
return $"SecuROM Product Activation {Utilities.GetFileVersion(file)} (Index {position})";
return $"SecuROM Product Activation {Utilities.GetFileVersion(file)}" + (includePosition ? $" (Index {position})" : string.Empty);
// ".cms_t" + (char)0x00
check = new byte[] { 0x2E, 0x63, 0x6D, 0x73, 0x5F, 0x74, 0x00 };
if (fileContent.Contains(check, out position))
return $"SecuROM 1-3 (Index {position})";
return "SecuROM 1-3" + (includePosition ? $" (Index {position})" : string.Empty);
// ".cms_d" + (char)0x00
check = new byte[] { 0x2E, 0x63, 0x6D, 0x73, 0x5F, 0x64, 0x00 };
if (fileContent.Contains(check, out position))
return $"SecuROM 1-3 (Index {position})";
return "SecuROM 1-3" + (includePosition ? $" (Index {position})" : string.Empty);
return null;
}

View File

@@ -7,12 +7,12 @@ namespace BurnOutSharp.ProtectionType
{
public class SmartE
{
public static string CheckContents(byte[] fileContent)
public static string CheckContents(byte[] fileContent, bool includePosition = false)
{
// "BITARTS"
byte[] check = new byte[] { 0x42, 0x49, 0x54, 0x41, 0x52, 0x54, 0x53 };
if (fileContent.Contains(check, out int position))
return $"SmartE (Index {position})";
return "SmartE" + (includePosition ? $" (Index {position})" : string.Empty);
return null;
}

View File

@@ -8,12 +8,12 @@ namespace BurnOutSharp.ProtectionType
{
public class SolidShield
{
public static string CheckContents(string file, byte[] fileContent)
public static 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 };
if (fileContent.Contains(check, out int position))
return $"SolidShield {Utilities.GetFileVersion(file)} (Index {position})";
return $"SolidShield {Utilities.GetFileVersion(file)}" + (includePosition ? $" (Index {position})" : string.Empty);
// "S" + (char)0x00 + "o" + (char)0x00 + "l" + (char)0x00 + "i" + (char)0x00 + "d" + (char)0x00 + "s" + (char)0x00 + "h" + (char)0x00 + "i" + (char)0x00 + "e" + (char)0x00 + "l" + (char)0x00 + "d" + (char)0x00 + " " + (char)0x00 + "L" + (char)0x00 + "i" + (char)0x00 + "b" + (char)0x00 + "r" + (char)0x00 + "a" + (char)0x00 + "r" + (char)0x00 + "y"
check = new byte[] { 0x53, 0x00, 0x6F, 0x00, 0x6C, 0x00, 0x69, 0x00, 0x64, 0x00, 0x73, 0x00, 0x68, 0x00, 0x69, 0x00, 0x65, 0x00, 0x6C, 0x00, 0x64, 0x00, 0x20, 0x00, 0x4C, 0x00, 0x69, 0x00, 0x62, 0x00, 0x72, 0x00, 0x61, 0x00, 0x72, 0x00, 0x79 };
@@ -24,7 +24,7 @@ namespace BurnOutSharp.ProtectionType
companyName = FileVersionInfo.GetVersionInfo(file).CompanyName.ToLower();
if (companyName.Contains("solidshield") || companyName.Contains("tages"))
return $"SolidShield Core.dll {Utilities.GetFileVersion(file)} (Index {position})";
return $"SolidShield Core.dll {Utilities.GetFileVersion(file)}" + (includePosition ? $" (Index {position})" : string.Empty);
}
// "S" + (char)0x00 + "o" + (char)0x00 + "l" + (char)0x00 + "i" + (char)0x00 + "d" + (char)0x00 + "s" + (char)0x00 + "h" + (char)0x00 + "i" + (char)0x00 + "e" + (char)0x00 + "l" + (char)0x00 + "d" + (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 + " " + (char)0x00 + "L" + (char)0x00 + "i" + (char)0x00 + "b" + (char)0x00 + "r" + (char)0x00 + "a" + (char)0x00 + "r" + (char)0x00 + "y"
@@ -36,7 +36,7 @@ namespace BurnOutSharp.ProtectionType
companyName = FileVersionInfo.GetVersionInfo(file).CompanyName.ToLower();
if (companyName.Contains("solidshield") || companyName.Contains("tages"))
return $"SolidShield Core.dll {Utilities.GetFileVersion(file)} (Index {position})";
return $"SolidShield Core.dll {Utilities.GetFileVersion(file)}" + (includePosition ? $" (Index {position})" : string.Empty);
}
// (char)0xEF + (char)0xBE + (char)0xAD + (char)0xDE
@@ -47,9 +47,9 @@ namespace BurnOutSharp.ProtectionType
var id2 = new ArraySegment<byte>(fileContent, position + 16, 4);
if (id1.SequenceEqual(new byte[] { 0x00, 0x00, 0x00 }) && id2.SequenceEqual(new byte[] { 0x00, 0x10, 0x00, 0x00 }))
return $"SolidShield 1 (SolidShield EXE Wrapper) (Index {position})";
return "SolidShield 1 (SolidShield EXE Wrapper)" + (includePosition ? $" (Index {position})" : string.Empty);
else if (id1.SequenceEqual(new byte[] { 0x2E, 0x6F, 0x26 }) && id2.SequenceEqual(new byte[] { 0xDB, 0xC5, 0x20, 0x3A, 0xB9 }))
return $"SolidShield 2 (SolidShield v2 EXE Wrapper) (Index {position})"; // TODO: Verify against other SolidShield 2 discs
return "SolidShield 2 (SolidShield v2 EXE Wrapper)" + (includePosition ? $" (Index {position})" : string.Empty); // TODO: Verify against other SolidShield 2 discs
}
// "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 + " " + (char)0x00 + "M" + (char)0x00 + "a" + (char)0x00 + "n" + (char)0x00 + "a" + (char)0x00 + "g" + (char)0x00 + "e" + (char)0x00 + "r"
@@ -61,7 +61,7 @@ namespace BurnOutSharp.ProtectionType
companyName = FileVersionInfo.GetVersionInfo(file).CompanyName.ToLower();
if (companyName.Contains("solidshield") || companyName.Contains("tages"))
return $"SolidShield Activation Manager Module {Utilities.GetFileVersion(file)} (Index {position})";
return $"SolidShield Activation Manager Module {Utilities.GetFileVersion(file)}" + (includePosition ? $" (Index {position})" : string.Empty);
}
// (char)0xAD + (char)0xDE + (char)0xFE + (char)0xCA
@@ -75,7 +75,7 @@ namespace BurnOutSharp.ProtectionType
&& id1.SequenceEqual(new byte[] { 0x00, 0x00, 0x00 })
&& id2.SequenceEqual(new byte[] { 0x00, 0x10, 0x00, 0x00 }))
{
return $"SolidShield 2 (SolidShield v2 EXE Wrapper) (Index {position})";
return "SolidShield 2 (SolidShield v2 EXE Wrapper)" + (includePosition ? $" (Index {position})" : string.Empty);
}
else if (id1.SequenceEqual(new byte[] { 0x00, 0x00, 0x00 })
&& id2.SequenceEqual(new byte[] { 0x00, 0x00, 0x00, 0x00 }))
@@ -85,11 +85,11 @@ namespace BurnOutSharp.ProtectionType
if (fileContent.Contains(check2, out int position2))
{
position2--; // TODO: Verify this subtract
return $"SolidShield 2 + Tagès {fileContent[position2 + 0x38]}.{fileContent[position2 + 0x38 + 4]}.{fileContent[position2 + 0x38 + 8]}.{fileContent[position + 0x38 + 12]} (Index {position}, {position2})";
return $"SolidShield 2 + Tagès {fileContent[position2 + 0x38]}.{fileContent[position2 + 0x38 + 4]}.{fileContent[position2 + 0x38 + 8]}.{fileContent[position + 0x38 + 12]}" + (includePosition ? $" (Index {position}, {position2})" : string.Empty);
}
else
{
return $"SolidShield 2 (SolidShield v2 EXE Wrapper) (Index {position})";
return "SolidShield 2 (SolidShield v2 EXE Wrapper)" + (includePosition ? $" (Index {position})" : string.Empty);
}
}
}
@@ -97,12 +97,12 @@ namespace BurnOutSharp.ProtectionType
// "Solidshield"
check = new byte[] { 0x53, 0x6F, 0x6C, 0x69, 0x64, 0x73, 0x68, 0x69, 0x65, 0x6C, 0x64 };
if (fileContent.Contains(check, out position))
return $"SolidShield {GetVersion(fileContent, position)} (Index {position})";
return $"SolidShield {GetVersion(fileContent, position)}" + (includePosition ? $" (Index {position})" : string.Empty);
// "B" + (char)0x00 + "I" + (char)0x00 + "N" + (char)0x00 + (char)0x7 + (char)0x00 + "I" + (char)0x00 + "D" + (char)0x00 + "R" + (char)0x00 + "_" + (char)0x00 + "S" + (char)0x00 + "G" + (char)0x00 + "T" + (char)0x0
check = new byte[] { 0x42, 0x00, 0x49, 0x00, 0x4E, 0x00, 0x07, 0x00, 0x49, 0x00, 0x44, 0x00, 0x52, 0x00, 0x5F, 0x00, 0x53, 0x00, 0x47, 0x00, 0x54, 0x00 };
if (fileContent.Contains(check, out position))
return $"SolidShield (Index {position})";
return "SolidShield" + (includePosition ? $" (Index {position})" : string.Empty);
return null;
}

View File

@@ -7,7 +7,7 @@ namespace BurnOutSharp.ProtectionType
{
public class StarForce
{
public static string CheckContents(string file, byte[] fileContent)
public static 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 };
@@ -22,9 +22,9 @@ namespace BurnOutSharp.ProtectionType
// "TradeName"
byte[] check2 = new byte[] { 0x54, 0x72, 0x61, 0x64, 0x65, 0x4E, 0x61, 0x6D, 0x65 };
if (fileContent.Contains(check2, out int position2) && position2 != 0)
return $"StarForce {Utilities.GetFileVersion(file)} ({fileContent.Skip(position2 + 22).TakeWhile(c => c != 0x00)}) (Index {position}, {position2})";
return $"StarForce {Utilities.GetFileVersion(file)} ({fileContent.Skip(position2 + 22).TakeWhile(c => c != 0x00)})" + (includePosition ? $" (Index {position}, {position2})" : string.Empty);
else
return $"StarForce {Utilities.GetFileVersion(file)} (Index {position}, {position2})";
return $"StarForce {Utilities.GetFileVersion(file)}" + (includePosition ? $" (Index {position}, {position2})" : string.Empty);
}
// "Protection Technology, Ltd."
@@ -40,25 +40,25 @@ namespace BurnOutSharp.ProtectionType
// "TradeName"
byte[] check2 = new byte[] { 0x54, 0x72, 0x61, 0x64, 0x65, 0x4E, 0x61, 0x6D, 0x65 };
if (fileContent.Contains(check2, out int position2) && position2 != 0)
return $"StarForce {Utilities.GetFileVersion(file)} ({fileContent.Skip(position2 + 22).TakeWhile(c => c != 0x00)}) (Index {position}, {position2})";
return $"StarForce {Utilities.GetFileVersion(file)} ({fileContent.Skip(position2 + 22).TakeWhile(c => c != 0x00)})" + (includePosition ? $" (Index {position}, {position2})" : string.Empty);
else
return $"StarForce {Utilities.GetFileVersion(file)} (Index {position}, {position2})";
return $"StarForce {Utilities.GetFileVersion(file)}" + (includePosition ? $" (Index {position}, {position2})" : string.Empty);
}
// ".sforce"
check = new byte[] { 0x2E, 0x73, 0x66, 0x6F, 0x72, 0x63, 0x65 };
if (fileContent.Contains(check, out position))
return $"StarForce 3-5 (Index {position})";
return "StarForce 3-5" + (includePosition ? $" (Index {position})" : string.Empty);
// ".brick"
check = new byte[] { 0x2E, 0x62, 0x72, 0x69, 0x63, 0x6B };
if (fileContent.Contains(check, out position))
return $"StarForce 3-5 (Index {position})";
return "StarForce 3-5" + (includePosition ? $" (Index {position})" : string.Empty);
// "P" + (char)0x00 + "r" + (char)0x00 + "o" + (char)0x00 + "t" + (char)0x00 + "e" + (char)0x00 + "c" + (char)0x00 + "t" + (char)0x00 + "e" + (char)0x00 + "d" + (char)0x00 + " " + (char)0x00 + "M" + (char)0x00 + "o" + (char)0x00 + "d" + (char)0x00 + "u" + (char)0x00 + "l" + (char)0x00 + "e"
check = new byte[] { 0x50, 0x00, 0x72, 0x00, 0x6f, 0x00, 0x74, 0x00, 0x65, 0x00, 0x63, 0x00, 0x74, 0x00, 0x65, 0x00, 0x64, 0x00, 0x20, 0x00, 0x4d, 0x00, 0x6f, 0x00, 0x64, 0x00, 0x75, 0x00, 0x6c, 0x00, 0x65 };
if (fileContent.Contains(check, out position))
return $"StarForce 5 (Index {position})";
return "StarForce 5" + (includePosition ? $" (Index {position})" : string.Empty);
return null;
}

View File

@@ -2,17 +2,17 @@
{
public class Sysiphus
{
public static string CheckContents(byte[] fileContent)
public static string CheckContents(byte[] fileContent, bool includePosition = false)
{
// "V SUHPISYSDVD"
byte[] check = new byte[] { 0x56, 0x20, 0x53, 0x55, 0x48, 0x50, 0x49, 0x53, 0x59, 0x53, 0x44, 0x56, 0x44 };
if (fileContent.Contains(check, out int position))
return $"Sysiphus DVD {GetVersion(fileContent, position)} (Index {position})";
return $"Sysiphus DVD {GetVersion(fileContent, position)}" + (includePosition ? $" (Index {position})" : string.Empty);
// "V SUHPISYS"
check = new byte[] { 0x56, 0x20, 0x53, 0x55, 0x48, 0x50, 0x49, 0x53, 0x59, 0x53 };
if (fileContent.Contains(check, out position))
return $"Sysiphus {GetVersion(fileContent, position)} (Index {position})";
return $"Sysiphus {GetVersion(fileContent, position)}" + (includePosition ? $" (Index {position})" : string.Empty);
return null;
}

View File

@@ -7,17 +7,17 @@ namespace BurnOutSharp.ProtectionType
{
public class Tages
{
public static string CheckContents(string file, byte[] fileContent)
public static 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 };
if (fileContent.Contains(check, out int position))
return $"TAGES {Utilities.GetFileVersion(file)} (Index {position})";
return $"TAGES {Utilities.GetFileVersion(file)}" + (includePosition ? $" (Index {position})" : string.Empty);
// "tagesprotection.com"
check = new byte[] { 0x74, 0x61, 0x67, 0x65, 0x73, 0x70, 0x72, 0x6F, 0x74, 0x65, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x2E, 0x63, 0x6F, 0x6D };
if (fileContent.Contains(check, out position))
return $"TAGES {Utilities.GetFileVersion(file)} (Index {position})";
return $"TAGES {Utilities.GetFileVersion(file)}" + (includePosition ? $" (Index {position})" : string.Empty);
// (char)0xE8 + "u" + (char)0x00 + (char)0x00 + (char)0x00 + (char)0xE8
check = new byte[] { 0xE8, 0x75, 0x00, 0x00, 0x00, 0xE8 };
@@ -25,7 +25,7 @@ namespace BurnOutSharp.ProtectionType
{
// (char)0xFF + (char)0xFF + "h"
if (new ArraySegment<byte>(fileContent, --position + 8, 3).SequenceEqual(new byte[] { 0xFF, 0xFF, 0x68 })) // TODO: Verify this subtract
return $"TAGES {GetVersion(fileContent, position)} (Index {position})";
return $"TAGES {GetVersion(fileContent, position)}" + (includePosition ? $" (Index {position})" : string.Empty);
}
return null;

View File

@@ -2,22 +2,22 @@
{
public class ThreePLock
{
public static string CheckContents(byte[] fileContent)
public static string CheckContents(byte[] fileContent, bool includePosition = false)
{
// ".ldr"
byte[] check = new byte[] { 0x2E, 0x6C, 0x64, 0x72 };
if (fileContent.Contains(check, out int position))
return $"3PLock (Index {position})";
return "3PLock" + (includePosition ? $" (Index {position})" : string.Empty);
// ".ldt"
check = new byte[] { 0x2E, 0x6C, 0x64, 0x74 };
if (fileContent.Contains(check, out position))
return $"3PLock (Index {position})";
return "3PLock" + (includePosition ? $" (Index {position})" : string.Empty);
// "Y" + (char)0xC3 + "U" + (char)0x8B + (char)0xEC + (char)0x83 + (char)0xEC + "0SVW"
// check = new byte[] { 0x59, 0xC3, 0x55, 0x8B, 0xEC, 0x83, 0xEC, 0x30, 0x53, 0x56, 0x57 };
//if (fileContent.Contains(check, out position))
// return $"3PLock (Index {position})";
// return "3PLock" + (includePosition ? $" (Index {position})" : string.Empty);
return null;
}

View File

@@ -7,12 +7,12 @@ namespace BurnOutSharp.ProtectionType
{
public class VOBProtectCDDVD
{
public static string CheckContents(string file, byte[] fileContent)
public static 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 };
if (fileContent.Contains(check, out int position))
return $"VOB ProtectCD/DVD {GetOldVersion(fileContent, --position)} (Index {position})"; // TODO: Verify this subtract
return $"VOB ProtectCD/DVD {GetOldVersion(fileContent, --position)}" + (includePosition ? $" (Index {position})" : string.Empty); // TODO: Verify this subtract
// "DCP-BOV" + (char)0x00 + (char)0x00
check = new byte[] { 0x44, 0x43, 0x50, 0x2D, 0x42, 0x4F, 0x56, 0x00, 0x00 };
@@ -20,7 +20,7 @@ namespace BurnOutSharp.ProtectionType
{
string version = GetVersion(fileContent, --position); // TODO: Verify this subtract
if (version.Length > 0)
return $"VOB ProtectCD/DVD {version} (Index {position})";
return $"VOB ProtectCD/DVD {version}" + (includePosition ? $" (Index {position})" : string.Empty);
version = EVORE.SearchProtectDiscVersion(file, fileContent);
if (version.Length > 0)
@@ -28,16 +28,16 @@ namespace BurnOutSharp.ProtectionType
if (version.StartsWith("2"))
version = $"6{version.Substring(1)}";
return $"VOB ProtectCD/DVD {version} (Index {position})";
return $"VOB ProtectCD/DVD {version}" + (includePosition ? $" (Index {position})" : string.Empty);
}
return $"VOB ProtectCD/DVD 5.9-6.0 {GetBuild(fileContent, position)} (Index {position})";
return $"VOB ProtectCD/DVD 5.9-6.0 {GetBuild(fileContent, position)}" + (includePosition ? $" (Index {position})" : string.Empty);
}
// ".vob.pcd"
check = new byte[] { 0x2E, 0x76, 0x6F, 0x62, 0x2E, 0x70, 0x63, 0x64 };
if (fileContent.Contains(check, out position))
return $"VOB ProtectCD (Index {position})";
return "VOB ProtectCD" + (includePosition ? $" (Index {position})" : string.Empty);
return null;
}

View File

@@ -7,12 +7,12 @@ namespace BurnOutSharp.ProtectionType
{
public class WTMCDProtect
{
public static string CheckContents(byte[] fileContent)
public static string CheckContents(byte[] fileContent, bool includePosition = false)
{
// "WTM76545"
byte[] check = new byte[] { 0x57, 0x54, 0x4D, 0x37, 0x36, 0x35, 0x34, 0x35 };
if (fileContent.Contains(check, out int position))
return $"WTM CD Protect (Index {position})";
return "WTM CD Protect" + (includePosition ? $" (Index {position})" : string.Empty);
return null;
}

View File

@@ -7,18 +7,19 @@ namespace BurnOutSharp.ProtectionType
{
public class WiseInstaller
{
public static List<string> CheckContents(string file, byte[] fileContent)
public static List<string> CheckContents(string file, byte[] fileContent, bool includePosition = false)
{
// "WiseMain"
byte[] check = new byte[] { 0x57, 0x69, 0x73, 0x65, 0x4D, 0x61, 0x69, 0x6E };
if (fileContent.Contains(check, out int position))
{
List<string> protections = new List<string> { $"Wise Installation Wizard Module (Index {position})" };
List<string> protections = new List<string> { "Wise Installation Wizard Module" + (includePosition ? $" (Index {position})" : string.Empty)
};
if (!File.Exists(file))
return protections;
protections.AddRange(WiseInstaller.Scan(file));
protections.AddRange(WiseInstaller.Scan(file, includePosition));
return protections;
}
@@ -26,7 +27,7 @@ namespace BurnOutSharp.ProtectionType
return null;
}
public static List<string> Scan(string file)
public static List<string> Scan(string file, bool includePosition = false)
{
List<string> protections = new List<string>();
@@ -41,7 +42,7 @@ namespace BurnOutSharp.ProtectionType
foreach (string tempFile in Directory.EnumerateFiles(tempPath, "*", SearchOption.AllDirectories))
{
string protection = ProtectionFind.ScanContent(tempFile);
string protection = ProtectionFind.ScanContent(tempFile, includePosition);
// If tempfile cleanup fails
try

View File

@@ -2,12 +2,12 @@
{
public class XtremeProtector
{
public static string CheckContents(byte[] fileContent)
public static string CheckContents(byte[] fileContent, bool includePosition = false)
{
// "XPROT "
byte[] check = new byte[] { 0x58, 0x50, 0x52, 0x4F, 0x54, 0x20, 0x20, 0x20 };
if (fileContent.Contains(check, out int position))
return $"Xtreme-Protector (Index {position})";
return "Xtreme-Protector" + (includePosition ? $" (Index {position})" : string.Empty);
return null;
}

View File

@@ -2,12 +2,12 @@
{
public class dotFuscator
{
public static string CheckContents(byte[] fileContent)
public static string CheckContents(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 };
if (fileContent.Contains(check, out int position))
return $"dotFuscator (Index {position})";
return "dotFuscator" + (includePosition ? $" (Index {position})" : string.Empty);
return null;
}

View File

@@ -13,7 +13,7 @@ namespace Test
p.ProgressChanged += Changed;
foreach (string arg in args)
{
string protections = String.Join("\r\n", ProtectionFind.Scan(arg, p).Select(kvp => kvp.Key + ": " + kvp.Value.TrimEnd()));
string protections = String.Join("\r\n", ProtectionFind.Scan(arg, true, p).Select(kvp => kvp.Key + ": " + kvp.Value.TrimEnd()));
Console.WriteLine(protections);
using (StreamWriter sw = new StreamWriter(File.OpenWrite($"{DateTime.Now:yyyy-MM-dd_HHmmss}.txt")))
{