2023-03-09 11:52:28 -05:00
|
|
|
|
using BinaryObjectScanner.Interfaces;
|
2023-03-07 16:59:14 -05:00
|
|
|
|
using BinaryObjectScanner.Wrappers;
|
2022-12-28 23:28:38 -08:00
|
|
|
|
|
2023-03-09 23:19:27 -05:00
|
|
|
|
namespace BinaryObjectScanner.Protection
|
2019-09-27 23:52:24 -07:00
|
|
|
|
{
|
2022-12-28 23:28:38 -08:00
|
|
|
|
// http://www.crypkey.com/products/cdlock/cdmain.html
|
|
|
|
|
|
// https://github.com/horsicq/Detect-It-Easy/blob/master/db/PE/CrypKey%20Installer.1.sg
|
|
|
|
|
|
// https://github.com/horsicq/Detect-It-Easy/blob/master/db/PE/CrypKey.2.sg
|
|
|
|
|
|
// https://github.com/wolfram77web/app-peid/blob/master/userdb.txt
|
|
|
|
|
|
public class CrypKey : IPortableExecutableCheck
|
2019-09-27 23:52:24 -07:00
|
|
|
|
{
|
2022-12-28 23:28:38 -08:00
|
|
|
|
/// <inheritdoc/>
|
|
|
|
|
|
public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug)
|
|
|
|
|
|
{
|
|
|
|
|
|
// Get the sections from the executable, if possible
|
|
|
|
|
|
var sections = pex?.SectionTable;
|
|
|
|
|
|
if (sections == null)
|
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
|
|
// Get the CrypKey version from the VersionInfo, if it exists
|
|
|
|
|
|
string version = pex.GetVersionInfoString("CrypKey Version") ?? string.Empty;
|
|
|
|
|
|
|
|
|
|
|
|
// Found in 'cki32k.dll'
|
|
|
|
|
|
string name = pex.CompanyName;
|
|
|
|
|
|
if (name?.StartsWith("CrypKey") == true)
|
|
|
|
|
|
return $"CrypKey {version}".TrimEnd();
|
|
|
|
|
|
|
|
|
|
|
|
// Found in 'cki32k.dll'
|
|
|
|
|
|
name = pex.FileDescription;
|
|
|
|
|
|
if (name?.StartsWith("CrypKey") == true)
|
|
|
|
|
|
return $"CrypKey {version}".TrimEnd();
|
|
|
|
|
|
|
|
|
|
|
|
// Found in 'cki32k.dll'
|
|
|
|
|
|
name = pex.LegalCopyright;
|
|
|
|
|
|
if (name?.Contains("CrypKey") == true)
|
|
|
|
|
|
return $"CrypKey {version}".TrimEnd();
|
|
|
|
|
|
|
|
|
|
|
|
// Found in 'cki32k.dll'
|
|
|
|
|
|
if (!string.IsNullOrEmpty(version))
|
|
|
|
|
|
return $"CrypKey {version}".TrimEnd();
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: Look into the `.loader`,`.wreloc`, `.widata`, and `.hooks` sections
|
2022-06-22 09:50:16 -07:00
|
|
|
|
|
2022-12-28 23:28:38 -08:00
|
|
|
|
return null;
|
|
|
|
|
|
}
|
2019-09-27 23:52:24 -07:00
|
|
|
|
}
|
|
|
|
|
|
}
|