2021-10-26 10:12:21 -07:00
|
|
|
|
using System.Collections.Concurrent;
|
|
|
|
|
|
using System.Collections.Generic;
|
2023-03-09 11:52:28 -05:00
|
|
|
|
using BinaryObjectScanner.Interfaces;
|
2023-03-07 16:59:14 -05:00
|
|
|
|
using BinaryObjectScanner.Matching;
|
2021-03-21 14:30:37 -07:00
|
|
|
|
|
2023-03-09 23:19:27 -05:00
|
|
|
|
namespace BinaryObjectScanner.Protection
|
2019-09-27 23:52:24 -07:00
|
|
|
|
{
|
2021-09-14 23:01:44 -07:00
|
|
|
|
// Renamed to ProRing at some point
|
2022-10-13 21:58:49 -06:00
|
|
|
|
// TODO: Investigate Redump entry 82475, which PiD detects as having "Optgraph Copy-X / Ring-Protech".
|
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
|
2022-10-13 21:58:49 -06:00
|
|
|
|
}, "Ring PROTECH / ProRing [Check disc for physical ring] (Unconfirmed - Please report to us on Github)"),
|
2022-03-02 08:56:26 -08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
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>
|
|
|
|
|
|
{
|
2022-10-13 21:58:49 -06:00
|
|
|
|
// Found in Redump entry 94161
|
2021-10-26 10:12:21 -07:00
|
|
|
|
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>
|
|
|
|
|
|
{
|
2022-10-13 21:58:49 -06:00
|
|
|
|
// Found in Redump entry 94161
|
2021-10-26 10:12:21 -07:00
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
}
|