2021-03-21 22:45:06 -07:00
|
|
|
using System.Collections.Generic;
|
2022-03-14 10:40:44 -07:00
|
|
|
using BurnOutSharp.ExecutableType.Microsoft.PE;
|
2021-03-21 22:45:06 -07:00
|
|
|
using BurnOutSharp.Matching;
|
2021-03-21 23:36:01 -06:00
|
|
|
|
|
|
|
|
namespace BurnOutSharp.PackerType
|
|
|
|
|
{
|
|
|
|
|
// TODO: Add extraction and verify that all versions are detected
|
2022-03-14 11:00:17 -07:00
|
|
|
public class AdvancedInstaller : IPEContentCheck
|
2021-03-21 23:36:01 -06:00
|
|
|
{
|
2021-08-26 21:57:56 -07:00
|
|
|
/// <inheritdoc/>
|
2022-03-14 22:51:17 -07:00
|
|
|
public string CheckPEContents(string file, PortableExecutable pex, bool includeDebug)
|
2021-03-23 09:52:09 -07:00
|
|
|
{
|
2021-08-26 21:57:56 -07:00
|
|
|
// Get the sections from the executable, if possible
|
2021-08-27 09:42:05 -07:00
|
|
|
var sections = pex?.SectionTable;
|
2021-08-26 21:57:56 -07:00
|
|
|
if (sections == null)
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
// Get the .rdata section, if it exists
|
2021-09-11 16:47:25 -07:00
|
|
|
if (pex.ResourceDataSectionRaw != null)
|
2021-07-17 23:40:16 -07:00
|
|
|
{
|
2021-08-26 21:57:56 -07:00
|
|
|
var matchers = new List<ContentMatchSet>
|
2021-07-17 23:40:16 -07:00
|
|
|
{
|
2021-08-26 21:57:56 -07:00
|
|
|
// Software\Caphyon\Advanced Installer
|
2021-09-11 16:47:25 -07:00
|
|
|
new ContentMatchSet(new byte?[]
|
|
|
|
|
{
|
|
|
|
|
0x53, 0x6F, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65,
|
|
|
|
|
0x5C, 0x43, 0x61, 0x70, 0x68, 0x79, 0x6F, 0x6E,
|
|
|
|
|
0x5C, 0x41, 0x64, 0x76, 0x61, 0x6E, 0x63, 0x65,
|
|
|
|
|
0x64, 0x20, 0x49, 0x6E, 0x73, 0x74, 0x61, 0x6C,
|
|
|
|
|
0x6C, 0x65, 0x72
|
|
|
|
|
}, "Caphyon Advanced Installer"),
|
2021-08-26 21:57:56 -07:00
|
|
|
};
|
2021-07-17 23:40:16 -07:00
|
|
|
|
2021-09-11 16:47:25 -07:00
|
|
|
return MatchUtil.GetFirstMatch(file, pex.ResourceDataSectionRaw, matchers, includeDebug);
|
2021-08-26 21:57:56 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
2021-03-21 23:36:01 -06:00
|
|
|
}
|
|
|
|
|
}
|