2021-08-29 21:40:25 -07:00
|
|
|
|
using System;
|
2023-03-09 11:52:28 -05:00
|
|
|
|
using BinaryObjectScanner.Interfaces;
|
2023-09-16 02:04:47 -04:00
|
|
|
|
using SabreTools.Serialization.Wrappers;
|
2021-03-31 19:07:00 -07:00
|
|
|
|
|
2023-03-09 23:19:27 -05:00
|
|
|
|
namespace BinaryObjectScanner.Protection
|
2021-03-31 19:07:00 -07:00
|
|
|
|
{
|
2022-05-01 17:17:15 -07:00
|
|
|
|
public class CDKey : IPortableExecutableCheck
|
2021-03-31 19:07:00 -07:00
|
|
|
|
{
|
2021-08-25 19:37:32 -07:00
|
|
|
|
/// <inheritdoc/>
|
2023-09-17 22:37:01 -04:00
|
|
|
|
#if NET48
|
2022-05-01 17:17:15 -07:00
|
|
|
|
public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug)
|
2023-09-17 22:37:01 -04:00
|
|
|
|
#else
|
|
|
|
|
|
public string? CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug)
|
|
|
|
|
|
#endif
|
2021-08-29 21:40:25 -07:00
|
|
|
|
{
|
2021-08-30 14:24:16 -07:00
|
|
|
|
// Get the sections from the executable, if possible
|
2023-09-17 22:37:01 -04:00
|
|
|
|
var sections = pex.Model.SectionTable;
|
2021-08-30 14:24:16 -07:00
|
|
|
|
if (sections == null)
|
|
|
|
|
|
return null;
|
|
|
|
|
|
|
2023-09-17 22:37:01 -04:00
|
|
|
|
var name = pex.InternalName;
|
2022-08-21 20:34:59 -07:00
|
|
|
|
if (name?.Equals("CDKey", StringComparison.OrdinalIgnoreCase) == true)
|
2021-09-10 13:51:32 -07:00
|
|
|
|
return "CD-Key / Serial";
|
2021-08-30 14:24:16 -07:00
|
|
|
|
|
2021-08-29 21:40:25 -07:00
|
|
|
|
return null;
|
|
|
|
|
|
}
|
2021-03-31 19:07:00 -07:00
|
|
|
|
}
|
|
|
|
|
|
}
|