Files

64 lines
2.6 KiB
C#
Raw Permalink Normal View History

using System;
using System.Collections.Generic;
using System.Linq;
using BinaryObjectScanner.Interfaces;
2023-03-07 16:59:14 -05:00
using BinaryObjectScanner.Wrappers;
2021-03-21 22:19:38 -07:00
namespace BinaryObjectScanner.Protection
{
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 (name?.Contains("EReg MFC Application") == true)
return $"EA CdKey Registration Module {pex.GetInternalVersion()}";
else if (name?.Contains("Registration code installer program") == true)
return $"EA CdKey Registration Module {pex.GetInternalVersion()}";
else if (name?.Equals("EA DRM Helper", StringComparison.OrdinalIgnoreCase) == true)
return $"EA DRM Protection {pex.GetInternalVersion()}";
2022-04-02 16:12:23 -07:00
name = pex.InternalName;
if (name?.Equals("CDCode", StringComparison.Ordinal) == true)
return $"EA CdKey Registration Module {pex.GetInternalVersion()}";
if (pex.FindDialogByTitle("About CDKey").Any())
return $"EA CdKey Registration Module {pex.GetInternalVersion()}";
2022-12-03 23:17:29 -08:00
else if (pex.FindGenericResource("About CDKey").Any())
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)
{
2022-12-09 14:21:18 -08:00
if (strs.Any(s => s.Contains("EReg Config Form")))
return "EA CdKey Registration Module";
}
2022-12-09 14:21:18 -08:00
// Get the .rdata section strings, if they exist
strs = pex.GetFirstSectionStrings(".rdata");
if (strs != null)
{
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";
}
2022-12-09 14:21:18 -08:00
// Get the .rdata section strings, if they exist
strs = pex.GetFirstSectionStrings(".text");
if (strs != null)
{
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";
}
return null;
}
}
}