mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-09-22 23:05:03 +00:00
Fix static matcher issues (fixes #51)
Note: This may result in slower, but more accurate, scans
This commit is contained in:
@@ -7,55 +7,52 @@ namespace BurnOutSharp.ProtectionType
|
||||
{
|
||||
public class SecuROM : IContentCheck, IPathCheck
|
||||
{
|
||||
/// <summary>
|
||||
/// Set of all ContentMatchSets for this protection
|
||||
/// </summary>
|
||||
private static readonly List<ContentMatchSet> contentMatchers = new List<ContentMatchSet>
|
||||
{
|
||||
// AddD + (char)0x03 + (char)0x00 + (char)0x00 + (char)0x00)
|
||||
new ContentMatchSet(new byte?[] { 0x41, 0x64, 0x64, 0x44, 0x03, 0x00, 0x00, 0x00 }, GetV4Version, "SecuROM"),
|
||||
|
||||
// (char)0xCA + (char)0xDD + (char)0xDD + (char)0xAC + (char)0x03
|
||||
new ContentMatchSet(new byte?[] { 0xCA, 0xDD, 0xDD, 0xAC, 0x03 }, GetV5Version, "SecuROM"),
|
||||
|
||||
// .securom + (char)0xE0 + (char)0xC0
|
||||
new ContentMatchSet(new byte?[]
|
||||
{
|
||||
0x2E, 0x73, 0x65, 0x63, 0x75, 0x72, 0x6F, 0x6D,
|
||||
0xE0, 0xC0
|
||||
}, GetV7Version, "SecuROM"),
|
||||
|
||||
// .securom
|
||||
new ContentMatchSet(new byte?[] { 0x2E, 0x73, 0x65, 0x63, 0x75, 0x72, 0x6F, 0x6D }, GetV7Version, "SecuROM"),
|
||||
|
||||
// _and_play.dll + (char)0x00 + drm_pagui_doit
|
||||
new ContentMatchSet(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
|
||||
}, Utilities.GetFileVersion, "SecuROM Product Activation"),
|
||||
|
||||
// S + (char)0x00 + e + (char)0x00 + c + (char)0x00 + u + (char)0x00 + R + (char)0x00 + O + (char)0x00 + M + (char)0x00 + + (char)0x00 + P + (char)0x00 + A + (char)0x00
|
||||
new ContentMatchSet(new byte?[]
|
||||
{
|
||||
0x53, 0x00, 0x65, 0x00, 0x63, 0x00, 0x75, 0x00,
|
||||
0x52, 0x00, 0x4F, 0x00, 0x4D, 0x00, 0x20, 0x00,
|
||||
0x50, 0x00, 0x41, 0x00
|
||||
}, Utilities.GetFileVersion, "SecuROM Product Activation"),
|
||||
|
||||
// .cms_t + (char)0x00
|
||||
new ContentMatchSet(new byte?[] { 0x2E, 0x63, 0x6D, 0x73, 0x5F, 0x74, 0x00 }, "SecuROM 1-3"),
|
||||
|
||||
// .cms_d + (char)0x00
|
||||
new ContentMatchSet(new byte?[] { 0x2E, 0x63, 0x6D, 0x73, 0x5F, 0x64, 0x00 }, "SecuROM 1-3"),
|
||||
};
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string CheckContents(string file, byte[] fileContent, bool includePosition = false)
|
||||
{
|
||||
return MatchUtil.GetFirstMatch(file, fileContent, contentMatchers, includePosition);
|
||||
var matchers = new List<ContentMatchSet>
|
||||
{
|
||||
// AddD + (char)0x03 + (char)0x00 + (char)0x00 + (char)0x00)
|
||||
new ContentMatchSet(new byte?[] { 0x41, 0x64, 0x64, 0x44, 0x03, 0x00, 0x00, 0x00 }, GetV4Version, "SecuROM"),
|
||||
|
||||
// (char)0xCA + (char)0xDD + (char)0xDD + (char)0xAC + (char)0x03
|
||||
new ContentMatchSet(new byte?[] { 0xCA, 0xDD, 0xDD, 0xAC, 0x03 }, GetV5Version, "SecuROM"),
|
||||
|
||||
// .securom + (char)0xE0 + (char)0xC0
|
||||
new ContentMatchSet(new byte?[]
|
||||
{
|
||||
0x2E, 0x73, 0x65, 0x63, 0x75, 0x72, 0x6F, 0x6D,
|
||||
0xE0, 0xC0
|
||||
}, GetV7Version, "SecuROM"),
|
||||
|
||||
// .securom
|
||||
new ContentMatchSet(new byte?[] { 0x2E, 0x73, 0x65, 0x63, 0x75, 0x72, 0x6F, 0x6D }, GetV7Version, "SecuROM"),
|
||||
|
||||
// _and_play.dll + (char)0x00 + drm_pagui_doit
|
||||
new ContentMatchSet(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
|
||||
}, Utilities.GetFileVersion, "SecuROM Product Activation"),
|
||||
|
||||
// S + (char)0x00 + e + (char)0x00 + c + (char)0x00 + u + (char)0x00 + R + (char)0x00 + O + (char)0x00 + M + (char)0x00 + + (char)0x00 + P + (char)0x00 + A + (char)0x00
|
||||
new ContentMatchSet(new byte?[]
|
||||
{
|
||||
0x53, 0x00, 0x65, 0x00, 0x63, 0x00, 0x75, 0x00,
|
||||
0x52, 0x00, 0x4F, 0x00, 0x4D, 0x00, 0x20, 0x00,
|
||||
0x50, 0x00, 0x41, 0x00
|
||||
}, Utilities.GetFileVersion, "SecuROM Product Activation"),
|
||||
|
||||
// .cms_t + (char)0x00
|
||||
new ContentMatchSet(new byte?[] { 0x2E, 0x63, 0x6D, 0x73, 0x5F, 0x74, 0x00 }, "SecuROM 1-3"),
|
||||
|
||||
// .cms_d + (char)0x00
|
||||
new ContentMatchSet(new byte?[] { 0x2E, 0x63, 0x6D, 0x73, 0x5F, 0x64, 0x00 }, "SecuROM 1-3"),
|
||||
};
|
||||
|
||||
return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
Reference in New Issue
Block a user