Skip to content

Commit 245e840

Browse files
Add iso-level ripguard detection. (#412)
1 parent 9be63e9 commit 245e840

1 file changed

Lines changed: 23 additions & 4 deletions

File tree

BinaryObjectScanner/Protection/Macrovision.cs

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,26 @@ public partial class Macrovision : IDiskImageCheck<ISO9660>, IExecutableCheck<Ne
2828
if (diskImage.VolumeDescriptorSet[0] is not PrimaryVolumeDescriptor pvd)
2929
return null;
3030

31+
var applicationUse = pvd.ApplicationUse;
32+
var reserved653Bytes = pvd.Reserved653Bytes;
33+
34+
#region RipGuard
35+
36+
// Macrovision RipGuard protected DVDs have the string "MVSNRGFP" at the start of the application use, followed
37+
// by some other data. The meaning of the rest of the data is unknown, but ultimately not necessary to check.
38+
// Meaning of string unknown. Best guess is "Macrovision RipGuard (File?) Protection"
39+
// While not checked, this string plus a similar-looking block of data appear near the very end of the image
40+
// as well. Possibly part of another standard ISO9660 field?
41+
byte[] ripGuardBytes = [0x4D, 0x56, 0x53, 0x4E, 0x52, 0x47, 0x46, 0x50]; // MVSNRGFP
42+
int offset = 0;
43+
var compareBytes = applicationUse.ReadBytes(ref offset, 8);
44+
if (compareBytes.EqualsExactly(ripGuardBytes))
45+
return "Macrovision RipGuard";
46+
47+
#endregion RipGuard
48+
49+
#region SafeDisc
50+
3151
if (!FileType.ISO9660.NoteworthyApplicationUse(pvd))
3252
return null;
3353

@@ -37,12 +57,9 @@ public partial class Macrovision : IDiskImageCheck<ISO9660>, IExecutableCheck<Ne
3757
if (!FileType.ISO9660.NoteworthyReserved653Bytes(pvd))
3858
return null;
3959

40-
var applicationUse = pvd.ApplicationUse;
41-
var reserved653Bytes = pvd.Reserved653Bytes;
42-
4360
#region Read Application Use
4461

45-
int offset = 0;
62+
offset = 0;
4663
var appUseZeroBytes = applicationUse.ReadBytes(ref offset, 256);
4764
var appUseDataBytesOne = applicationUse.ReadBytes(ref offset, 128);
4865
offset += 64; // Some extra values get added here over time. Check is good enough, easier to skip this.
@@ -84,6 +101,8 @@ public partial class Macrovision : IDiskImageCheck<ISO9660>, IExecutableCheck<Ne
84101
return null;
85102

86103
return "SafeDisc";
104+
105+
#endregion
87106
}
88107

89108
/// <inheritdoc/>

0 commit comments

Comments
 (0)