2021-03-21 14:30:37 -07:00
|
|
|
|
using System.Collections.Generic;
|
2022-03-14 10:40:44 -07:00
|
|
|
|
using BurnOutSharp.ExecutableType.Microsoft.PE;
|
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
|
|
|
|
{
|
2022-05-01 17:17:15 -07:00
|
|
|
|
public class CDSHiELDSE : IPortableExecutableCheck
|
2019-09-27 23:52:24 -07:00
|
|
|
|
{
|
2021-02-26 01:26:49 -08:00
|
|
|
|
/// <inheritdoc/>
|
2022-05-01 17:17:15 -07:00
|
|
|
|
public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug)
|
2019-09-27 23:52:24 -07:00
|
|
|
|
{
|
2021-09-15 11:01:51 -07:00
|
|
|
|
// Get the sections from the executable, if possible
|
|
|
|
|
|
var sections = pex?.SectionTable;
|
|
|
|
|
|
if (sections == null)
|
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
|
|
// Get the code/CODE section, if it exists
|
2022-03-14 23:01:06 -07:00
|
|
|
|
var codeSectionRaw = pex.ReadRawSection("code", first: true) ?? pex.ReadRawSection("CODE", first: true);
|
2021-09-15 11:01:51 -07:00
|
|
|
|
if (codeSectionRaw != null)
|
2021-07-17 23:40:16 -07:00
|
|
|
|
{
|
2021-09-15 11:01:51 -07:00
|
|
|
|
var matchers = new List<ContentMatchSet>
|
|
|
|
|
|
{
|
|
|
|
|
|
// ~0017.tmp
|
|
|
|
|
|
new ContentMatchSet(new byte?[] { 0x7E, 0x30, 0x30, 0x31, 0x37, 0x2E, 0x74, 0x6D, 0x70 }, "CDSHiELD SE"),
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
string match = MatchUtil.GetFirstMatch(file, codeSectionRaw, matchers, includeDebug);
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(match))
|
|
|
|
|
|
return match;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return null;
|
2021-09-10 15:32:37 -07:00
|
|
|
|
}
|
2019-09-27 23:52:24 -07:00
|
|
|
|
}
|
|
|
|
|
|
}
|