4
4
using System . Linq ;
5
5
#endif
6
6
using System . Text ;
7
+ using System . Text . RegularExpressions ;
7
8
using BinaryObjectScanner . Interfaces ;
8
9
using SabreTools . Matching ;
9
10
using SabreTools . Matching . Content ;
@@ -64,35 +65,12 @@ namespace BinaryObjectScanner.Protection
64
65
///
65
66
/// List of applications that have CD/DVD/WEB-Cops relating to a Windows update: https://www.betaarchive.com/wiki/index.php/Microsoft_KB_Archive/924867
66
67
/// </summary>
67
-
68
- public class CDDVDCops : IContentCheck , IExecutableCheck < NewExecutable > , IExecutableCheck < PortableExecutable > , IPathCheck
68
+ // TODO: Investigate reference to "CD32COPS.DLL" in "WETFLIPP.QZ_" in IA item "Triada_Russian_DVD_Complete_Collection_of_Erotic_Games".
69
+ // TODO: Investigate cdcode.key for redump ID 108167, may be key-less cd-cops?
70
+ // TODO: Document update 12 for redump ID 108167 bumping version, adding key, adding vista(?) support
71
+
72
+ public class CDDVDCops : IExecutableCheck < NewExecutable > , IExecutableCheck < PortableExecutable > , IPathCheck
69
73
{
70
- // TODO: Investigate reference to "CD32COPS.DLL" in "WETFLIPP.QZ_" in IA item "Triada_Russian_DVD_Complete_Collection_of_Erotic_Games".
71
- /// <inheritdoc/>
72
- public string ? CheckContents ( string file , byte [ ] fileContent , bool includeDebug )
73
- {
74
- // TODO: Obtain a sample to find where this string is in a typical executable
75
- var contentMatchSets = new List < ContentMatchSet >
76
- {
77
- // TODO: Remove from here once it's confirmed that no PE executables contain this string
78
- // CD-Cops, ver.
79
- new ( new byte ? [ ]
80
- {
81
- 0x43 , 0x44 , 0x2D , 0x43 , 0x6F , 0x70 , 0x73 , 0x2C ,
82
- 0x20 , 0x20 , 0x76 , 0x65 , 0x72 , 0x2E , 0x20
83
- } , GetVersion , "CD-Cops (Unconfirmed - Please report to us on Github)" ) ,
84
-
85
- // // DVD-Cops, ver.
86
- new ( new byte ? [ ]
87
- {
88
- 0x44 , 0x56 , 0x44 , 0x2D , 0x43 , 0x6F , 0x70 , 0x73 ,
89
- 0x2C , 0x20 , 0x20 , 0x76 , 0x65 , 0x72 , 0x2E , 0x20
90
- } , GetVersion , "DVD-Cops (Unconfirmed - Please report to us on Github)" ) ,
91
- } ;
92
-
93
- return MatchUtil . GetFirstMatch ( file , fileContent , contentMatchSets , includeDebug ) ;
94
- }
95
-
96
74
/// <inheritdoc/>
97
75
public string ? CheckExecutable ( string file , NewExecutable nex , bool includeDebug )
98
76
{
@@ -104,13 +82,39 @@ public class CDDVDCops : IContentCheck, IExecutableCheck<NewExecutable>, IExecut
104
82
// TODO: Figure out what NE section this lives in
105
83
var neMatchSets = new List < ContentMatchSet >
106
84
{
107
- // CD-Cops, ver.
85
+ // Checking for variants with one or two spaces, just in case; the Brockhaus DVDs only had one
86
+ new ( new byte ? [ ]
87
+ {
88
+ 0x43 , 0x44 , 0x2D , 0x43 , 0x6F , 0x70 , 0x73 , 0x2C ,
89
+ 0x20 , 0x76 , 0x65 , 0x72 , 0x2E , 0x20
90
+ } , GetVersion , "CD-Cops" ) ,
91
+ // CD-Cops, ver.
92
+
108
93
// Found in "h3blade.exe" in Redump entry 85077.
109
94
new ( new byte ? [ ]
110
95
{
111
96
0x43 , 0x44 , 0x2D , 0x43 , 0x6F , 0x70 , 0x73 , 0x2C ,
112
97
0x20 , 0x20 , 0x76 , 0x65 , 0x72 , 0x2E , 0x20
113
98
} , GetVersion , "CD-Cops" ) ,
99
+ // CD-Cops, ver.
100
+
101
+ // Found in IA entries "der-brockhaus-multimedial-2002-premium" and "der-brockhaus-multimedial-2003-premium"
102
+ // TODO: 2002 returns DVD-Cops 2.01, 2003 returns DVD-Cops 1,60. CD-Cops version numbers seem to "reset"
103
+ // after some point in time in existing redump entries- perhaps the command instead of the period may have
104
+ // some significance?
105
+ new ( new byte ? [ ]
106
+ {
107
+ 0x44 , 0x56 , 0x44 , 0x2D , 0x43 , 0x6F , 0x70 , 0x73 ,
108
+ 0x2C , 0x20 , 0x76 , 0x65 , 0x72 , 0x2E , 0x20
109
+ } , GetVersion , "DVD-Cops" ) ,
110
+ // DVD-Cops, ver.
111
+
112
+ new ( new byte ? [ ]
113
+ {
114
+ 0x44 , 0x56 , 0x44 , 0x2D , 0x43 , 0x6F , 0x70 , 0x73 ,
115
+ 0x2C , 0x20 , 0x20 , 0x76 , 0x65 , 0x72 , 0x2E , 0x20
116
+ } , GetVersion , "DVD-Cops" ) ,
117
+ // DVD-Cops, ver.
114
118
} ;
115
119
116
120
var match = MatchUtil . GetFirstMatch ( file , data , neMatchSets , includeDebug ) ;
@@ -186,7 +190,22 @@ public class CDDVDCops : IContentCheck, IExecutableCheck<NewExecutable>, IExecut
186
190
// Found in "FGP.exe" in IA item "flaklypa-grand-prix-dvd"/Redump entry 108169.
187
191
if ( pex . ContainsSection ( "UNICops" , exact : true ) )
188
192
return "UNI-Cops" ;
189
-
193
+
194
+ // Get the DATA section, if it exists
195
+ // Found in "bib.dll" in IA item "https://archive.org/details/cover_202501"
196
+ // This contains the version section that the Content Check looked for. There are likely other sections
197
+ // that may contain it. Update when more are found.
198
+ var strs = pex . GetFirstSectionStrings ( "DATA" ) ;
199
+ if ( strs != null )
200
+ {
201
+ var match = strs . Find ( s => s . Contains ( " ver. " ) && ( s . Contains ( "CD-Cops, " ) || s . Contains ( "DVD-Cops, " ) ) ) ;
202
+ if ( match != null )
203
+ if ( match . Contains ( "CD-Cops" ) )
204
+ return $ "CD-Cops { GetVersionString ( match ) } ";
205
+ else if ( match . Contains ( "DVD-Cops" ) )
206
+ return $ "DVD-Cops { GetVersionString ( match ) } ";
207
+ }
208
+
190
209
return null ;
191
210
}
192
211
@@ -206,6 +225,16 @@ public List<string> CheckDirectoryPath(string path, List<string>? files)
206
225
207
226
new ( new PathMatch ( ".GZ_" , matchCase : true , useEndsWith : true ) , "CD-Cops (Unconfirmed - Please report to us on Github)" ) ,
208
227
new ( new PathMatch ( ".Qz" , matchCase : true , useEndsWith : true ) , "CD-Cops (Unconfirmed - Please report to us on Github)" ) ,
228
+
229
+ // Found in Redump entries 84517, 108167, 119435, 119436, and 119437. This is the official
230
+ // name from their website https://www.linkdatasecurity.com/index.htm#/protection-products/cd-dvd-usb-copy-protection/cdcops
231
+ // I can't find this specific filename documented anywhere, but, all of these
232
+ // games do not require a key to be input
233
+ new ( new FilePathMatch ( "cdcode.key" ) , "CD-Cops Codefree" ) ,
234
+
235
+ // DVD-Cops Codefree does exist https://www.linkdatasecurity.com/index.htm#/protection-products/cd-dvd-usb-copy-protection/dvdvers
236
+ // but we currently have no samples. Presumably this is what the file would be called?
237
+ new ( new FilePathMatch ( "dvdcode.key" ) , "DVD-Cops Codefree (Unconfirmed - Please report to us on Github)" ) ,
209
238
} ;
210
239
211
240
return MatchUtil . GetAllMatches ( files , matchers , any : true ) ;
@@ -226,6 +255,15 @@ public List<string> CheckDirectoryPath(string path, List<string>? files)
226
255
227
256
new ( new PathMatch ( ".GZ_" , matchCase : true , useEndsWith : true ) , "CD-Cops (Unconfirmed - Please report to us on Github)" ) ,
228
257
new ( new PathMatch ( ".Qz" , matchCase : true , useEndsWith : true ) , "CD-Cops (Unconfirmed - Please report to us on Github)" ) ,
258
+ // Found in Redump entries 84517, 108167, 119435, 119436, and 119437. This is the official
259
+ // name from their website https://www.linkdatasecurity.com/index.htm#/protection-products/cd-dvd-usb-copy-protection/cdcops
260
+ // I can't find this specific filename documented anywhere, but, all of these
261
+ // games do not require a key to be input
262
+ new ( new FilePathMatch ( "cdcode.key" ) , "CD-Cops Codefree" ) ,
263
+
264
+ // DVD-Cops Codefree does exist https://www.linkdatasecurity.com/index.htm#/protection-products/cd-dvd-usb-copy-protection/dvdvers
265
+ // but we currently have no samples. Presumably this is what the file would be called?
266
+ new ( new FilePathMatch ( "dvdcode.key" ) , "DVD-Cops Codefree (Unconfirmed - Please report to us on Github)" ) ,
229
267
} ;
230
268
231
269
return MatchUtil . GetFirstMatch ( path , matchers , any : true ) ;
@@ -243,5 +281,17 @@ public List<string> CheckDirectoryPath(string path, List<string>? files)
243
281
244
282
return version ;
245
283
}
284
+
285
+ private static string GetVersionString ( string match )
286
+ {
287
+ // Full string ends with # (i.e. "CD-Cops, ver. 1.72, #"), use that to compensate for comma in version
288
+ // number cases (don't change the comma, see earlier to-do) like "DVD-Cops, ver. 1,60, #"
289
+ // TODO: improve regex via the starting "N" character? Possibly unnecessary?
290
+ var versionMatch = Regex . Match ( match , @"(?<=D-Cops,\s{1,}ver. )(.*?)(?=,\s{1,}#)" ) ;
291
+ if ( versionMatch . Success )
292
+ return versionMatch . Value ;
293
+
294
+ return "(Unknown Version - Please report to us on GitHub)" ;
295
+ }
246
296
}
247
297
}
0 commit comments