Clean up SafeDisc a little more

This commit is contained in:
Matt Nadareski
2022-03-18 21:05:09 -07:00
parent f155291139
commit e970a7b4d9

View File

@@ -122,151 +122,184 @@ namespace BurnOutSharp.ProtectionType
return $"{version}.{subVersion:00}.{subsubVersion:000}";
}
// TODO: Continue collecting SHA-1 hashes instead of sizes
public static string GetDPlayerXVersion(string firstMatchedString, IEnumerable<string> files)
{
if (firstMatchedString == null || !File.Exists(firstMatchedString))
return string.Empty;
FileInfo fi = new FileInfo(firstMatchedString);
if (fi.Length == 81408)
return "1.0x";
else if (fi.Length == 155648)
return "1.1x";
// a8ed1613d47d1b5064300ff070484528ebb20a3b - Bundled with 1.11.000
else if (fi.Length == 156160)
return "1.1x-1.2x";
// ed680e9a13f593e7a80a69ee1035d956ab62212b
// 66d8589343e00fa3e11bbf462e38c6f502515bea - Bundled with 1.30.010
else if (fi.Length == 163328)
return "1.3x";
else if (fi.Length == 165888)
return "1.35";
// 5751ae2ee805d31227cfe7680f3c8be4ab8945a3
else if (fi.Length == 172544)
return "1.40";
else if (fi.Length == 173568)
return "1.4x";
else if (fi.Length == 136704)
return "1.4x";
else if (fi.Length == 138752)
return "1.5x";
// f7a57f83bdc29040e20fd37cd0c6d7e6b2984180 - 78848 - Bundled with 1.00.030
else
return "1";
switch (fi.Length)
{
case 81_408:
return "1.0x";
case 155_648:
return "1.1x";
case 156_160:
return "1.1x-1.2x";
case 163_328:
return "1.3x";
case 165_888:
return "1.35";
case 172_544:
return "1.40";
case 173_568:
return "1.4x";
case 136_704:
return "1.4x";
case 138_752:
return "1.5x";
default:
return "1";
}
}
// TODO: Continue collecting SHA-1 hashes instead of sizes
public static string GetDrvmgtVersion(string firstMatchedString, IEnumerable<string> files)
{
if (firstMatchedString == null || !File.Exists(firstMatchedString))
return string.Empty;
FileInfo fi = new FileInfo(firstMatchedString);
if (fi.Length == 34816)
return "1.0x";
// d31725ff99be44bc1bfff171f4c4705f786b8e91
// 87c0da1b52681fa8052a915e85699738993bea72 - Bundled with 1.11.000
else if (fi.Length == 32256)
return "1.1x-1.3x";
// 8e41db1c60bbac631b06ad4f94adb4214a0e65dc
else if (fi.Length == 31744)
return "1.4x";
// 04ed7ac39fe7a6fab497a498cbcff7da19bf0556
// 5198da51184ca9f3a8096c6136f645b454a85f6c - Bundled with 2.30.030
// 1437c8c149917c76f741c6dbee6b6b0cc0664f13 - Bundled with 2.40.010, 4.60.000
else if (fi.Length == 34304)
return "1.5x-2.40";
// 27d5e7f7eee1f22ebdaa903a9e58a7fdb50ef82c
else if (fi.Length == 35840)
return "2.51-2.60";
// 88c7aa6e91c9ba5f2023318048e3c3571088776f
else if (fi.Length == 40960)
return "2.70";
// ea6e24b1f306391cd78a1e7c2f2c0c31828ef004
else if (fi.Length == 23552)
return "2.80";
// e21ff43c2e663264d6cb11fbbc31eb1dcee42b1a
// b824ed257946eee93f438b25c855e9dde7a3671a
// 7c5ab9bdf965b70e60b99086519327168f43f362 - Bundled with 4.00.002
else if (fi.Length == 41472)
return "2.90-3.10";
// ecb341ab36c5b3b912f568d347368a6a2def8d5f
else if (fi.Length == 24064)
return "3.15-3.20";
// a5247ec0ec50b8f470c93bf23e3f2514c402d5ad - 46592 - Bundled with 4.60.000 (2x)
else
return "1-4";
switch (fi.Length)
{
case 34_816:
return "1.0x";
case 32_256:
return "1.1x-1.3x";
case 31_744:
return "1.4x";
case 34_304:
return "1.5x-2.40";
case 35_840:
return "2.51-2.60";
case 40_960:
return "2.70";
case 23_552:
return "2.80";
case 41_472:
return "2.90-3.10";
case 24_064:
return "3.15-3.20";
default:
return "1-4";
}
}
// TODO: Continue collecting SHA-1 hashes instead of sizes
public static string GetSecdrvVersion(string firstMatchedString, IEnumerable<string> files)
{
if (firstMatchedString == null || !File.Exists(firstMatchedString))
return string.Empty;
FileInfo fi = new FileInfo(firstMatchedString);
if (fi.Length == 20128)
return "2.10";
switch (fi.Length)
{
case 20_128:
return "2.10";
case 27_440:
return "2.30";
case 28_624:
return "2.40";
case 18_768:
return "2.50";
case 28_400:
return "2.51";
case 29_392:
return "2.60";
case 11_376:
return "2.70";
case 12_464:
return "2.80";
case 12_400:
return "2.90";
case 12_528:
return "3.10-3.15";
case 11_973:
return "3.20";
// f68a1370660f8b94f896bbba8dc6e47644d19092
else if (fi.Length == 27440)
return "2.30";
// 14_304 - Bundled wtih 1.11.000
// 10_848 - Bundled with 1.40.004
// 143_68 - UNKNOWN
// 163_644 - Bundled with 4.00.002, 4.60.000
default:
return "1-4";
}
}
// 60bc8c3222081bf76466c521474d63714afd43cd
else if (fi.Length == 28624)
return "2.40";
// TODO: Continue collecting SHA-1 hashes instead of sizes
private string GetVersionFromSHA1Hash(string sha1Hash)
{
switch (sha1Hash.ToLowerInvariant())
{
// dplayerx.dll
case "f7a57f83bdc29040e20fd37cd0c6d7e6b2984180":
return "1.00.030";
case "a8ed1613d47d1b5064300ff070484528ebb20a3b":
return "1.11.000";
case "ed680e9a13f593e7a80a69ee1035d956ab62212b":
return "1.3x";
case "66d8589343e00fa3e11bbf462e38c6f502515bea":
return "1.30.010";
case "5751ae2ee805d31227cfe7680f3c8be4ab8945a3":
return "1.40";
// 08ceca66432278d8c4e0f448436b77583c3c61c8
else if (fi.Length == 18768)
return "2.50";
// drvmgt.dll
case "d31725ff99be44bc1bfff171f4c4705f786b8e91":
return "1.1x-1.3x";
case "87c0da1b52681fa8052a915e85699738993bea72":
return "1.11.000";
case "8e41db1c60bbac631b06ad4f94adb4214a0e65dc":
return "1.4x";
case "04ed7ac39fe7a6fab497a498cbcff7da19bf0556":
return "1.5x-2.40";
case "5198da51184ca9f3a8096c6136f645b454a85f6c":
return "2.30.030";
case "1437c8c149917c76f741c6dbee6b6b0cc0664f13":
return "2.40.010"; // Also 4.60.000, might be a fluke
case "27d5e7f7eee1f22ebdaa903a9e58a7fdb50ef82c":
return "2.51-2.60";
case "88c7aa6e91c9ba5f2023318048e3c3571088776f":
return "2.70";
case "ea6e24b1f306391cd78a1e7c2f2c0c31828ef004":
return "2.80";
case "e21ff43c2e663264d6cb11fbbc31eb1dcee42b1a":
case "b824ed257946eee93f438b25c855e9dde7a3671a":
return "2.90-3.10";
case "ecb341ab36c5b3b912f568d347368a6a2def8d5f":
return "3.15-3.20";
case "7c5ab9bdf965b70e60b99086519327168f43f362":
return "4.00.002";
case "a5247ec0ec50b8f470c93bf23e3f2514c402d5ad":
return "4.60.000";
// 10080eb46bf76ac9cf9ea74372cfa4313727f0ca
else if (fi.Length == 28400)
return "2.51";
else if (fi.Length == 29392)
return "2.60";
// secdrv.sys
case "b64ad3ec82f2eb9fb854512cb59c25a771322181":
return "1.11.000";
case "ebf69b0a96adfc903b7e486708474dc864cc0c7c":
return "1.40.004";
case "f68a1370660f8b94f896bbba8dc6e47644d19092":
return "2.30";
case "60bc8c3222081bf76466c521474d63714afd43cd":
return "2.40";
case "08ceca66432278d8c4e0f448436b77583c3c61c8":
return "2.50";
case "10080eb46bf76ac9cf9ea74372cfa4313727f0ca":
return "2.51";
case "832d359a6de191c788b0e61e33f3d01f8d793d3c":
return "2.70";
case "afcfaac945a5b47712719a5e6a7eb69e36a5a6e0":
case "cb24fbe8aa23a49e95f3c83fb15123ffb01f43f4":
return "2.80";
case "0383b69f98d0a9c0383c8130d52d6b431c79ac48":
return "2.90";
case "d7c9213cc78ff57f2f655b050c4d5ac065661aa9":
return "3.20";
case "fc6fedacc21a7244975b8f410ff8673285374cc2":
return "4.00.002"; // Also 4.60.000, might be a fluke
case "2d9f54f35f5bacb8959ef3affdc3e4209a4629cb":
return "1-4";
// 832d359a6de191c788b0e61e33f3d01f8d793d3c
else if (fi.Length == 11376)
return "2.70";
// afcfaac945a5b47712719a5e6a7eb69e36a5a6e0
// cb24fbe8aa23a49e95f3c83fb15123ffb01f43f4
else if (fi.Length == 12464)
return "2.80";
// 0383b69f98d0a9c0383c8130d52d6b431c79ac48
else if (fi.Length == 12400)
return "2.90";
else if (fi.Length == 12528)
return "3.10";
else if (fi.Length == 12528)
return "3.15";
// d7c9213cc78ff57f2f655b050c4d5ac065661aa9
else if (fi.Length == 11973)
return "3.20";
// b64ad3ec82f2eb9fb854512cb59c25a771322181 - 14304 - Bundled wtih 1.11.000
// ebf69b0a96adfc903b7e486708474dc864cc0c7c - 10848 - Bundled with 1.40.004
// 2d9f54f35f5bacb8959ef3affdc3e4209a4629cb - 14368 - UNKNOWN
// fc6fedacc21a7244975b8f410ff8673285374cc2 - 163644 - Bundled with 4.00.002, 4.60.000
else
return "1-4";
default:
return null;
}
}
private string CheckSectionForProtection(string file, bool includeDebug, PortableExecutable pex, string sectionName)