mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-02-12 05:35:17 +00:00
This change also removes a couple of things from `BurnOutSharp.Tools.Utilities` that are no longer needed there. Linear executables are included in the scanning classes. Update the guides accordingly.
64 lines
2.6 KiB
C#
64 lines
2.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using BinaryObjectScanner.Interfaces;
|
|
using BinaryObjectScanner.Wrappers;
|
|
|
|
namespace BinaryObjectScanner.Protection
|
|
{
|
|
public class ElectronicArts : IPortableExecutableCheck
|
|
{
|
|
/// <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;
|
|
|
|
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()}";
|
|
|
|
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()}";
|
|
else if (pex.FindGenericResource("About CDKey").Any())
|
|
return $"EA CdKey Registration Module {pex.GetInternalVersion()}";
|
|
|
|
// Get the .data/DATA section strings, if they exist
|
|
List<string> strs = pex.GetFirstSectionStrings(".data") ?? pex.GetFirstSectionStrings("DATA");
|
|
if (strs != null)
|
|
{
|
|
if (strs.Any(s => s.Contains("EReg Config Form")))
|
|
return "EA CdKey Registration Module";
|
|
}
|
|
|
|
// Get the .rdata section strings, if they exist
|
|
strs = pex.GetFirstSectionStrings(".rdata");
|
|
if (strs != null)
|
|
{
|
|
if (strs.Any(s => s.Contains("GenericEA")) && strs.Any(s => s.Contains("Activation")))
|
|
return "EA DRM Protection";
|
|
}
|
|
|
|
// Get the .rdata section strings, if they exist
|
|
strs = pex.GetFirstSectionStrings(".text");
|
|
if (strs != null)
|
|
{
|
|
if (strs.Any(s => s.Contains("GenericEA")) && strs.Any(s => s.Contains("Activation")))
|
|
return "EA DRM Protection";
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|
|
}
|