Skip to content

Commit e970a7b

Browse files
committed
Clean up SafeDisc a little more
1 parent f155291 commit e970a7b

File tree

1 file changed

+156
-123
lines changed

1 file changed

+156
-123
lines changed

BurnOutSharp/ProtectionType/SafeDisc.cs

Lines changed: 156 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -122,151 +122,184 @@ public static string GetVersion(string file, byte[] fileContent, List<int> posit
122122
return $"{version}.{subVersion:00}.{subsubVersion:000}";
123123
}
124124

125-
// TODO: Continue collecting SHA-1 hashes instead of sizes
126125
public static string GetDPlayerXVersion(string firstMatchedString, IEnumerable<string> files)
127126
{
128127
if (firstMatchedString == null || !File.Exists(firstMatchedString))
129128
return string.Empty;
130129

131130
FileInfo fi = new FileInfo(firstMatchedString);
132-
if (fi.Length == 81408)
133-
return "1.0x";
134-
else if (fi.Length == 155648)
135-
return "1.1x";
136-
137-
// a8ed1613d47d1b5064300ff070484528ebb20a3b - Bundled with 1.11.000
138-
else if (fi.Length == 156160)
139-
return "1.1x-1.2x";
140-
141-
// ed680e9a13f593e7a80a69ee1035d956ab62212b
142-
// 66d8589343e00fa3e11bbf462e38c6f502515bea - Bundled with 1.30.010
143-
else if (fi.Length == 163328)
144-
return "1.3x";
145-
else if (fi.Length == 165888)
146-
return "1.35";
147-
148-
// 5751ae2ee805d31227cfe7680f3c8be4ab8945a3
149-
else if (fi.Length == 172544)
150-
return "1.40";
151-
else if (fi.Length == 173568)
152-
return "1.4x";
153-
else if (fi.Length == 136704)
154-
return "1.4x";
155-
else if (fi.Length == 138752)
156-
return "1.5x";
157-
158-
// f7a57f83bdc29040e20fd37cd0c6d7e6b2984180 - 78848 - Bundled with 1.00.030
159-
else
160-
return "1";
131+
switch (fi.Length)
132+
{
133+
case 81_408:
134+
return "1.0x";
135+
case 155_648:
136+
return "1.1x";
137+
case 156_160:
138+
return "1.1x-1.2x";
139+
case 163_328:
140+
return "1.3x";
141+
case 165_888:
142+
return "1.35";
143+
case 172_544:
144+
return "1.40";
145+
case 173_568:
146+
return "1.4x";
147+
case 136_704:
148+
return "1.4x";
149+
case 138_752:
150+
return "1.5x";
151+
default:
152+
return "1";
153+
}
161154
}
162155

163-
// TODO: Continue collecting SHA-1 hashes instead of sizes
164156
public static string GetDrvmgtVersion(string firstMatchedString, IEnumerable<string> files)
165157
{
166158
if (firstMatchedString == null || !File.Exists(firstMatchedString))
167159
return string.Empty;
168160

169161
FileInfo fi = new FileInfo(firstMatchedString);
170-
if (fi.Length == 34816)
171-
return "1.0x";
172-
173-
// d31725ff99be44bc1bfff171f4c4705f786b8e91
174-
// 87c0da1b52681fa8052a915e85699738993bea72 - Bundled with 1.11.000
175-
else if (fi.Length == 32256)
176-
return "1.1x-1.3x";
177-
178-
// 8e41db1c60bbac631b06ad4f94adb4214a0e65dc
179-
else if (fi.Length == 31744)
180-
return "1.4x";
181-
182-
// 04ed7ac39fe7a6fab497a498cbcff7da19bf0556
183-
// 5198da51184ca9f3a8096c6136f645b454a85f6c - Bundled with 2.30.030
184-
// 1437c8c149917c76f741c6dbee6b6b0cc0664f13 - Bundled with 2.40.010, 4.60.000
185-
else if (fi.Length == 34304)
186-
return "1.5x-2.40";
187-
188-
// 27d5e7f7eee1f22ebdaa903a9e58a7fdb50ef82c
189-
else if (fi.Length == 35840)
190-
return "2.51-2.60";
191-
192-
// 88c7aa6e91c9ba5f2023318048e3c3571088776f
193-
else if (fi.Length == 40960)
194-
return "2.70";
195-
196-
// ea6e24b1f306391cd78a1e7c2f2c0c31828ef004
197-
else if (fi.Length == 23552)
198-
return "2.80";
199-
200-
// e21ff43c2e663264d6cb11fbbc31eb1dcee42b1a
201-
// b824ed257946eee93f438b25c855e9dde7a3671a
202-
// 7c5ab9bdf965b70e60b99086519327168f43f362 - Bundled with 4.00.002
203-
else if (fi.Length == 41472)
204-
return "2.90-3.10";
205-
206-
// ecb341ab36c5b3b912f568d347368a6a2def8d5f
207-
else if (fi.Length == 24064)
208-
return "3.15-3.20";
209-
210-
// a5247ec0ec50b8f470c93bf23e3f2514c402d5ad - 46592 - Bundled with 4.60.000 (2x)
211-
else
212-
return "1-4";
162+
switch (fi.Length)
163+
{
164+
case 34_816:
165+
return "1.0x";
166+
case 32_256:
167+
return "1.1x-1.3x";
168+
case 31_744:
169+
return "1.4x";
170+
case 34_304:
171+
return "1.5x-2.40";
172+
case 35_840:
173+
return "2.51-2.60";
174+
case 40_960:
175+
return "2.70";
176+
case 23_552:
177+
return "2.80";
178+
case 41_472:
179+
return "2.90-3.10";
180+
case 24_064:
181+
return "3.15-3.20";
182+
default:
183+
return "1-4";
184+
}
213185
}
214186

