2021-07-18 09:44:23 -07:00
|
|
|
|
using System.Collections.Concurrent;
|
|
|
|
|
|
using System.Collections.Generic;
|
2022-03-14 12:08:35 -07:00
|
|
|
|
using BurnOutSharp.ExecutableType.Microsoft.PE;
|
2021-03-22 23:02:01 -07:00
|
|
|
|
using BurnOutSharp.Matching;
|
2022-03-14 12:08:35 -07:00
|
|
|
|
using BurnOutSharp.Tools;
|
2019-09-27 23:52:24 -07:00
|
|
|
|
|
|
|
|
|
|
namespace BurnOutSharp.ProtectionType
|
|
|
|
|
|
{
|
2022-03-14 12:08:35 -07:00
|
|
|
|
public class Key2AudioXS : IPEContentCheck
|
2019-09-27 23:52:24 -07:00
|
|
|
|
{
|
2022-03-14 12:08:35 -07:00
|
|
|
|
/// <inheritdoc/>
|
2022-03-14 22:51:17 -07:00
|
|
|
|
public string CheckPEContents(string file, PortableExecutable pex, bool includeDebug)
|
2022-03-14 12:08:35 -07:00
|
|
|
|
{
|
|
|
|
|
|
// Get the sections from the executable, if possible
|
|
|
|
|
|
var sections = pex?.SectionTable;
|
|
|
|
|
|
if (sections == null)
|
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
|
|
string name = Utilities.GetFileDescription(pex);
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(name) && name.Contains("SDKHM (KEEP)"))
|
|
|
|
|
|
return "key2AudioXS";
|
|
|
|
|
|
else if (!string.IsNullOrWhiteSpace(name) && name.Contains("SDKHM (KEPT)"))
|
|
|
|
|
|
return "key2AudioXS";
|
|
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-02-26 00:32:09 -08:00
|
|
|
|
/// <inheritdoc/>
|
2021-07-18 09:44:23 -07:00
|
|
|
|
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string> files)
|
2019-09-27 23:52:24 -07:00
|
|
|
|
{
|
2021-03-19 15:41:49 -07:00
|
|
|
|
// TODO: Verify if these are OR or AND
|
2021-03-22 23:02:01 -07:00
|
|
|
|
var matchers = new List<PathMatchSet>
|
2019-09-27 23:52:24 -07:00
|
|
|
|
{
|
2021-03-22 23:02:01 -07:00
|
|
|
|
new PathMatchSet(new PathMatch("SDKHM.EXE", useEndsWith: true), "key2AudioXS"),
|
|
|
|
|
|
new PathMatchSet(new PathMatch("SDKHM.DLL", useEndsWith: true), "key2AudioXS"),
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2021-03-23 13:35:12 -07:00
|
|
|
|
return MatchUtil.GetAllMatches(files, matchers, any: true);
|
2021-03-19 15:41:49 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
|
|
public string CheckFilePath(string path)
|
|
|
|
|
|
{
|
2021-03-22 23:02:01 -07:00
|
|
|
|
var matchers = new List<PathMatchSet>
|
2019-09-27 23:52:24 -07:00
|
|
|
|
{
|
2021-03-22 23:02:01 -07:00
|
|
|
|
new PathMatchSet(new PathMatch("SDKHM.EXE", useEndsWith: true), "key2AudioXS"),
|
|
|
|
|
|
new PathMatchSet(new PathMatch("SDKHM.DLL", useEndsWith: true), "key2AudioXS"),
|
|
|
|
|
|
};
|
2019-09-27 23:52:24 -07:00
|
|
|
|
|
2021-03-22 23:02:01 -07:00
|
|
|
|
return MatchUtil.GetFirstMatch(path, matchers, any: true);
|
2019-09-27 23:52:24 -07:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|