Files
BinaryObjectScanner/BurnOutSharp/ProtectionType/ElectronicArts.cs

102 lines
4.6 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using BurnOutSharp.ExecutableType.Microsoft.PE;
2022-05-01 17:41:50 -07:00
using BurnOutSharp.Interfaces;
2021-03-21 22:19:38 -07:00
using BurnOutSharp.Matching;
2021-08-25 15:09:42 -07:00
using BurnOutSharp.Tools;
2021-03-21 22:19:38 -07:00
namespace BurnOutSharp.ProtectionType
{
// TODO: Do more research into the Cucko protection:
// - Reference to `EASTL` and `EAStdC` are standard for EA products and does not indicate Cucko by itself
// - There's little information outside of PiD detection that actually knows about Cucko
// - Look into `ccinstall`, `Services/EACOM`, `TSLHost`, `SIGS/UploadThread/exchangeAuthToken`,
// `blazeURL`, `psapi.dll`, `DasmX86Dll.dll`, `NVCPL.dll`, `iphlpapi.dll`, `dbghelp.dll`,
// `WS2_32.dll`,
2022-05-01 17:17:15 -07:00
public class ElectronicArts : IPortableExecutableCheck
{
/// <inheritdoc/>
2022-05-01 17:17:15 -07:00
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;
2022-04-02 16:12:23 -07:00
string name = pex.FileDescription;
if (!string.IsNullOrWhiteSpace(name) && name.Contains("EReg MFC Application"))
2022-04-01 10:16:31 -07:00
return $"EA CdKey Registration Module {Utilities.GetInternalVersion(pex)}";
else if (!string.IsNullOrWhiteSpace(name) && name.Contains("Registration code installer program"))
2022-04-01 10:16:31 -07:00
return $"EA CdKey Registration Module {Utilities.GetInternalVersion(pex)}";
else if (!string.IsNullOrWhiteSpace(name) && name.Equals("EA DRM Helper", StringComparison.OrdinalIgnoreCase))
2022-04-01 10:16:31 -07:00
return $"EA DRM Protection {Utilities.GetInternalVersion(pex)}";
2022-04-02 16:12:23 -07:00
name = pex.InternalName;
if (!string.IsNullOrWhiteSpace(name) && name.Equals("CDCode", StringComparison.Ordinal))
2022-04-01 10:16:31 -07:00
return $"EA CdKey Registration Module {Utilities.GetInternalVersion(pex)}";
var resource = pex.FindResource(dataContains: "A\0b\0o\0u\0t\0 \0C\0D\0K\0e\0y");
2021-09-10 21:52:31 -07:00
if (resource != null)
2022-04-01 10:16:31 -07:00
return $"EA CdKey Registration Module {Utilities.GetInternalVersion(pex)}";
2021-09-10 21:52:31 -07:00
// Get the .data section, if it exists
if (pex.DataSectionRaw != null)
{
var matchers = new List<ContentMatchSet>
{
// EReg Config Form
new ContentMatchSet(new byte?[]
{
0x45, 0x52, 0x65, 0x67, 0x20, 0x43, 0x6F, 0x6E,
0x66, 0x69, 0x67, 0x20, 0x46, 0x6F, 0x72, 0x6D
2022-04-01 10:16:31 -07:00
}, Utilities.GetInternalVersion, "EA CdKey Registration Module"),
};
string match = MatchUtil.GetFirstMatch(file, pex.DataSectionRaw, matchers, includeDebug);
if (!string.IsNullOrWhiteSpace(match))
return match;
}
// Get the .rdata section, if it exists
if (pex.ResourceDataSectionRaw != null)
{
var matchers = new List<ContentMatchSet>
{
// GenericEA + (char)0x00 + (char)0x00 + (char)0x00 + Activation
new ContentMatchSet(new byte?[]
{
0x47, 0x65, 0x6E, 0x65, 0x72, 0x69, 0x63, 0x45,
0x41, 0x00, 0x00, 0x00, 0x41, 0x63, 0x74, 0x69,
0x76, 0x61, 0x74, 0x69, 0x6F, 0x6E
}, "EA DRM Protection"),
};
2020-10-28 10:10:43 -07:00
string match = MatchUtil.GetFirstMatch(file, pex.ResourceDataSectionRaw, matchers, includeDebug);
if (!string.IsNullOrWhiteSpace(match))
return match;
}
// Get the .text section, if it exists
if (pex.TextSectionRaw != null)
{
var matchers = new List<ContentMatchSet>
{
// GenericEA + (char)0x00 + (char)0x00 + (char)0x00 + Activation
new ContentMatchSet(new byte?[]
{
0x47, 0x65, 0x6E, 0x65, 0x72, 0x69, 0x63, 0x45,
0x41, 0x00, 0x00, 0x00, 0x41, 0x63, 0x74, 0x69,
0x76, 0x61, 0x74, 0x69, 0x6F, 0x6E
}, "EA DRM Protection"),
};
string match = MatchUtil.GetFirstMatch(file, pex.TextSectionRaw, matchers, includeDebug);
if (!string.IsNullOrWhiteSpace(match))
return match;
}
return null;
}
}
}