2021-08-30 15:08:14 -07:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
2022-12-03 22:17:48 -08:00
|
|
|
|
using System.Linq;
|
2023-03-09 11:52:28 -05:00
|
|
|
|
using BinaryObjectScanner.Interfaces;
|
2023-03-07 16:59:14 -05:00
|
|
|
|
using BinaryObjectScanner.Wrappers;
|
2021-03-21 22:19:38 -07:00
|
|
|
|
|
2023-03-09 23:19:27 -05:00
|
|
|
|
namespace BinaryObjectScanner.Protection
|
2019-09-27 23:52:24 -07:00
|
|
|
|
{
|
2022-05-01 17:17:15 -07:00
|
|
|
|
public class ElectronicArts : IPortableExecutableCheck
|
2019-09-27 23:52:24 -07:00
|
|
|
|
{
|
2021-08-30 15:08:14 -07:00
|
|
|
|
/// <inheritdoc/>
|
2022-05-01 17:17:15 -07:00
|
|
|
|
public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug)
|
2021-08-30 15:08:14 -07:00
|
|
|
|
{
|
|
|
|
|
|
// 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;
|
2022-08-21 20:34:59 -07:00
|
|
|
|
if (name?.Contains("EReg MFC Application") == true)
|
2023-03-09 23:19:27 -05:00
|
|
|
|
return $"EA CdKey Registration Module {pex.GetInternalVersion()}";
|
2022-08-21 20:34:59 -07:00
|
|
|
|
else if (name?.Contains("Registration code installer program") == true)
|
2023-03-09 23:19:27 -05:00
|
|
|
|
return $"EA CdKey Registration Module {pex.GetInternalVersion()}";
|
2022-08-21 20:34:59 -07:00
|
|
|
|
else if (name?.Equals("EA DRM Helper", StringComparison.OrdinalIgnoreCase) == true)
|
2023-03-09 23:19:27 -05:00
|
|
|
|
return $"EA DRM Protection {pex.GetInternalVersion()}";
|
2021-09-10 13:51:32 -07:00
|
|
|
|
|
2022-04-02 16:12:23 -07:00
|
|
|
|
name = pex.InternalName;
|
2022-08-21 20:34:59 -07:00
|
|
|
|
if (name?.Equals("CDCode", StringComparison.Ordinal) == true)
|
2023-03-09 23:19:27 -05:00
|
|
|
|
return $"EA CdKey Registration Module {pex.GetInternalVersion()}";
|
2021-09-10 13:51:32 -07:00
|
|
|
|
|
2022-12-03 22:17:48 -08:00
|
|
|
|
if (pex.FindDialogByTitle("About CDKey").Any())
|
2023-03-09 23:19:27 -05:00
|
|
|
|
return $"EA CdKey Registration Module {pex.GetInternalVersion()}";
|
2022-12-03 23:17:29 -08:00
|
|
|
|
else if (pex.FindGenericResource("About CDKey").Any())
|
2023-03-09 23:19:27 -05:00
|
|
|
|
return $"EA CdKey Registration Module {pex.GetInternalVersion()}";
|
2021-09-10 21:52:31 -07:00
|
|
|
|
|
2022-12-09 14:21:18 -08:00
|
|
|
|
// Get the .data/DATA section strings, if they exist
|
|
|
|
|
|
List<string> strs = pex.GetFirstSectionStrings(".data") ?? pex.GetFirstSectionStrings("DATA");
|
|
|
|
|
|
if (strs != null)
|
2021-08-30 15:08:14 -07:00
|
|
|
|
{
|
2022-12-09 14:21:18 -08:00
|
|
|
|
if (strs.Any(s => s.Contains("EReg Config Form")))
|
|
|
|
|
|
return "EA CdKey Registration Module";
|
2021-08-30 15:08:14 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-12-09 14:21:18 -08:00
|
|
|
|
// Get the .rdata section strings, if they exist
|
|
|
|
|
|
strs = pex.GetFirstSectionStrings(".rdata");
|
|
|
|
|
|
if (strs != null)
|
2021-08-30 15:08:14 -07:00
|
|
|
|
{
|
2022-12-09 14:21:18 -08:00
|
|
|
|
if (strs.Any(s => s.Contains("GenericEA")) && strs.Any(s => s.Contains("Activation")))
|
|
|
|
|
|
return "EA DRM Protection";
|
2021-08-30 15:08:14 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-12-09 14:21:18 -08:00
|
|
|
|
// Get the .rdata section strings, if they exist
|
|
|
|
|
|
strs = pex.GetFirstSectionStrings(".text");
|
|
|
|
|
|
if (strs != null)
|
2021-08-30 15:08:14 -07:00
|
|
|
|
{
|
2022-12-09 14:21:18 -08:00
|
|
|
|
if (strs.Any(s => s.Contains("GenericEA")) && strs.Any(s => s.Contains("Activation")))
|
|
|
|
|
|
return "EA DRM Protection";
|
2021-08-30 15:08:14 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
2019-09-27 23:52:24 -07:00
|
|
|
|
}
|
|
|
|
|
|
}
|