using System; using System.Collections.Generic; using System.Linq; using BurnOutSharp.ExecutableType.Microsoft; using BurnOutSharp.Matching; namespace BurnOutSharp.ProtectionType { public class DVDCops : IContentCheck { /// private List GetContentMatchSets() { // TODO: Obtain a sample to find where this string is in a typical executable return new List { // DVD-Cops, ver. new ContentMatchSet(new byte?[] { 0x44, 0x56, 0x44, 0x2D, 0x43, 0x6F, 0x70, 0x73, 0x2C, 0x20, 0x20, 0x76, 0x65, 0x72, 0x2E, 0x20 }, GetVersion, "DVD-Cops"), }; } /// TODO: Does this look for the `.grand` section like CD-Cops? /// public string CheckContents(string file, byte[] fileContent, bool includeDebug, PortableExecutable pex, NewExecutable nex) { var contentMatchSets = GetContentMatchSets(); if (contentMatchSets != null && contentMatchSets.Any()) return MatchUtil.GetFirstMatch(file, fileContent, contentMatchSets, includeDebug); return null; } public static string GetVersion(string file, byte[] fileContent, List positions) { char[] version = new ArraySegment(fileContent, positions[0] + 15, 4).Select(b => (char)b).ToArray(); if (version[0] == 0x00) return string.Empty; return new string(version); } } }