From 841a39c6c70a3b75f97d19a37c79cc07ac882931 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Sun, 21 Nov 2021 21:18:56 -0800 Subject: [PATCH] Overhaul SafeLock checks --- BurnOutSharp/ProtectionType/SafeLock.cs | 29 ++++++++----------------- README.md | 2 +- 2 files changed, 10 insertions(+), 21 deletions(-) diff --git a/BurnOutSharp/ProtectionType/SafeLock.cs b/BurnOutSharp/ProtectionType/SafeLock.cs index 7f8a3ed3..8752ea94 100644 --- a/BurnOutSharp/ProtectionType/SafeLock.cs +++ b/BurnOutSharp/ProtectionType/SafeLock.cs @@ -1,36 +1,23 @@ using System.Collections.Concurrent; using System.Collections.Generic; -using BurnOutSharp.ExecutableType.Microsoft; using BurnOutSharp.Matching; namespace BurnOutSharp.ProtectionType { - public class SafeLock : IContentCheck, IPathCheck + // https://www.cdrinfo.pl/cdr/porady/safelock/safelock.php3 + public class SafeLock : IPathCheck { - /// - public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) - { - // TODO: Obtain a sample to find where this string is in a typical executable - // TODO: Re-enable when there's a more accurate version of this - // var contentMatchSets = new List - // { - // // SafeLock - // new ContentMatchSet(new byte?[] { 0x53, 0x61, 0x66, 0x65, 0x4C, 0x6F, 0x63, 0x6B }, "SafeLock"), - // }; - - // return MatchUtil.GetFirstMatch(file, fileContent, contentMatchSets, includeDebug); - return null; - } - /// public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable files) { - // TODO: Verify if these are OR or AND + // Technically all need to exist but some might be renamed var matchers = new List { - new PathMatchSet(new PathMatch("SafeLock.dat", useEndsWith: true), "SafeLock"), + new PathMatchSet(new PathMatch("SafeLock.DAT", useEndsWith: true), "SafeLock"), new PathMatchSet(new PathMatch("SafeLock.001", useEndsWith: true), "SafeLock"), + new PathMatchSet(new PathMatch("SafeLock.002", useEndsWith: true), "SafeLock"), new PathMatchSet(new PathMatch("SafeLock.128", useEndsWith: true), "SafeLock"), + new PathMatchSet(new PathMatch("SafeLock.256", useEndsWith: true), "SafeLock"), }; return MatchUtil.GetAllMatches(files, matchers, any: true); @@ -41,9 +28,11 @@ namespace BurnOutSharp.ProtectionType { var matchers = new List { - new PathMatchSet(new PathMatch("SafeLock.dat", useEndsWith: true), "SafeLock"), + new PathMatchSet(new PathMatch("SafeLock.DAT", useEndsWith: true), "SafeLock"), new PathMatchSet(new PathMatch("SafeLock.001", useEndsWith: true), "SafeLock"), + new PathMatchSet(new PathMatch("SafeLock.002", useEndsWith: true), "SafeLock"), new PathMatchSet(new PathMatch("SafeLock.128", useEndsWith: true), "SafeLock"), + new PathMatchSet(new PathMatch("SafeLock.256", useEndsWith: true), "SafeLock"), }; return MatchUtil.GetFirstMatch(path, matchers, any: true); diff --git a/README.md b/README.md index b5572786..108a3d33 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ Below is a list of protections detected by BurnOutSharp. The two columns explain | PlayStation Anti-modchip | True | False | En/Jp, not "Red Hand"; PSX executables only | | Ring PROTECH / ProRing | True | False | Unconfirmed¹ | | SafeDisc / SafeCast | True | True | Can't distinguish between some versions of SafeDisc and SafeCast | -| SafeLock | False | True | Unconfirmed, content checks disabled¹ | +| SafeLock | False | True | Unconfirmed¹ | | SecuROM | True | True | v8.x and White Label detected incorrectly² | | SmartE | True | True | | | SoftLock | False | True | Unconfirmed¹ |