From 0c137e97f0b7a292e8145868cdcce974ecfbe06d Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Thu, 10 Sep 2020 21:43:18 -0700 Subject: [PATCH] Make protection location optional (default off) --- BurnOutSharp/FileType/BFPK.cs | 4 +- BurnOutSharp/FileType/BZip2.cs | 4 +- BurnOutSharp/FileType/Executable.cs | 78 +++++++++---------- BurnOutSharp/FileType/GZIP.cs | 4 +- BurnOutSharp/FileType/InstallShieldCAB.cs | 4 +- BurnOutSharp/FileType/MPQ.cs | 4 +- BurnOutSharp/FileType/MicrosoftCAB.cs | 4 +- BurnOutSharp/FileType/PKZIP.cs | 4 +- BurnOutSharp/FileType/RAR.cs | 4 +- BurnOutSharp/FileType/SevenZip.cs | 4 +- BurnOutSharp/FileType/TapeArchive.cs | 4 +- BurnOutSharp/FileType/Textfile.cs | 2 +- BurnOutSharp/FileType/Valve.cs | 4 +- BurnOutSharp/FileType/XZ.cs | 4 +- BurnOutSharp/ProtectionFind.cs | 44 ++++++----- BurnOutSharp/ProtectionType/ActiveMARK.cs | 6 +- BurnOutSharp/ProtectionType/AlphaROM.cs | 4 +- BurnOutSharp/ProtectionType/Armadillo.cs | 6 +- BurnOutSharp/ProtectionType/CDCheck.cs | 6 +- BurnOutSharp/ProtectionType/CDCops.cs | 6 +- BurnOutSharp/ProtectionType/CDLock.cs | 4 +- BurnOutSharp/ProtectionType/CDSHiELDSE.cs | 4 +- .../ProtectionType/CengaProtectDVD.cs | 4 +- BurnOutSharp/ProtectionType/CodeLock.cs | 8 +- BurnOutSharp/ProtectionType/CopyKiller.cs | 4 +- BurnOutSharp/ProtectionType/Cucko.cs | 4 +- BurnOutSharp/ProtectionType/DVDCops.cs | 4 +- BurnOutSharp/ProtectionType/EACdKey.cs | 4 +- BurnOutSharp/ProtectionType/EXEStealth.cs | 4 +- BurnOutSharp/ProtectionType/GFWL.cs | 4 +- BurnOutSharp/ProtectionType/ImpulseReactor.cs | 6 +- BurnOutSharp/ProtectionType/InnoSetup.cs | 4 +- BurnOutSharp/ProtectionType/JoWooDXProt.cs | 8 +- BurnOutSharp/ProtectionType/KeyLock.cs | 4 +- BurnOutSharp/ProtectionType/LaserLock.cs | 14 ++-- BurnOutSharp/ProtectionType/PECompact.cs | 4 +- BurnOutSharp/ProtectionType/ProtectDisc.cs | 10 +-- BurnOutSharp/ProtectionType/RingPROTECH.cs | 4 +- BurnOutSharp/ProtectionType/SVKProtector.cs | 4 +- BurnOutSharp/ProtectionType/SafeDisc.cs | 18 ++--- BurnOutSharp/ProtectionType/SafeLock.cs | 4 +- BurnOutSharp/ProtectionType/SecuROM.cs | 16 ++-- BurnOutSharp/ProtectionType/SmartE.cs | 4 +- BurnOutSharp/ProtectionType/SolidShield.cs | 24 +++--- BurnOutSharp/ProtectionType/StarForce.cs | 16 ++-- BurnOutSharp/ProtectionType/Sysiphus.cs | 6 +- BurnOutSharp/ProtectionType/Tages.cs | 8 +- BurnOutSharp/ProtectionType/ThreePLock.cs | 8 +- .../ProtectionType/VOBProtectCDDVD.cs | 12 +-- BurnOutSharp/ProtectionType/WTMCDProtect.cs | 4 +- BurnOutSharp/ProtectionType/WiseInstaller.cs | 11 +-- .../ProtectionType/XtremeProtector.cs | 4 +- BurnOutSharp/ProtectionType/dotFuscator.cs | 4 +- Test/Program.cs | 2 +- 54 files changed, 224 insertions(+), 219 deletions(-) diff --git a/BurnOutSharp/FileType/BFPK.cs b/BurnOutSharp/FileType/BFPK.cs index 4b32f1e9..362084f8 100644 --- a/BurnOutSharp/FileType/BFPK.cs +++ b/BurnOutSharp/FileType/BFPK.cs @@ -17,7 +17,7 @@ namespace BurnOutSharp.FileType return false; } - public static List Scan(Stream stream) + public static List Scan(Stream stream, bool includePosition = false) { List protections = new List(); @@ -88,7 +88,7 @@ namespace BurnOutSharp.FileType } } - string protection = ProtectionFind.ScanContent(tempFile); + string protection = ProtectionFind.ScanContent(tempFile, includePosition); // If tempfile cleanup fails try diff --git a/BurnOutSharp/FileType/BZip2.cs b/BurnOutSharp/FileType/BZip2.cs index 50130b39..279c528f 100644 --- a/BurnOutSharp/FileType/BZip2.cs +++ b/BurnOutSharp/FileType/BZip2.cs @@ -16,7 +16,7 @@ namespace BurnOutSharp.FileType return false; } - public static List Scan(Stream stream) + public static List Scan(Stream stream, bool includePosition = false) { List protections = new List(); @@ -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 diff --git a/BurnOutSharp/FileType/Executable.cs b/BurnOutSharp/FileType/Executable.cs index 9e780a33..21ea9ac0 100644 --- a/BurnOutSharp/FileType/Executable.cs +++ b/BurnOutSharp/FileType/Executable.cs @@ -40,7 +40,7 @@ namespace BurnOutSharp.FileType return false; } - public static List Scan(Stream stream, string file) + public static List 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); diff --git a/BurnOutSharp/FileType/GZIP.cs b/BurnOutSharp/FileType/GZIP.cs index f22f5257..744d498c 100644 --- a/BurnOutSharp/FileType/GZIP.cs +++ b/BurnOutSharp/FileType/GZIP.cs @@ -16,7 +16,7 @@ namespace BurnOutSharp.FileType return false; } - public static List Scan(Stream stream) + public static List Scan(Stream stream, bool includePosition = false) { List protections = new List(); @@ -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 diff --git a/BurnOutSharp/FileType/InstallShieldCAB.cs b/BurnOutSharp/FileType/InstallShieldCAB.cs index 0bce7e1d..65e63496 100644 --- a/BurnOutSharp/FileType/InstallShieldCAB.cs +++ b/BurnOutSharp/FileType/InstallShieldCAB.cs @@ -17,7 +17,7 @@ namespace BurnOutSharp.FileType } // TODO: Add stream opening support - public static List Scan(string file) + public static List Scan(string file, bool includePosition = false) { List protections = new List(); @@ -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 diff --git a/BurnOutSharp/FileType/MPQ.cs b/BurnOutSharp/FileType/MPQ.cs index 3bf198c6..8784f866 100644 --- a/BurnOutSharp/FileType/MPQ.cs +++ b/BurnOutSharp/FileType/MPQ.cs @@ -16,7 +16,7 @@ namespace BurnOutSharp.FileType } // TODO: Add stream opening support - public static List Scan(string file) + public static List Scan(string file, bool includePosition = false) { List protections = new List(); @@ -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 diff --git a/BurnOutSharp/FileType/MicrosoftCAB.cs b/BurnOutSharp/FileType/MicrosoftCAB.cs index 0bd44e1f..98ffe556 100644 --- a/BurnOutSharp/FileType/MicrosoftCAB.cs +++ b/BurnOutSharp/FileType/MicrosoftCAB.cs @@ -16,7 +16,7 @@ namespace BurnOutSharp.FileType } // TODO: Add stream opening support - public static List Scan(string file) + public static List Scan(string file, bool includePosition = false) { List protections = new List(); @@ -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 diff --git a/BurnOutSharp/FileType/PKZIP.cs b/BurnOutSharp/FileType/PKZIP.cs index 41f520dd..cc7e5708 100644 --- a/BurnOutSharp/FileType/PKZIP.cs +++ b/BurnOutSharp/FileType/PKZIP.cs @@ -25,7 +25,7 @@ namespace BurnOutSharp.FileType return false; } - public static List Scan(Stream stream) + public static List Scan(Stream stream, bool includePosition = false) { List protections = new List(); @@ -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 diff --git a/BurnOutSharp/FileType/RAR.cs b/BurnOutSharp/FileType/RAR.cs index 6ae00055..bee494ff 100644 --- a/BurnOutSharp/FileType/RAR.cs +++ b/BurnOutSharp/FileType/RAR.cs @@ -21,7 +21,7 @@ namespace BurnOutSharp.FileType return false; } - public static List Scan(Stream stream) + public static List Scan(Stream stream, bool includePosition = false) { List protections = new List(); @@ -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 diff --git a/BurnOutSharp/FileType/SevenZip.cs b/BurnOutSharp/FileType/SevenZip.cs index 76c520a4..4aeefa8e 100644 --- a/BurnOutSharp/FileType/SevenZip.cs +++ b/BurnOutSharp/FileType/SevenZip.cs @@ -16,7 +16,7 @@ namespace BurnOutSharp.FileType return false; } - public static List Scan(Stream stream) + public static List Scan(Stream stream, bool includePosition = false) { List protections = new List(); @@ -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 diff --git a/BurnOutSharp/FileType/TapeArchive.cs b/BurnOutSharp/FileType/TapeArchive.cs index 667f38be..a70539c1 100644 --- a/BurnOutSharp/FileType/TapeArchive.cs +++ b/BurnOutSharp/FileType/TapeArchive.cs @@ -19,7 +19,7 @@ namespace BurnOutSharp.FileType return false; } - public static List Scan(Stream stream) + public static List Scan(Stream stream, bool includePosition = false) { List protections = new List(); @@ -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 diff --git a/BurnOutSharp/FileType/Textfile.cs b/BurnOutSharp/FileType/Textfile.cs index 5c8c9c41..e2e535b3 100644 --- a/BurnOutSharp/FileType/Textfile.cs +++ b/BurnOutSharp/FileType/Textfile.cs @@ -32,7 +32,7 @@ namespace BurnOutSharp.FileType return false; } - public static List Scan(Stream stream) + public static List Scan(Stream stream, bool includePosition = false) { List protections = new List(); diff --git a/BurnOutSharp/FileType/Valve.cs b/BurnOutSharp/FileType/Valve.cs index ab8acd51..7c8bd1bb 100644 --- a/BurnOutSharp/FileType/Valve.cs +++ b/BurnOutSharp/FileType/Valve.cs @@ -33,7 +33,7 @@ namespace BurnOutSharp.FileType } // TODO: Add stream opening support - public static List Scan(string file) + public static List Scan(string file, bool includePosition = false) { List protections = new List(); @@ -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 diff --git a/BurnOutSharp/FileType/XZ.cs b/BurnOutSharp/FileType/XZ.cs index 9adbd845..80c83929 100644 --- a/BurnOutSharp/FileType/XZ.cs +++ b/BurnOutSharp/FileType/XZ.cs @@ -15,7 +15,7 @@ namespace BurnOutSharp.FileType return false; } - public static List Scan(Stream stream) + public static List Scan(Stream stream, bool includePosition = false) { List protections = new List(); @@ -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 diff --git a/BurnOutSharp/ProtectionFind.cs b/BurnOutSharp/ProtectionFind.cs index 815b5df5..58d77e57 100644 --- a/BurnOutSharp/ProtectionFind.cs +++ b/BurnOutSharp/ProtectionFind.cs @@ -34,7 +34,7 @@ namespace BurnOutSharp /// Path to scan for protection(s) /// Optional progress indicator that will return a float in the range from 0 to 1 /// Dictionary of filename to protection mappings, if possible - public static Dictionary Scan(string path, IProgress progress = null) + public static Dictionary Scan(string path, bool includePosition = false, IProgress progress = null) { var protections = new Dictionary(); @@ -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 + /// /// Scan an individual file for copy protection /// /// File path for scanning - public static string ScanContent(string file) + /// True to include scanned copy protection position, false otherwise (default) + 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 /// /// Generic stream to scan /// File path to be used for name checks (optional) - public static string ScanContent(Stream stream, string file = null) + /// True to include scanned copy protection position, false otherwise (default) + 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) diff --git a/BurnOutSharp/ProtectionType/ActiveMARK.cs b/BurnOutSharp/ProtectionType/ActiveMARK.cs index cf9231c4..d25e940c 100644 --- a/BurnOutSharp/ProtectionType/ActiveMARK.cs +++ b/BurnOutSharp/ProtectionType/ActiveMARK.cs @@ -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; } diff --git a/BurnOutSharp/ProtectionType/AlphaROM.cs b/BurnOutSharp/ProtectionType/AlphaROM.cs index 1d32ae1c..428622a9 100644 --- a/BurnOutSharp/ProtectionType/AlphaROM.cs +++ b/BurnOutSharp/ProtectionType/AlphaROM.cs @@ -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; } diff --git a/BurnOutSharp/ProtectionType/Armadillo.cs b/BurnOutSharp/ProtectionType/Armadillo.cs index 61d10f08..b11d2ad4 100644 --- a/BurnOutSharp/ProtectionType/Armadillo.cs +++ b/BurnOutSharp/ProtectionType/Armadillo.cs @@ -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; } diff --git a/BurnOutSharp/ProtectionType/CDCheck.cs b/BurnOutSharp/ProtectionType/CDCheck.cs index c0ce056f..3ccae6bb 100644 --- a/BurnOutSharp/ProtectionType/CDCheck.cs +++ b/BurnOutSharp/ProtectionType/CDCheck.cs @@ -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; } diff --git a/BurnOutSharp/ProtectionType/CDCops.cs b/BurnOutSharp/ProtectionType/CDCops.cs index 6f39ef2e..2df5db94 100644 --- a/BurnOutSharp/ProtectionType/CDCops.cs +++ b/BurnOutSharp/ProtectionType/CDCops.cs @@ -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; } diff --git a/BurnOutSharp/ProtectionType/CDLock.cs b/BurnOutSharp/ProtectionType/CDLock.cs index 68c1733d..66f09f81 100644 --- a/BurnOutSharp/ProtectionType/CDLock.cs +++ b/BurnOutSharp/ProtectionType/CDLock.cs @@ -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; } diff --git a/BurnOutSharp/ProtectionType/CDSHiELDSE.cs b/BurnOutSharp/ProtectionType/CDSHiELDSE.cs index 258dea06..f1244e97 100644 --- a/BurnOutSharp/ProtectionType/CDSHiELDSE.cs +++ b/BurnOutSharp/ProtectionType/CDSHiELDSE.cs @@ -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; } diff --git a/BurnOutSharp/ProtectionType/CengaProtectDVD.cs b/BurnOutSharp/ProtectionType/CengaProtectDVD.cs index 860a8aeb..f4c9be7a 100644 --- a/BurnOutSharp/ProtectionType/CengaProtectDVD.cs +++ b/BurnOutSharp/ProtectionType/CengaProtectDVD.cs @@ -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; } diff --git a/BurnOutSharp/ProtectionType/CodeLock.cs b/BurnOutSharp/ProtectionType/CodeLock.cs index 6baae3f1..041588a0 100644 --- a/BurnOutSharp/ProtectionType/CodeLock.cs +++ b/BurnOutSharp/ProtectionType/CodeLock.cs @@ -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; } diff --git a/BurnOutSharp/ProtectionType/CopyKiller.cs b/BurnOutSharp/ProtectionType/CopyKiller.cs index 34a6ed54..c2357f25 100644 --- a/BurnOutSharp/ProtectionType/CopyKiller.cs +++ b/BurnOutSharp/ProtectionType/CopyKiller.cs @@ -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; } diff --git a/BurnOutSharp/ProtectionType/Cucko.cs b/BurnOutSharp/ProtectionType/Cucko.cs index 6b91ed46..2a368baa 100644 --- a/BurnOutSharp/ProtectionType/Cucko.cs +++ b/BurnOutSharp/ProtectionType/Cucko.cs @@ -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; } diff --git a/BurnOutSharp/ProtectionType/DVDCops.cs b/BurnOutSharp/ProtectionType/DVDCops.cs index 4566bb71..a4e20e93 100644 --- a/BurnOutSharp/ProtectionType/DVDCops.cs +++ b/BurnOutSharp/ProtectionType/DVDCops.cs @@ -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; } diff --git a/BurnOutSharp/ProtectionType/EACdKey.cs b/BurnOutSharp/ProtectionType/EACdKey.cs index d4c4a8e9..e9e492f4 100644 --- a/BurnOutSharp/ProtectionType/EACdKey.cs +++ b/BurnOutSharp/ProtectionType/EACdKey.cs @@ -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; } diff --git a/BurnOutSharp/ProtectionType/EXEStealth.cs b/BurnOutSharp/ProtectionType/EXEStealth.cs index 962b1919..67c858ac 100644 --- a/BurnOutSharp/ProtectionType/EXEStealth.cs +++ b/BurnOutSharp/ProtectionType/EXEStealth.cs @@ -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; } diff --git a/BurnOutSharp/ProtectionType/GFWL.cs b/BurnOutSharp/ProtectionType/GFWL.cs index 4dc0076d..ddb0e576 100644 --- a/BurnOutSharp/ProtectionType/GFWL.cs +++ b/BurnOutSharp/ProtectionType/GFWL.cs @@ -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; } diff --git a/BurnOutSharp/ProtectionType/ImpulseReactor.cs b/BurnOutSharp/ProtectionType/ImpulseReactor.cs index 6602fabc..6210065d 100644 --- a/BurnOutSharp/ProtectionType/ImpulseReactor.cs +++ b/BurnOutSharp/ProtectionType/ImpulseReactor.cs @@ -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; diff --git a/BurnOutSharp/ProtectionType/InnoSetup.cs b/BurnOutSharp/ProtectionType/InnoSetup.cs index c259f8f2..489eec4b 100644 --- a/BurnOutSharp/ProtectionType/InnoSetup.cs +++ b/BurnOutSharp/ProtectionType/InnoSetup.cs @@ -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; } diff --git a/BurnOutSharp/ProtectionType/JoWooDXProt.cs b/BurnOutSharp/ProtectionType/JoWooDXProt.cs index 9d88f744..6c91e346 100644 --- a/BurnOutSharp/ProtectionType/JoWooDXProt.cs +++ b/BurnOutSharp/ProtectionType/JoWooDXProt.cs @@ -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; } diff --git a/BurnOutSharp/ProtectionType/KeyLock.cs b/BurnOutSharp/ProtectionType/KeyLock.cs index ddaba068..3beeac19 100644 --- a/BurnOutSharp/ProtectionType/KeyLock.cs +++ b/BurnOutSharp/ProtectionType/KeyLock.cs @@ -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; } diff --git a/BurnOutSharp/ProtectionType/LaserLock.cs b/BurnOutSharp/ProtectionType/LaserLock.cs index 860ee6de..6ec6eff6 100644 --- a/BurnOutSharp/ProtectionType/LaserLock.cs +++ b/BurnOutSharp/ProtectionType/LaserLock.cs @@ -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; } diff --git a/BurnOutSharp/ProtectionType/PECompact.cs b/BurnOutSharp/ProtectionType/PECompact.cs index 427e6356..3b7d538d 100644 --- a/BurnOutSharp/ProtectionType/PECompact.cs +++ b/BurnOutSharp/ProtectionType/PECompact.cs @@ -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; } diff --git a/BurnOutSharp/ProtectionType/ProtectDisc.cs b/BurnOutSharp/ProtectionType/ProtectDisc.cs index f820493c..0a543e0f 100644 --- a/BurnOutSharp/ProtectionType/ProtectDisc.cs +++ b/BurnOutSharp/ProtectionType/ProtectDisc.cs @@ -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; diff --git a/BurnOutSharp/ProtectionType/RingPROTECH.cs b/BurnOutSharp/ProtectionType/RingPROTECH.cs index bb94aea4..a80494bf 100644 --- a/BurnOutSharp/ProtectionType/RingPROTECH.cs +++ b/BurnOutSharp/ProtectionType/RingPROTECH.cs @@ -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; } diff --git a/BurnOutSharp/ProtectionType/SVKProtector.cs b/BurnOutSharp/ProtectionType/SVKProtector.cs index 3d14a1e0..df689d43 100644 --- a/BurnOutSharp/ProtectionType/SVKProtector.cs +++ b/BurnOutSharp/ProtectionType/SVKProtector.cs @@ -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; } diff --git a/BurnOutSharp/ProtectionType/SafeDisc.cs b/BurnOutSharp/ProtectionType/SafeDisc.cs index 79b58670..5b804264 100644 --- a/BurnOutSharp/ProtectionType/SafeDisc.cs +++ b/BurnOutSharp/ProtectionType/SafeDisc.cs @@ -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; diff --git a/BurnOutSharp/ProtectionType/SafeLock.cs b/BurnOutSharp/ProtectionType/SafeLock.cs index 71b344e7..6062d968 100644 --- a/BurnOutSharp/ProtectionType/SafeLock.cs +++ b/BurnOutSharp/ProtectionType/SafeLock.cs @@ -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; } diff --git a/BurnOutSharp/ProtectionType/SecuROM.cs b/BurnOutSharp/ProtectionType/SecuROM.cs index f9a4dac9..e3a5fce5 100644 --- a/BurnOutSharp/ProtectionType/SecuROM.cs +++ b/BurnOutSharp/ProtectionType/SecuROM.cs @@ -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; } diff --git a/BurnOutSharp/ProtectionType/SmartE.cs b/BurnOutSharp/ProtectionType/SmartE.cs index b1d41b45..a1235e51 100644 --- a/BurnOutSharp/ProtectionType/SmartE.cs +++ b/BurnOutSharp/ProtectionType/SmartE.cs @@ -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; } diff --git a/BurnOutSharp/ProtectionType/SolidShield.cs b/BurnOutSharp/ProtectionType/SolidShield.cs index 427be003..b98e7a44 100644 --- a/BurnOutSharp/ProtectionType/SolidShield.cs +++ b/BurnOutSharp/ProtectionType/SolidShield.cs @@ -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(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; } diff --git a/BurnOutSharp/ProtectionType/StarForce.cs b/BurnOutSharp/ProtectionType/StarForce.cs index 1e63511d..00aaee0c 100644 --- a/BurnOutSharp/ProtectionType/StarForce.cs +++ b/BurnOutSharp/ProtectionType/StarForce.cs @@ -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; } diff --git a/BurnOutSharp/ProtectionType/Sysiphus.cs b/BurnOutSharp/ProtectionType/Sysiphus.cs index b489de1c..648179d2 100644 --- a/BurnOutSharp/ProtectionType/Sysiphus.cs +++ b/BurnOutSharp/ProtectionType/Sysiphus.cs @@ -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; } diff --git a/BurnOutSharp/ProtectionType/Tages.cs b/BurnOutSharp/ProtectionType/Tages.cs index 70ff48fe..9819b6ea 100644 --- a/BurnOutSharp/ProtectionType/Tages.cs +++ b/BurnOutSharp/ProtectionType/Tages.cs @@ -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(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; diff --git a/BurnOutSharp/ProtectionType/ThreePLock.cs b/BurnOutSharp/ProtectionType/ThreePLock.cs index 2df5cc4a..276b085e 100644 --- a/BurnOutSharp/ProtectionType/ThreePLock.cs +++ b/BurnOutSharp/ProtectionType/ThreePLock.cs @@ -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; } diff --git a/BurnOutSharp/ProtectionType/VOBProtectCDDVD.cs b/BurnOutSharp/ProtectionType/VOBProtectCDDVD.cs index 3f1705c2..1b3366f1 100644 --- a/BurnOutSharp/ProtectionType/VOBProtectCDDVD.cs +++ b/BurnOutSharp/ProtectionType/VOBProtectCDDVD.cs @@ -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; } diff --git a/BurnOutSharp/ProtectionType/WTMCDProtect.cs b/BurnOutSharp/ProtectionType/WTMCDProtect.cs index 9ce234ea..99ab0c69 100644 --- a/BurnOutSharp/ProtectionType/WTMCDProtect.cs +++ b/BurnOutSharp/ProtectionType/WTMCDProtect.cs @@ -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; } diff --git a/BurnOutSharp/ProtectionType/WiseInstaller.cs b/BurnOutSharp/ProtectionType/WiseInstaller.cs index 7a2e0c02..32e5125a 100644 --- a/BurnOutSharp/ProtectionType/WiseInstaller.cs +++ b/BurnOutSharp/ProtectionType/WiseInstaller.cs @@ -7,18 +7,19 @@ namespace BurnOutSharp.ProtectionType { public class WiseInstaller { - public static List CheckContents(string file, byte[] fileContent) + public static List 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 protections = new List { $"Wise Installation Wizard Module (Index {position})" }; + List protections = new List { "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 Scan(string file) + public static List Scan(string file, bool includePosition = false) { List protections = new List(); @@ -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 diff --git a/BurnOutSharp/ProtectionType/XtremeProtector.cs b/BurnOutSharp/ProtectionType/XtremeProtector.cs index 56baf8e0..94355171 100644 --- a/BurnOutSharp/ProtectionType/XtremeProtector.cs +++ b/BurnOutSharp/ProtectionType/XtremeProtector.cs @@ -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; } diff --git a/BurnOutSharp/ProtectionType/dotFuscator.cs b/BurnOutSharp/ProtectionType/dotFuscator.cs index 0d5a4d84..6a3e8790 100644 --- a/BurnOutSharp/ProtectionType/dotFuscator.cs +++ b/BurnOutSharp/ProtectionType/dotFuscator.cs @@ -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; } diff --git a/Test/Program.cs b/Test/Program.cs index b0978055..3cbc871f 100644 --- a/Test/Program.cs +++ b/Test/Program.cs @@ -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"))) {