Skip to content

Commit adcf9ee

Browse files
Add hash check for RipGuard (#252)
* Add hash check for RipGuard * Make sure the file exists before trying to hash it * It's the safety dance
1 parent a8c759b commit adcf9ee

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

BinaryObjectScanner.Protection/Macrovision.RipGuard.cs

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
using System;
22
using System.Collections.Concurrent;
33
using System.Collections.Generic;
4-
using System.Linq;
5-
using System.Text;
4+
using System.IO;
65
using BinaryObjectScanner.Matching;
76
using BinaryObjectScanner.Wrappers;
7+
using static BinaryObjectScanner.Utilities.Hashing;
88

99
namespace BinaryObjectScanner.Protection
1010
{
@@ -14,6 +14,7 @@ namespace BinaryObjectScanner.Protection
1414
/// Discs known to have it:
1515
/// https://forum.redfox.bz/threads/resolved-installs-rootkit-black-lagoon-vol-2-3-region-1.29660/
1616
/// https://forum.redfox.bz/threads/resolved-one-on-one-with-tony-horton-vol2-disc3.33901/
17+
/// https://moral.net.au/writing/2015/10/10/backing_up_dvds/
1718
/// </summary>
1819
public partial class Macrovision
1920
{
@@ -35,6 +36,25 @@ internal string RipGuardCheckPortableExecutable(string file, PortableExecutable
3536
if (name?.Equals("rgasdev", StringComparison.OrdinalIgnoreCase) == true)
3637
return "RipGuard";
3738

39+
if (!string.IsNullOrWhiteSpace(file) && File.Exists(file))
40+
{
41+
try
42+
{
43+
FileInfo fi = new FileInfo(file);
44+
45+
// So far, every seemingly-randomly named EXE on RipGuard discs have a consistent hash.
46+
if (fi.Length == 49_152)
47+
{
48+
string sha1 = GetFileSHA1(file);
49+
if (sha1 == "6A7B8545800E0AB252773A8CD0A2185CA2497938")
50+
return "RipGuard";
51+
}
52+
}
53+
catch
54+
{
55+
}
56+
}
57+
3858
return null;
3959
}
4060

0 commit comments

Comments
 (0)