215-
// TODO: Continue collecting SHA-1 hashes instead of sizes
216187
public static string GetSecdrvVersion(string firstMatchedString, IEnumerable<string> files)
217188
{
218189
if (firstMatchedString == null || !File.Exists(firstMatchedString))
219190
return string.Empty;
220191

221192
FileInfo fi = new FileInfo(firstMatchedString);
222-
if (fi.Length == 20128)
223-
return "2.10";
224-
225-
// f68a1370660f8b94f896bbba8dc6e47644d19092
226-
else if (fi.Length == 27440)
227-
return "2.30";
228-
229-
// 60bc8c3222081bf76466c521474d63714afd43cd
230-
else if (fi.Length == 28624)
231-
return "2.40";
232-
233-
// 08ceca66432278d8c4e0f448436b77583c3c61c8
234-
else if (fi.Length == 18768)
235-
return "2.50";
236-
237-
// 10080eb46bf76ac9cf9ea74372cfa4313727f0ca
238-
else if (fi.Length == 28400)
239-
return "2.51";
240-
else if (fi.Length == 29392)
241-
return "2.60";
242-
243-
// 832d359a6de191c788b0e61e33f3d01f8d793d3c
244-
else if (fi.Length == 11376)
245-
return "2.70";
246-
247-
// afcfaac945a5b47712719a5e6a7eb69e36a5a6e0
248-
// cb24fbe8aa23a49e95f3c83fb15123ffb01f43f4
249-
else if (fi.Length == 12464)
250-
return "2.80";
251-
252-
// 0383b69f98d0a9c0383c8130d52d6b431c79ac48
253-
else if (fi.Length == 12400)
254-
return "2.90";
255-
else if (fi.Length == 12528)
256-
return "3.10";
257-
else if (fi.Length == 12528)
258-
return "3.15";
259-
260-
// d7c9213cc78ff57f2f655b050c4d5ac065661aa9
261-
else if (fi.Length == 11973)
262-
return "3.20";
263-
264-
// b64ad3ec82f2eb9fb854512cb59c25a771322181 - 14304 - Bundled wtih 1.11.000
265-
// ebf69b0a96adfc903b7e486708474dc864cc0c7c - 10848 - Bundled with 1.40.004
266-
// 2d9f54f35f5bacb8959ef3affdc3e4209a4629cb - 14368 - UNKNOWN
267-
// fc6fedacc21a7244975b8f410ff8673285374cc2 - 163644 - Bundled with 4.00.002, 4.60.000
268-
else
269-
return "1-4";
193+
switch (fi.Length)
194+
{
195+
case 20_128:
196+
return "2.10";
197+
case 27_440:
198+
return "2.30";
199+
case 28_624:
200+
return "2.40";
201+
case 18_768:
202+
return "2.50";
203+
case 28_400:
204+
return "2.51";
205+
case 29_392:
206+
return "2.60";
207+
case 11_376:
208+
return "2.70";
209+
case 12_464:
210+
return "2.80";
211+
case 12_400:
212+
return "2.90";
213+
case 12_528:
214+
return "3.10-3.15";
215+
case 11_973:
216+
return "3.20";
217+
218+
// 14_304 - Bundled wtih 1.11.000
219+
// 10_848 - Bundled with 1.40.004
220+
// 143_68 - UNKNOWN
221+
// 163_644 - Bundled with 4.00.002, 4.60.000
222+
default:
223+
return "1-4";
224+
}
225+
}
226+
227+
// TODO: Continue collecting SHA-1 hashes instead of sizes
228+
private string GetVersionFromSHA1Hash(string sha1Hash)
229+
{
230+
switch (sha1Hash.ToLowerInvariant())
231+
{
232+
// dplayerx.dll
233+
case "f7a57f83bdc29040e20fd37cd0c6d7e6b2984180":
234+
return "1.00.030";
235+
case "a8ed1613d47d1b5064300ff070484528ebb20a3b":
236+
return "1.11.000";
237+
case "ed680e9a13f593e7a80a69ee1035d956ab62212b":
238+
return "1.3x";
239+
case "66d8589343e00fa3e11bbf462e38c6f502515bea":
240+
return "1.30.010";
241+
case "5751ae2ee805d31227cfe7680f3c8be4ab8945a3":
242+
return "1.40";
243+
244+
// drvmgt.dll
245+
case "d31725ff99be44bc1bfff171f4c4705f786b8e91":
246+
return "1.1x-1.3x";
247+
case "87c0da1b52681fa8052a915e85699738993bea72":
248+
return "1.11.000";
249+
case "8e41db1c60bbac631b06ad4f94adb4214a0e65dc":
250+
return "1.4x";
251+
case "04ed7ac39fe7a6fab497a498cbcff7da19bf0556":
252+
return "1.5x-2.40";
253+
case "5198da51184ca9f3a8096c6136f645b454a85f6c":
254+
return "2.30.030";
255+
case "1437c8c149917c76f741c6dbee6b6b0cc0664f13":
256+
return "2.40.010"; // Also 4.60.000, might be a fluke
257+
case "27d5e7f7eee1f22ebdaa903a9e58a7fdb50ef82c":
258+
return "2.51-2.60";
259+
case "88c7aa6e91c9ba5f2023318048e3c3571088776f":
260+
return "2.70";
261+
case "ea6e24b1f306391cd78a1e7c2f2c0c31828ef004":
262+
return "2.80";
263+
case "e21ff43c2e663264d6cb11fbbc31eb1dcee42b1a":
264+
case "b824ed257946eee93f438b25c855e9dde7a3671a":
265+
return "2.90-3.10";
266+
case "ecb341ab36c5b3b912f568d347368a6a2def8d5f":
267+
return "3.15-3.20";
268+
case "7c5ab9bdf965b70e60b99086519327168f43f362":
269+
return "4.00.002";
270+
case "a5247ec0ec50b8f470c93bf23e3f2514c402d5ad":
271+
return "4.60.000";
272+
273+
// secdrv.sys
274+
case "b64ad3ec82f2eb9fb854512cb59c25a771322181":
275+
return "1.11.000";
276+
case "ebf69b0a96adfc903b7e486708474dc864cc0c7c":
277+
return "1.40.004";
278+
case "f68a1370660f8b94f896bbba8dc6e47644d19092":
279+
return "2.30";
280+
case "60bc8c3222081bf76466c521474d63714afd43cd":
281+
return "2.40";
282+
case "08ceca66432278d8c4e0f448436b77583c3c61c8":
283+
return "2.50";
284+
case "10080eb46bf76ac9cf9ea74372cfa4313727f0ca":
285+
return "2.51";
286+
case "832d359a6de191c788b0e61e33f3d01f8d793d3c":
287+
return "2.70";
288+
case "afcfaac945a5b47712719a5e6a7eb69e36a5a6e0":
289+
case "cb24fbe8aa23a49e95f3c83fb15123ffb01f43f4":
290+
return "2.80";
291+
case "0383b69f98d0a9c0383c8130d52d6b431c79ac48":
292+
return "2.90";
293+
case "d7c9213cc78ff57f2f655b050c4d5ac065661aa9":
294+
return "3.20";
295+
case "fc6fedacc21a7244975b8f410ff8673285374cc2":
296+
return "4.00.002"; // Also 4.60.000, might be a fluke
297+
case "2d9f54f35f5bacb8959ef3affdc3e4209a4629cb":
298+
return "1-4";
299+
300+
default:
301+
return null;
302+
}
270303
}
271304

272305
private string CheckSectionForProtection(string file, bool includeDebug, PortableExecutable pex, string sectionName)

0 commit comments

Comments
 (0)