2021-10-26 10:12:21 -07:00
|
|
|
|
using System.Collections.Concurrent;
|
|
|
|
|
|
using System.Collections.Generic;
|
2022-05-01 17:41:50 -07:00
|
|
|
|
using BurnOutSharp.Interfaces;
|
2021-03-21 15:34:19 -07:00
|
|
|
|
using BurnOutSharp.Matching;
|
2021-03-21 14:30:37 -07:00
|
|
|
|
|
|
|
|
|
|
namespace BurnOutSharp.ProtectionType
|
2019-09-27 23:52:24 -07:00
|
|
|
|
{
|
2021-09-14 23:01:44 -07:00
|
|
|
|
// Renamed to ProRing at some point
|
2021-10-26 10:12:21 -07:00
|
|
|
|
public class RingPROTECH : IContentCheck, IPathCheck
|
2019-09-27 23:52:24 -07:00
|
|
|
|
{
|
2021-03-23 09:52:09 -07:00
|
|
|
|
/// <inheritdoc/>
|
2022-05-01 17:17:15 -07:00
|
|
|
|
public string CheckContents(string file, byte[] fileContent, bool includeDebug)
|
2021-03-23 09:52:09 -07:00
|
|
|
|
{
|
2021-09-02 00:54:36 -07:00
|
|
|
|
// TODO: Obtain a sample to find where this string is in a typical executable
|
2022-03-02 08:56:26 -08:00
|
|
|
|
if (includeDebug)
|
|
|
|
|
|
{
|
|
|
|
|
|
var contentMatchSets = new List<ContentMatchSet>
|
|
|
|
|
|
{
|
|
|
|
|
|
// (char)0x00 + Allocator + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00
|
|
|
|
|
|
new ContentMatchSet(new byte?[]
|
|
|
|
|
|
{
|
|
|
|
|
|
0x00, 0x41, 0x6C, 0x6C, 0x6F, 0x63, 0x61, 0x74,
|
|
|
|
|
|
0x6F, 0x72, 0x00, 0x00, 0x00, 0x00
|
|
|
|
|
|
}, "Ring PROTECH / ProRing [Check disc for physical ring]"),
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
return MatchUtil.GetFirstMatch(file, fileContent, contentMatchSets, includeDebug);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-02-04 15:24:05 -08:00
|
|
|
|
return null;
|
2021-09-10 15:32:37 -07:00
|
|
|
|
}
|
2021-10-26 10:12:21 -07:00
|
|
|
|
|
|
|
|
|
|
// TODO: Confirm if these checks are only for ProRing or if they are also for older Ring PROTECH
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
|
|
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string> files)
|
|
|
|
|
|
{
|
|
|
|
|
|
var matchers = new List<PathMatchSet>
|
|
|
|
|
|
{
|
|
|
|
|
|
new PathMatchSet(new PathMatch("protect.pro", useEndsWith: true), "Ring PROTECH / ProRing [Check disc for physical ring]"),
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
return MatchUtil.GetAllMatches(files, matchers, any: true);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
|
|
public string CheckFilePath(string path)
|
|
|
|
|
|
{
|
|
|
|
|
|
var matchers = new List<PathMatchSet>
|
|
|
|
|
|
{
|
|
|
|
|
|
new PathMatchSet(new PathMatch("protect.pro", useEndsWith: true), "Ring PROTECH / ProRing [Check disc for physical ring]"),
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
return MatchUtil.GetFirstMatch(path, matchers, any: true);
|
|
|
|
|
|
}
|
2019-09-27 23:52:24 -07:00
|
|
|
|
}
|
|
|
|
|
|
}
|