Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
0ca0a84
Initial
HeroponRikiBestest Oct 30, 2025
ca9f667
Laserlock in
HeroponRikiBestest Oct 30, 2025
ec76f82
This is a better way to read the string
HeroponRikiBestest Oct 30, 2025
f1374a7
That array copy wasn't needed either
HeroponRikiBestest Oct 30, 2025
4871899
Use static filetype method, rename filetype.iso
HeroponRikiBestest Oct 31, 2025
495e220
Initial Codelok ISO scanning
HeroponRikiBestest Oct 31, 2025
0bb0285
Comments with redump IDs
HeroponRikiBestest Oct 31, 2025
55ebf89
Add redump examples to laserlock
HeroponRikiBestest Oct 31, 2025
571e639
Change for testing
HeroponRikiBestest Oct 31, 2025
33040b8
Small comment
HeroponRikiBestest Oct 31, 2025
53f96be
TAGES
HeroponRikiBestest Oct 31, 2025
a07f50f
halfway through safedisc
HeroponRikiBestest Oct 31, 2025
d5dfcae
Safedisc done
HeroponRikiBestest Oct 31, 2025
b3ba774
Fix 1
HeroponRikiBestest Oct 31, 2025
5c42ed5
Major oversights in puredata fixed
HeroponRikiBestest Oct 31, 2025
c5ef1da
Finish SecuROM
HeroponRikiBestest Nov 1, 2025
47bd3bf
ProtectDiSC done
HeroponRikiBestest Nov 1, 2025
cf3f874
Alpharom done
HeroponRikiBestest Nov 1, 2025
4af8d71
Finish StarForce, initial PR review ready
HeroponRikiBestest Nov 1, 2025
81f0662
Wait, that would be really bad
HeroponRikiBestest Nov 1, 2025
fc81ca1
One more for the road.
HeroponRikiBestest Nov 1, 2025
e7c2628
Small finding
HeroponRikiBestest Nov 1, 2025
5b91424
Small fix for finding
HeroponRikiBestest Nov 1, 2025
d490a83
Notes on finding
HeroponRikiBestest Nov 1, 2025
6ae8b26
Several minor fixes, decisions
HeroponRikiBestest Nov 2, 2025
33391fa
what do you MEAN it returns true if there are no elements in the array
HeroponRikiBestest Nov 2, 2025
696016b
Future todo
HeroponRikiBestest Nov 2, 2025
e50ea79
Update packages
mnadareski Nov 6, 2025
852015c
Rebase
HeroponRikiBestest Nov 6, 2025
dfba726
Fix runisochecks
HeroponRikiBestest Nov 6, 2025
50acaa8
First round of fixes
HeroponRikiBestest Nov 6, 2025
8dc43b9
Second round of fixes
HeroponRikiBestest Nov 6, 2025
cbdd32a
Tests attempt 1
HeroponRikiBestest Nov 6, 2025
c6947bb
Make checks work
HeroponRikiBestest Nov 6, 2025
c48f373
Individual test attempt 1
HeroponRikiBestest Nov 6, 2025
a4bd666
Final tests
HeroponRikiBestest Nov 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions BinaryObjectScanner.Test/BinaryObjectScanner.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
<PackageReference Include="SabreTools.Serialization" Version="[2.0.2]" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.0" />
<PackageReference Include="SabreTools.Serialization" Version="[2.1.0]" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4">
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
34 changes: 34 additions & 0 deletions BinaryObjectScanner.Test/FileType/DiskImageTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using System.IO;
using BinaryObjectScanner.FileType;
using Xunit;

namespace BinaryObjectScanner.Test.FileType
{
public class DiskImageTests
{
private static readonly SabreTools.Serialization.Wrappers.ISO9660 wrapper
= new(new SabreTools.Data.Models.ISO9660.Volume(), new MemoryStream(new byte[1024]));

[Fact]
public void DetectFile_EmptyString_Null()
{
string file = string.Empty;
var detectable = new ISO9660(wrapper);

string? actual = detectable.Detect(file, includeDebug: false);
Assert.Null(actual);
}

[Fact]
public void DetectStream_EmptyStream_Empty()
{
Stream? stream = new MemoryStream();
string file = string.Empty;
var detectable = new ISO9660(wrapper);

string? actual = detectable.Detect(stream, file, includeDebug: false);
Assert.NotNull(actual);
Assert.Empty(actual);
}
}
}
13 changes: 13 additions & 0 deletions BinaryObjectScanner.Test/Protection/AlphaROMTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,18 @@ public void CheckPortableExecutableTest()
string? actual = checker.CheckExecutable(file, exe, includeDebug: false);
Assert.Null(actual);
}

