From 9c27da72bb28773740feff6fb29a791c196a250a Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Mon, 4 Nov 2024 09:38:25 -0500 Subject: [PATCH] Add VOB-PCD.KEY detection --- BinaryObjectScanner/Protection/ProtectDisc.cs | 27 ++++++++++++++++++- README.md | 2 +- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/BinaryObjectScanner/Protection/ProtectDisc.cs b/BinaryObjectScanner/Protection/ProtectDisc.cs index 04cda66e..8c53c29a 100644 --- a/BinaryObjectScanner/Protection/ProtectDisc.cs +++ b/BinaryObjectScanner/Protection/ProtectDisc.cs @@ -4,13 +4,14 @@ using System.Linq; using BinaryObjectScanner.Interfaces; using SabreTools.Matching; using SabreTools.Matching.Content; +using SabreTools.Matching.Paths; using SabreTools.Serialization.Wrappers; namespace BinaryObjectScanner.Protection { // This protection was called VOB ProtectCD / ProtectDVD in versions prior to 6 // ProtectDISC 9/10 checks for the presence of CSS on the disc to run, but don't encrypt any sectors or check for keys. Confirmed in Redump entries 78367 and 110095. - public class ProtectDISC : IPortableExecutableCheck + public class ProtectDISC : IPortableExecutableCheck, IPathCheck { /// public string? CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) @@ -95,6 +96,30 @@ namespace BinaryObjectScanner.Protection return null; } + /// + public IEnumerable CheckDirectoryPath(string path, IEnumerable? files) + { + var matchers = new List + { + // https://github.com/SabreTools/BinaryObjectScanner/issues/110 + new(new FilePathMatch("VOB-PCD.KEY"), "VOB ProtectCD/DVD"), + }; + + return MatchUtil.GetAllMatches(files, matchers, any: false); + } + + /// + public string? CheckFilePath(string path) + { + var matchers = new List + { + // https://github.com/SabreTools/BinaryObjectScanner/issues/110 + new(new FilePathMatch("VOB-PCD.KEY"), "VOB ProtectCD/DVD"), + }; + + return MatchUtil.GetFirstMatch(path, matchers, any: true); + } + public static string GetOldVersion(string matchedString) { // Remove unnecessary parts diff --git a/README.md b/README.md index 340fa263..17b6d029 100644 --- a/README.md +++ b/README.md @@ -114,7 +114,7 @@ Below is a list of protections detected by BinaryObjectScanner. The two columns | Origin | True | True | | | phenoProtect | False | False | Text file check only | | PlayJ | True | True | | -| ProtectDISC / VOB ProtectCD/DVD | True | False | | +| ProtectDISC / VOB ProtectCD/DVD | True | True | | | Protect DVD-Video | False | True | Unconfirmed¹ | | PlayStation Anti-modchip | True | False | En/Jp, not "Red Hand"; PSX executables only | | Rainbow Sentinel | True | True | |