[Fact]
public void CheckDiskImageTest()
{
string file = "filename";
SabreTools.Data.Models.ISO9660.Volume model = new();
Stream source = new MemoryStream(new byte[1024]);
SabreTools.Serialization.Wrappers.ISO9660 iso = new(model, source);

var checker = new AlphaROM();
string? actual = checker.CheckDiskImage(file, iso, includeDebug: false);
Assert.Null(actual);
}
}
}
13 changes: 13 additions & 0 deletions BinaryObjectScanner.Test/Protection/CopyLokTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,18 @@ public void CheckPortableExecutableTest()
string? actual = checker.CheckExecutable(file, exe, includeDebug: false);
Assert.Null(actual);
}

[Fact]
public void CheckDiskImageTest()
{
string file = "filename";
SabreTools.Data.Models.ISO9660.Volume model = new();
Stream source = new MemoryStream(new byte[1024]);
SabreTools.Serialization.Wrappers.ISO9660 iso = new(model, source);

var checker = new CopyLok();
string? actual = checker.CheckDiskImage(file, iso, includeDebug: false);
Assert.Null(actual);
}
}
}
13 changes: 13 additions & 0 deletions BinaryObjectScanner.Test/Protection/LaserLokTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,18 @@ public void CheckFilePathTest()
string? actual = checker.CheckFilePath(path);
Assert.Null(actual);
}

[Fact]
public void CheckDiskImageTest()
{
string file = "filename";
SabreTools.Data.Models.ISO9660.Volume model = new();
Stream source = new MemoryStream(new byte[1024]);
SabreTools.Serialization.Wrappers.ISO9660 iso = new(model, source);

var checker = new LaserLok();
string? actual = checker.CheckDiskImage(file, iso, includeDebug: false);
Assert.Null(actual);
}
}
}
13 changes: 13 additions & 0 deletions BinaryObjectScanner.Test/Protection/MacrovisionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,18 @@ public void CheckFilePathTest()
string? actual = checker.CheckFilePath(path);
Assert.Null(actual);
}

[Fact]
public void CheckDiskImageTest()
{
string file = "filename";
SabreTools.Data.Models.ISO9660.Volume model = new();
Stream source = new MemoryStream(new byte[1024]);
SabreTools.Serialization.Wrappers.ISO9660 iso = new(model, source);

var checker = new Macrovision();
string? actual = checker.CheckDiskImage(file, iso, includeDebug: false);
Assert.Null(actual);
}
}
}
13 changes: 13 additions & 0 deletions BinaryObjectScanner.Test/Protection/ProtectDiscTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,18 @@ public void CheckFilePathTest()
string? actual = checker.CheckFilePath(path);
Assert.Null(actual);
}

[Fact]
public void CheckDiskImageTest()
{
string file = "filename";
SabreTools.Data.Models.ISO9660.Volume model = new();
Stream source = new MemoryStream(new byte[1024]);
SabreTools.Serialization.Wrappers.ISO9660 iso = new(model, source);

var checker = new ProtectDISC();
string? actual = checker.CheckDiskImage(file, iso, includeDebug: false);
Assert.Null(actual);
}
}
}
13 changes: 13 additions & 0 deletions BinaryObjectScanner.Test/Protection/SecuROMTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,18 @@ public void CheckFilePathTest()
string? actual = checker.CheckFilePath(path);
Assert.Null(actual);
}

[Fact]
public void CheckDiskImageTest()
{
string file = "filename";
SabreTools.Data.Models.ISO9660.Volume model = new();
Stream source = new MemoryStream(new byte[1024]);
SabreTools.Serialization.Wrappers.ISO9660 iso = new(model, source);

var checker = new SecuROM();
string? actual = checker.CheckDiskImage(file, iso, includeDebug: false);
Assert.Null(actual);
}
}
}
13 changes: 13 additions & 0 deletions BinaryObjectScanner.Test/Protection/StarForceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,18 @@ public void CheckFilePathTest()
string? actual = checker.CheckFilePath(path);
Assert.Null(actual);
}

[Fact]
public void CheckDiskImageTest()
{
string file = "filename";
SabreTools.Data.Models.ISO9660.Volume model = new();
Stream source = new MemoryStream(new byte[1024]);
SabreTools.Serialization.Wrappers.ISO9660 iso = new(model, source);

var checker = new StarForce();
string? actual = checker.CheckDiskImage(file, iso, includeDebug: false);
Assert.Null(actual);
}
}
}
13 changes: 13 additions & 0 deletions BinaryObjectScanner.Test/Protection/TAGESTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,18 @@ public void CheckFilePathTest()
string? actual = checker.CheckFilePath(path);
Assert.Null(actual);
}

[Fact]
public void CheckDiskImageTest()
{
string file = "filename";
SabreTools.Data.Models.ISO9660.Volume model = new();
Stream source = new MemoryStream(new byte[1024]);
SabreTools.Serialization.Wrappers.ISO9660 iso = new(model, source);

var checker = new TAGES();
string? actual = checker.CheckDiskImage(file, iso, includeDebug: false);
Assert.Null(actual);
}
}
}
6 changes: 3 additions & 3 deletions BinaryObjectScanner/BinaryObjectScanner.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@
<PackageReference Include="GrindCore.SharpCompress" Version="0.40.4-alpha" Condition="!$(TargetFramework.StartsWith(`net2`)) AND !$(TargetFramework.StartsWith(`net3`)) AND !$(TargetFramework.StartsWith(`net40`)) AND !$(TargetFramework.StartsWith(`net452`))" />
<PackageReference Include="MinThreadingBridge" Version="0.11.4" Condition="$(TargetFramework.StartsWith(`net2`)) OR $(TargetFramework.StartsWith(`net3`)) OR $(TargetFramework.StartsWith(`net40`))" />
<PackageReference Include="SabreTools.Hashing" Version="[1.5.1]" />
<PackageReference Include="SabreTools.IO" Version="[1.7.6]" />
<PackageReference Include="SabreTools.Serialization" Version="[2.0.2]" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="9.0.9" Condition="!$(TargetFramework.StartsWith(`net2`)) AND !$(TargetFramework.StartsWith(`net3`)) AND !$(TargetFramework.StartsWith(`net40`)) AND !$(TargetFramework.StartsWith(`net452`))" />
<PackageReference Include="SabreTools.IO" Version="[1.8.0]" />
<PackageReference Include="SabreTools.Serialization" Version="[2.1.0]" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="9.0.10" Condition="!$(TargetFramework.StartsWith(`net2`)) AND !$(TargetFramework.StartsWith(`net3`)) AND !$(TargetFramework.StartsWith(`net40`)) AND !$(TargetFramework.StartsWith(`net452`))" />
</ItemGroup>

</Project>
18 changes: 18 additions & 0 deletions BinaryObjectScanner/Data/StaticChecks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@ public static IContentCheck[] ContentCheckClasses
}
}

/// <summary>
/// Cache for all IISOCheck<ISO> types
/// </summary>
public static IDiskImageCheck<ISO9660>[] ISO9660CheckClasses
{
get
{
iso9660CheckClasses ??= InitCheckClasses<IDiskImageCheck<ISO9660>>();
return iso9660CheckClasses;
}
}

/// <summary>
/// Cache for all IExecutableCheck<LinearExecutable> types
/// </summary>
Expand Down Expand Up @@ -91,6 +103,12 @@ public static IExecutableCheck<PortableExecutable>[] PortableExecutableCheckClas
/// </summary>
private static IContentCheck[]? contentCheckClasses;


/// <summary>
/// Cache for all IISOCheck<ISO9660> types
/// </summary>
private static IDiskImageCheck<ISO9660>[]? iso9660CheckClasses;

/// <summary>
/// Cache for all IExecutableCheck<LinearExecutable> types
/// </summary>
Expand Down
51 changes: 51 additions & 0 deletions BinaryObjectScanner/FileType/DiskImage.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using System.IO;
using BinaryObjectScanner.Data;
using BinaryObjectScanner.Interfaces;
using SabreTools.IO.Extensions;
using SabreTools.Serialization.Wrappers;

namespace BinaryObjectScanner.FileType
{
/// <summary>
/// Disk image file
/// </summary>
public abstract class DiskImage<T> : DetectableBase<T>
where T : WrapperBase
{
/// <inheritdoc/>
public DiskImage(T wrapper) : base(wrapper) { }

#region Check Runners

/// <summary>
/// Handle a single file based on all ISO check implementations
/// </summary>
/// <param name="file">Name of the source file of the ISO, for tracking</param>
/// <param name="checks">Set of checks to use</param>
/// <param name="includeDebug">True to include debug data, false otherwise</param>
/// <returns>Set of protections in file, empty on error</returns>
protected IDictionary<U, string> RunISOChecks<U>(string file, U[] checks, bool includeDebug)
where U : IDiskImageCheck<T>
{
// Create the output dictionary
var protections = new CheckDictionary<U>();

// Iterate through all checks
checks.IterateWithAction(checkClass =>
{
// Get the protection for the class, if possible
var protection = checkClass.CheckDiskImage(file, _wrapper, includeDebug);
if (string.IsNullOrEmpty(protection))
return;

protections.Append(checkClass, protection);
});

return protections;
}

#endregion
}
}
1 change: 0 additions & 1 deletion BinaryObjectScanner/FileType/Executable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ protected IDictionary<IContentCheck, string> RunContentChecks(string? file, Stre
/// <param name="file">Name of the source file of the executable, for tracking</param>
/// <param name="exe">Executable to scan</param>
/// <param name="checks">Set of checks to use</param>
/// <param name="scanner">Scanner for handling recursive protections</param>
/// <param name="includeDebug">True to include debug data, false otherwise</param>
/// <returns>Set of protections in file, empty on error</returns>
protected IDictionary<U, string> RunExecutableChecks<U>(string file, T exe, U[] checks, bool includeDebug)
Expand Down
Loading