mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-04-23 14:43:06 +00:00
Support .NET Framework 2.0
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using System.Collections.Concurrent;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
@@ -59,7 +61,7 @@ namespace BinaryObjectScanner.Protection
|
||||
};
|
||||
|
||||
var match = MatchUtil.GetFirstMatch(file, dataSectionRaw, matchers, includeDebug);
|
||||
if (!string.IsNullOrWhiteSpace(match))
|
||||
if (!string.IsNullOrEmpty(match))
|
||||
return match;
|
||||
}
|
||||
|
||||
@@ -67,7 +69,11 @@ namespace BinaryObjectScanner.Protection
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Collections.Concurrent;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
using SabreTools.Matching;
|
||||
@@ -16,7 +18,11 @@ namespace BinaryObjectScanner.Protection
|
||||
public class AlphaDVD : IPathCheck
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Collections.Concurrent;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
using SabreTools.Matching;
|
||||
@@ -13,7 +15,11 @@ namespace BinaryObjectScanner.Protection
|
||||
public class Bitpool : IPathCheck
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Collections.Concurrent;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
@@ -130,7 +132,11 @@ namespace BinaryObjectScanner.Protection
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
// TODO: Investigate reference to "bbz650.tmp" in "Byteshield.dll" (Redump entry 6236)
|
||||
// Files with the ".bbz" extension are associated with ByteShield, but the extenstion is known to be used in other places as well.
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -162,7 +164,7 @@ namespace BinaryObjectScanner.Protection
|
||||
};
|
||||
|
||||
var match = MatchUtil.GetFirstMatch(file, pex.StubExecutableData, matchers, includeDebug);
|
||||
if (!string.IsNullOrWhiteSpace(match))
|
||||
if (!string.IsNullOrEmpty(match))
|
||||
return match;
|
||||
}
|
||||
|
||||
@@ -182,7 +184,11 @@ namespace BinaryObjectScanner.Protection
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
// TODO: Original had "CDCOPS.DLL" required and all the rest in a combined OR
|
||||
var matchers = new List<PathMatchSet>
|
||||
@@ -228,7 +234,7 @@ namespace BinaryObjectScanner.Protection
|
||||
if (fileContent == null)
|
||||
return null;
|
||||
|
||||
#if NET40
|
||||
#if NET20 || NET35 || NET40
|
||||
byte[] versionBytes = new byte[4];
|
||||
Array.Copy(fileContent, positions[0] + 15, versionBytes, 0, 4);
|
||||
char[] version = versionBytes.Select(b => (char)b).ToArray();
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
@@ -55,7 +57,11 @@ namespace BinaryObjectScanner.Protection
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Collections.Concurrent;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
using SabreTools.Matching;
|
||||
@@ -53,7 +55,7 @@ namespace BinaryObjectScanner.Protection
|
||||
};
|
||||
|
||||
var match = MatchUtil.GetFirstMatch(file, dataSectionRaw, matchers, includeDebug);
|
||||
if (!string.IsNullOrWhiteSpace(match))
|
||||
if (!string.IsNullOrEmpty(match))
|
||||
return match;
|
||||
}
|
||||
|
||||
@@ -61,7 +63,11 @@ namespace BinaryObjectScanner.Protection
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Collections.Concurrent;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
using SabreTools.Matching;
|
||||
@@ -17,7 +19,11 @@ namespace BinaryObjectScanner.Protection
|
||||
public class CDProtector : IPathCheck
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Collections.Concurrent;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
using SabreTools.Matching;
|
||||
@@ -8,7 +10,11 @@ namespace BinaryObjectScanner.Protection
|
||||
public class CDX : IPathCheck
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
// TODO: Verify if these are OR or AND
|
||||
var matchers = new List<PathMatchSet>
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
using SabreTools.Matching;
|
||||
@@ -53,7 +55,11 @@ namespace BinaryObjectScanner.Protection
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
@@ -54,7 +56,11 @@ namespace BinaryObjectScanner.Protection
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Collections.Concurrent;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
using SabreTools.Matching;
|
||||
@@ -30,7 +32,11 @@ namespace BinaryObjectScanner.Protection
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
// TODO: The following checks are overly broad and should be refined
|
||||
// TODO: Look into .PFF files as an indicator. At least one disc has those oversized files
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Collections.Concurrent;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
using SabreTools.Matching;
|
||||
@@ -8,7 +10,11 @@ namespace BinaryObjectScanner.Protection
|
||||
public class DVDCrypt : IPathCheck
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Collections.Concurrent;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -10,9 +12,17 @@ namespace BinaryObjectScanner.Protection
|
||||
public class DVDMoviePROTECT : IPathCheck
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
#if NET20 || NET35
|
||||
var protections = new Queue<string>();
|
||||
#else
|
||||
var protections = new ConcurrentQueue<string>();
|
||||
#endif
|
||||
if (files == null)
|
||||
return protections;
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
using SabreTools.Matching;
|
||||
@@ -85,7 +87,7 @@ namespace BinaryObjectScanner.Protection
|
||||
};
|
||||
|
||||
// TODO: Re-enable all Entry Point checks after implementing
|
||||
// if (pex.ContainsSection(".arch") || pex.ContainsSection(".srdata") || !string.IsNullOrWhiteSpace(MatchUtil.GetFirstMatch(file, pex.EntryPointRaw, timingMatchers, includeDebug)))
|
||||
// if (pex.ContainsSection(".arch") || pex.ContainsSection(".srdata") || !string.IsNullOrEmpty(MatchUtil.GetFirstMatch(file, pex.EntryPointRaw, timingMatchers, includeDebug)))
|
||||
// {
|
||||
// if (pex.OH_Magic == OptionalHeaderType.PE32Plus)
|
||||
// {
|
||||
@@ -158,7 +160,7 @@ namespace BinaryObjectScanner.Protection
|
||||
// };
|
||||
|
||||
// var match = MatchUtil.GetFirstMatch(file, pex.EntryPointRaw, matchers, includeDebug);
|
||||
// if (!string.IsNullOrWhiteSpace(match))
|
||||
// if (!string.IsNullOrEmpty(match))
|
||||
// return match;
|
||||
|
||||
// return "Denuvo (Unknown x64 Version)";
|
||||
@@ -224,7 +226,7 @@ namespace BinaryObjectScanner.Protection
|
||||
// };
|
||||
|
||||
// var match = MatchUtil.GetFirstMatch(file, pex.EntryPointRaw, matchers, includeDebug);
|
||||
// if (!string.IsNullOrWhiteSpace(match))
|
||||
// if (!string.IsNullOrEmpty(match))
|
||||
// return match;
|
||||
|
||||
// //// Check if steam_api64.dll present
|
||||
@@ -255,7 +257,11 @@ namespace BinaryObjectScanner.Protection
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Collections.Concurrent;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
@@ -53,7 +55,11 @@ namespace BinaryObjectScanner.Protection
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Collections.Concurrent;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
@@ -22,7 +24,11 @@ namespace BinaryObjectScanner.Protection
|
||||
// https://www.gamecopyworld.com/games/pc_pc_calcio_2000.shtml
|
||||
// https://www.gamecopyworld.com/games/pc_pc_futbol_2000.shtml
|
||||
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -128,7 +130,7 @@ namespace BinaryObjectScanner.Protection
|
||||
};
|
||||
|
||||
var match = MatchUtil.GetFirstMatch(file, vbnData, matchers, includeDebug);
|
||||
if (!string.IsNullOrWhiteSpace(match))
|
||||
if (!string.IsNullOrEmpty(match))
|
||||
return match;
|
||||
}
|
||||
}
|
||||
@@ -137,7 +139,11 @@ namespace BinaryObjectScanner.Protection
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Collections.Concurrent;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
using SabreTools.Matching;
|
||||
@@ -80,7 +82,11 @@ namespace BinaryObjectScanner.Protection
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
// TODO: Search for the presence of the folder "EasyAntiCheat" specifically, which is present in every checked version so far.
|
||||
var matchers = new List<PathMatchSet>
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
@@ -51,7 +53,11 @@ namespace BinaryObjectScanner.Protection
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Collections.Concurrent;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
using SabreTools.Matching;
|
||||
@@ -15,7 +17,11 @@ namespace BinaryObjectScanner.Protection
|
||||
// TODO: Add an MS-DOS executable check for "FREELOCK.EXE".
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
@@ -36,7 +38,11 @@ namespace BinaryObjectScanner.ProtectionType
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Collections.Concurrent;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
@@ -39,7 +41,11 @@ namespace BinaryObjectScanner.Protection
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
@@ -68,7 +70,11 @@ namespace BinaryObjectScanner.Protection
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Collections.Concurrent;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -54,7 +56,11 @@ namespace BinaryObjectScanner.Protection
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Collections.Concurrent;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
using SabreTools.Matching;
|
||||
@@ -12,7 +14,11 @@ namespace BinaryObjectScanner.Protection
|
||||
public class IndyVCD : IPathCheck
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
// TODO: Verify if these are OR or AND
|
||||
var matchers = new List<PathMatchSet>
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace BinaryObjectScanner.Protection
|
||||
};
|
||||
|
||||
var match = MatchUtil.GetFirstMatch(file, dcrtextData, matchers, includeDebug);
|
||||
if (!string.IsNullOrWhiteSpace(match))
|
||||
if (!string.IsNullOrEmpty(match))
|
||||
return match;
|
||||
}
|
||||
}
|
||||
@@ -73,7 +73,7 @@ namespace BinaryObjectScanner.Protection
|
||||
return null;
|
||||
|
||||
int position = positions[0];
|
||||
#if NET40
|
||||
#if NET20 || NET35 || NET40
|
||||
byte[] versionBytes = new byte[8];
|
||||
Array.Copy(fileContent, position + 67, versionBytes, 0, 8);
|
||||
char[] version = versionBytes.Select(b => (char)b).ToArray();
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -49,15 +51,24 @@ namespace BinaryObjectScanner.Protection
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
// All found to be present on at multiple albums with LabelGate CD2 (Redump entry 95010 and product ID SVWC-7185), the original version of LabelGate still needs to be investigated.
|
||||
new PathMatchSet(new List<PathMatch>
|
||||
{
|
||||
#if NET20 || NET35
|
||||
new PathMatch(Path.Combine(Path.Combine("BIN", "WIN32"), "MQ2SETUP.EXE").Replace("\\", "/"), useEndsWith: true),
|
||||
new PathMatch(Path.Combine(Path.Combine("BIN", "WIN32"), "MQSTART.EXE").Replace("\\", "/"), useEndsWith: true),
|
||||
#else
|
||||
new PathMatch(Path.Combine("BIN", "WIN32", "MQ2SETUP.EXE").Replace("\\", "/"), useEndsWith: true),
|
||||
new PathMatch(Path.Combine("BIN", "WIN32", "MQSTART.EXE").Replace("\\", "/"), useEndsWith: true),
|
||||
#endif
|
||||
}, "LabelGate CD2 Media Player"),
|
||||
|
||||
// All of these are also found present on all known LabelGate CD2 releases, though an additional file "RESERVED.DAT" is found in the same directory in at least one release (Product ID SVWC-7185)
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -111,7 +113,11 @@ namespace BinaryObjectScanner.Protection
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
@@ -169,7 +175,7 @@ namespace BinaryObjectScanner.Protection
|
||||
if (versionTwo)
|
||||
{
|
||||
int index = position + 14;
|
||||
#if NET40
|
||||
#if NET20 || NET35 || NET40
|
||||
byte[] temp = new byte[2];
|
||||
Array.Copy(sectionContent, index, temp, 0, 2);
|
||||
day = new string(temp.Select(b => (char)b).ToArray());
|
||||
@@ -190,7 +196,7 @@ namespace BinaryObjectScanner.Protection
|
||||
else
|
||||
{
|
||||
int index = position + 13;
|
||||
#if NET40
|
||||
#if NET20 || NET35 || NET40
|
||||
byte[] temp = new byte[2];
|
||||
Array.Copy(sectionContent, index, temp, 0, 2);
|
||||
day = new string(temp.Select(b => (char)b).ToArray());
|
||||
@@ -218,7 +224,7 @@ namespace BinaryObjectScanner.Protection
|
||||
if (sectionContent == null)
|
||||
return null;
|
||||
|
||||
#if NET40
|
||||
#if NET20 || NET35 || NET40
|
||||
byte[] temp = new byte[4];
|
||||
Array.Copy(sectionContent, position + 76, temp, 0, 4);
|
||||
return new string(temp.Select(b => (char)b).ToArray());
|
||||
@@ -241,7 +247,7 @@ namespace BinaryObjectScanner.Protection
|
||||
|
||||
private static string GetVersion16Bit(byte[] fileContent)
|
||||
{
|
||||
#if NET40
|
||||
#if NET20 || NET35 || NET40
|
||||
byte[] temp = new byte[7];
|
||||
Array.Copy(fileContent, 71, temp, 0, 7);
|
||||
char[] version = temp.Select(b => (char)b).ToArray();
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using SabreTools.Matching;
|
||||
@@ -148,7 +150,11 @@ namespace BinaryObjectScanner.Protection
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Interfaces.IPathCheck.CheckDirectoryPath(string, IEnumerable{string})"/>
|
||||
#if NET20 || NET35
|
||||
internal Queue<string> CDillaCheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
internal ConcurrentQueue<string> CDillaCheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -64,7 +66,11 @@ namespace BinaryObjectScanner.Protection
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Interfaces.IPathCheck.CheckDirectoryPath(string, IEnumerable{string})"/>
|
||||
#if NET20 || NET35
|
||||
internal Queue<string> CactusDataShieldCheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
internal ConcurrentQueue<string> CactusDataShieldCheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
// TODO: Verify if these are OR or AND
|
||||
var matchers = new List<PathMatchSet>
|
||||
@@ -124,10 +130,10 @@ namespace BinaryObjectScanner.Protection
|
||||
|
||||
// Find the version.txt file first
|
||||
var versionPath = files.FirstOrDefault(f => Path.GetFileName(f).Equals("version.txt", StringComparison.OrdinalIgnoreCase));
|
||||
if (!string.IsNullOrWhiteSpace(versionPath))
|
||||
if (!string.IsNullOrEmpty(versionPath))
|
||||
{
|
||||
var version = GetCactusDataShieldInternalVersion(versionPath);
|
||||
if (!string.IsNullOrWhiteSpace(version))
|
||||
if (!string.IsNullOrEmpty(version))
|
||||
return version!;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using SabreTools.Matching;
|
||||
@@ -36,7 +38,7 @@ namespace BinaryObjectScanner.Protection
|
||||
if (name?.Equals("rgasdev", StringComparison.OrdinalIgnoreCase) == true)
|
||||
return "RipGuard";
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(file) && File.Exists(file))
|
||||
if (!string.IsNullOrEmpty(file) && File.Exists(file))
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -59,7 +61,11 @@ namespace BinaryObjectScanner.Protection
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Interfaces.IPathCheck.CheckDirectoryPath(string, IEnumerable{string})"/>
|
||||
#if NET20 || NET35
|
||||
internal Queue<string> RipGuardCheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
internal ConcurrentQueue<string> RipGuardCheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
@@ -74,10 +80,10 @@ namespace BinaryObjectScanner.Protection
|
||||
return MatchUtil.GetAllMatches(files, matchers, any: false);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Interfaces.IPathCheck.CheckFilePath(string)"/>
|
||||
internal string? RipGuardCheckFilePath(string path)
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
/// <inheritdoc cref="Interfaces.IPathCheck.CheckFilePath(string)"/>
|
||||
internal string? RipGuardCheckFilePath(string path)
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
// Found in the Black Lagoon Season 1 DVD steelbook box set (Geneon ID 12970).
|
||||
new PathMatchSet(new PathMatch("G23YHWO1.EXE", useEndsWith: true), "RipGuard"),
|
||||
@@ -87,7 +93,7 @@ namespace BinaryObjectScanner.Protection
|
||||
new PathMatchSet(new PathMatch("9KMJ9G4I.EXE", useEndsWith: true), "RipGuard (Unconfirmed - Please report to us on GitHub)"),
|
||||
};
|
||||
|
||||
return MatchUtil.GetFirstMatch(path, matchers, any: true);
|
||||
return MatchUtil.GetFirstMatch(path, matchers, any: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -144,7 +146,11 @@ namespace BinaryObjectScanner.Protection
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Interfaces.IPathCheck.CheckDirectoryPath(string, IEnumerable{string})"/>
|
||||
#if NET20 || NET35
|
||||
internal Queue<string> SafeCastCheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
internal ConcurrentQueue<string> SafeCastCheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -110,7 +112,11 @@ namespace BinaryObjectScanner.Protection
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Interfaces.IPathCheck.CheckDirectoryPath(string, IEnumerable{string})"/>
|
||||
#if NET20 || NET35
|
||||
internal Queue<string> SafeDiscCheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
internal ConcurrentQueue<string> SafeDiscCheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -27,16 +29,16 @@ namespace BinaryObjectScanner.Protection
|
||||
|
||||
// Run C-Dilla NE checks
|
||||
var cDilla = CDillaCheckNewExecutable(file, nex, includeDebug);
|
||||
if (!string.IsNullOrWhiteSpace(cDilla))
|
||||
if (!string.IsNullOrEmpty(cDilla))
|
||||
resultsList.Add(cDilla!);
|
||||
|
||||
// Run SafeCast NE checks
|
||||
var safeCast = SafeCastCheckNewExecutable(file, nex, includeDebug);
|
||||
if (!string.IsNullOrWhiteSpace(safeCast))
|
||||
if (!string.IsNullOrEmpty(safeCast))
|
||||
resultsList.Add(safeCast!);
|
||||
|
||||
if (resultsList != null && resultsList.Count > 0)
|
||||
return string.Join(", ", resultsList);
|
||||
return string.Join(", ", resultsList.ToArray());
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -73,7 +75,7 @@ namespace BinaryObjectScanner.Protection
|
||||
{
|
||||
// Check the header padding for protected sections.
|
||||
var sectionMatch = CheckSectionForProtection(file, includeDebug, pex.HeaderPaddingStrings, pex.HeaderPaddingData, true);
|
||||
if (!string.IsNullOrWhiteSpace(sectionMatch))
|
||||
if (!string.IsNullOrEmpty(sectionMatch))
|
||||
{
|
||||
resultsList.Add(sectionMatch!);
|
||||
}
|
||||
@@ -81,7 +83,7 @@ namespace BinaryObjectScanner.Protection
|
||||
{
|
||||
// Get the .data section, if it exists, for protected sections.
|
||||
sectionMatch = CheckSectionForProtection(file, includeDebug, pex.GetFirstSectionStrings(".data"), pex.GetFirstSectionData(".data"), true);
|
||||
if (!string.IsNullOrWhiteSpace(sectionMatch))
|
||||
if (!string.IsNullOrEmpty(sectionMatch))
|
||||
resultsList.Add(sectionMatch!);
|
||||
}
|
||||
|
||||
@@ -110,7 +112,7 @@ namespace BinaryObjectScanner.Protection
|
||||
{
|
||||
// Check the header padding for protected sections.
|
||||
var sectionMatch = CheckSectionForProtection(file, includeDebug, pex.HeaderPaddingStrings, pex.HeaderPaddingData, false);
|
||||
if (!string.IsNullOrWhiteSpace(sectionMatch))
|
||||
if (!string.IsNullOrEmpty(sectionMatch))
|
||||
{
|
||||
resultsList.Add(sectionMatch!);
|
||||
}
|
||||
@@ -118,133 +120,173 @@ namespace BinaryObjectScanner.Protection
|
||||
{
|
||||
// Check the .data section, if it exists, for protected sections.
|
||||
sectionMatch = CheckSectionForProtection(file, includeDebug, pex.GetFirstSectionStrings(".data"), pex.GetFirstSectionData(".data"), false);
|
||||
if (!string.IsNullOrWhiteSpace(sectionMatch))
|
||||
if (!string.IsNullOrEmpty(sectionMatch))
|
||||
resultsList.Add(sectionMatch!);
|
||||
}
|
||||
}
|
||||
|
||||
// Run Cactus Data Shield PE checks
|
||||
var match = CactusDataShieldCheckPortableExecutable(file, pex, includeDebug);
|
||||
if (!string.IsNullOrWhiteSpace(match))
|
||||
if (!string.IsNullOrEmpty(match))
|
||||
resultsList.Add(match!);
|
||||
|
||||
// Run C-Dilla PE checks
|
||||
match = CDillaCheckPortableExecutable(file, pex, includeDebug);
|
||||
if (!string.IsNullOrWhiteSpace(match))
|
||||
if (!string.IsNullOrEmpty(match))
|
||||
resultsList.Add(match!);
|
||||
|
||||
// Run RipGuard PE checks
|
||||
match = RipGuardCheckPortableExecutable(file, pex, includeDebug);
|
||||
if (!string.IsNullOrWhiteSpace(match))
|
||||
if (!string.IsNullOrEmpty(match))
|
||||
resultsList.Add(match!);
|
||||
|
||||
// Run SafeCast PE checks
|
||||
match = SafeCastCheckPortableExecutable(file, pex, includeDebug);
|
||||
if (!string.IsNullOrWhiteSpace(match))
|
||||
if (!string.IsNullOrEmpty(match))
|
||||
resultsList.Add(match!);
|
||||
|
||||
// Run SafeDisc PE checks
|
||||
match = SafeDiscCheckPortableExecutable(file, pex, includeDebug);
|
||||
if (!string.IsNullOrWhiteSpace(match))
|
||||
if (!string.IsNullOrEmpty(match))
|
||||
resultsList.Add(match!);
|
||||
|
||||
// Run FLEXnet PE checks
|
||||
match = FLEXnetCheckPortableExecutable(file, pex, includeDebug);
|
||||
if (!string.IsNullOrWhiteSpace(match))
|
||||
if (!string.IsNullOrEmpty(match))
|
||||
resultsList.Add(match!);
|
||||
|
||||
// Clean the result list
|
||||
resultsList = CleanResultList(resultsList);
|
||||
if (resultsList != null && resultsList.Count > 0)
|
||||
return string.Join(", ", resultsList);
|
||||
return string.Join(", ", resultsList.ToArray());
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
#if NET20 || NET35
|
||||
var results = new Queue<string>();
|
||||
#else
|
||||
var results = new ConcurrentQueue<string>();
|
||||
#endif
|
||||
|
||||
// Run Macrovision directory checks
|
||||
var macrovision = MacrovisionCheckDirectoryPath(path, files);
|
||||
#if NET20 || NET35
|
||||
if (macrovision != null && macrovision.Count > 0)
|
||||
#else
|
||||
if (macrovision != null && !macrovision.IsEmpty)
|
||||
#endif
|
||||
results.AddRange(macrovision);
|
||||
|
||||
// Run Cactus Data Shield directory checks
|
||||
var cactusDataShield = CactusDataShieldCheckDirectoryPath(path, files);
|
||||
#if NET20 || NET35
|
||||
if (cactusDataShield != null && cactusDataShield.Count > 0)
|
||||
#else
|
||||
if (cactusDataShield != null && !cactusDataShield.IsEmpty)
|
||||
#endif
|
||||
results.AddRange(cactusDataShield);
|
||||
|
||||
// Run C-Dilla directory checks
|
||||
var cDilla = CDillaCheckDirectoryPath(path, files);
|
||||
#if NET20 || NET35
|
||||
if (cDilla != null && cDilla.Count > 0)
|
||||
#else
|
||||
if (cDilla != null && !cDilla.IsEmpty)
|
||||
#endif
|
||||
results.AddRange(cDilla);
|
||||
|
||||
// Run RipGuard directory checks
|
||||
var ripGuard = RipGuardCheckDirectoryPath(path, files);
|
||||
#if NET20 || NET35
|
||||
if (ripGuard != null && ripGuard.Count > 0)
|
||||
#else
|
||||
if (ripGuard != null && !ripGuard.IsEmpty)
|
||||
#endif
|
||||
results.AddRange(ripGuard);
|
||||
|
||||
// Run SafeCast directory checks
|
||||
var safeCast = SafeCastCheckDirectoryPath(path, files);
|
||||
#if NET20 || NET35
|
||||
if (safeCast != null && safeCast.Count > 0)
|
||||
#else
|
||||
if (safeCast != null && !safeCast.IsEmpty)
|
||||
#endif
|
||||
results.AddRange(safeCast);
|
||||
|
||||
// Run SafeDisc directory checks
|
||||
var safeDisc = SafeDiscCheckDirectoryPath(path, files);
|
||||
#if NET20 || NET35
|
||||
if (safeDisc != null && safeDisc.Count > 0)
|
||||
#else
|
||||
if (safeDisc != null && !safeDisc.IsEmpty)
|
||||
#endif
|
||||
results.AddRange(safeDisc);
|
||||
|
||||
if (results != null && results.Count > 0)
|
||||
return results;
|
||||
|
||||
#if NET20 || NET35
|
||||
return new Queue<string>();
|
||||
#else
|
||||
return new ConcurrentQueue<string>();
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string? CheckFilePath(string path)
|
||||
{
|
||||
List<string> resultsList = new List<string>();
|
||||
var resultsList = new List<string>();
|
||||
|
||||
// Run Macrovision file checks
|
||||
var macrovision = MacrovisionCheckFilePath(path);
|
||||
if (!string.IsNullOrWhiteSpace(macrovision))
|
||||
if (!string.IsNullOrEmpty(macrovision))
|
||||
resultsList.Add(macrovision!);
|
||||
|
||||
// Run Cactus Data Shield file checks
|
||||
var cactusDataShield = CactusDataShieldCheckFilePath(path);
|
||||
if (!string.IsNullOrWhiteSpace(cactusDataShield))
|
||||
if (!string.IsNullOrEmpty(cactusDataShield))
|
||||
resultsList.Add(cactusDataShield!);
|
||||
|
||||
// Run C-Dilla file checks
|
||||
var cDilla = CDillaCheckFilePath(path);
|
||||
if (!string.IsNullOrWhiteSpace(cDilla))
|
||||
if (!string.IsNullOrEmpty(cDilla))
|
||||
resultsList.Add(cDilla!);
|
||||
|
||||
// Run RipGuard file checks
|
||||
var ripGuard = RipGuardCheckFilePath(path);
|
||||
if (!string.IsNullOrWhiteSpace(ripGuard))
|
||||
if (!string.IsNullOrEmpty(ripGuard))
|
||||
resultsList.Add(ripGuard!);
|
||||
|
||||
// Run SafeCast file checks
|
||||
var safeCast = SafeCastCheckFilePath(path);
|
||||
if (!string.IsNullOrWhiteSpace(safeCast))
|
||||
if (!string.IsNullOrEmpty(safeCast))
|
||||
resultsList.Add(safeCast!);
|
||||
|
||||
// Run SafeDisc file checks
|
||||
var safeDisc = SafeDiscCheckFilePath(path);
|
||||
if (!string.IsNullOrWhiteSpace(safeDisc))
|
||||
if (!string.IsNullOrEmpty(safeDisc))
|
||||
resultsList.Add(safeDisc!);
|
||||
|
||||
if (resultsList != null && resultsList.Count > 0)
|
||||
return string.Join(", ", resultsList);
|
||||
return string.Join(", ", resultsList.ToArray());
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IPathCheck.CheckDirectoryPath(string, IEnumerable{string})"/>
|
||||
#if NET20 || NET35
|
||||
internal Queue<string> MacrovisionCheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
internal ConcurrentQueue<string> MacrovisionCheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
using SabreTools.Matching;
|
||||
@@ -37,7 +39,11 @@ namespace BinaryObjectScanner.Protection
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
@@ -63,7 +65,11 @@ namespace BinaryObjectScanner.Protection
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Collections.Concurrent;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
using SabreTools.Matching;
|
||||
@@ -50,7 +52,11 @@ namespace BinaryObjectScanner.Protection
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
@@ -64,7 +66,11 @@ namespace BinaryObjectScanner.Protection
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
@@ -82,8 +88,8 @@ namespace BinaryObjectScanner.Protection
|
||||
// Always found together on OpenMG releases ("Touch" by Amerie, Redump entry 95010, and product ID SVWC-7185).
|
||||
new PathMatchSet(new List<PathMatch>
|
||||
{
|
||||
new PathMatch(Path.Combine("SDKHM.DLL").Replace("\\", "/"), useEndsWith: true),
|
||||
new PathMatch(Path.Combine("SDKHM.EXE").Replace("\\", "/"), useEndsWith: true),
|
||||
new FilePathMatch("SDKHM.DLL"),
|
||||
new FilePathMatch("SDKHM.EXE"),
|
||||
}, "OpenMG"),
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
using SabreTools.Matching;
|
||||
@@ -29,7 +31,11 @@ namespace BinaryObjectScanner.Protection
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
using SabreTools.Matching;
|
||||
@@ -40,7 +42,11 @@ namespace BinaryObjectScanner.Protection
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Collections.Concurrent;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -10,9 +12,17 @@ namespace BinaryObjectScanner.Protection
|
||||
public class ProtectDVDVideo : IPathCheck
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
#if NET20 || NET35
|
||||
var protections = new Queue<string>();
|
||||
#else
|
||||
var protections = new ConcurrentQueue<string>();
|
||||
#endif
|
||||
if (files == null)
|
||||
return protections;
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace BinaryObjectScanner.Protection
|
||||
};
|
||||
|
||||
var match = MatchUtil.GetFirstMatch(file, nthSectionData, matchers, includeDebug);
|
||||
if (!string.IsNullOrWhiteSpace(match))
|
||||
if (!string.IsNullOrEmpty(match))
|
||||
return match;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace BinaryObjectScanner.Protection
|
||||
};
|
||||
|
||||
var match = MatchUtil.GetFirstMatch(file, dataSectionRaw, matchers, includeDebug);
|
||||
if (!string.IsNullOrWhiteSpace(match))
|
||||
if (!string.IsNullOrEmpty(match))
|
||||
return match;
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace BinaryObjectScanner.Protection
|
||||
};
|
||||
|
||||
var match = MatchUtil.GetFirstMatch(file, lastSectionData, matchers, includeDebug);
|
||||
if (!string.IsNullOrWhiteSpace(match))
|
||||
if (!string.IsNullOrEmpty(match))
|
||||
return match;
|
||||
}
|
||||
}
|
||||
@@ -136,7 +136,7 @@ namespace BinaryObjectScanner.Protection
|
||||
int index = positions[0] - 12;
|
||||
|
||||
// Version 6-7 with Build Number in plain text
|
||||
#if NET40
|
||||
#if NET20 || NET35 || NET40
|
||||
byte[] temp = new byte[4];
|
||||
Array.Copy(fileContent, index, temp, 0, 4);
|
||||
if (temp.SequenceEqual(new byte[] { 0x0A, 0x0D, 0x0A, 0x0D }))
|
||||
@@ -147,7 +147,7 @@ namespace BinaryObjectScanner.Protection
|
||||
index = positions[0] - 12 - 6;
|
||||
|
||||
// Version 7
|
||||
#if NET40
|
||||
#if NET20 || NET35 || NET40
|
||||
temp = new byte[6];
|
||||
Array.Copy(fileContent, index, temp, 0, 6);
|
||||
if (new string(temp.Select(b => (char)b).ToArray()) == "Henrik")
|
||||
@@ -176,7 +176,7 @@ namespace BinaryObjectScanner.Protection
|
||||
index -= 5;
|
||||
}
|
||||
|
||||
#if NET40
|
||||
#if NET20 || NET35 || NET40
|
||||
temp = new byte[6];
|
||||
Array.Copy(fileContent, index, temp, 0, 6);
|
||||
char[] arrBuild = temp.Select(b => (char)b).ToArray();
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
@@ -97,7 +99,11 @@ namespace BinaryObjectScanner.Protection
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Collections.Concurrent;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
using SabreTools.Matching;
|
||||
@@ -34,7 +36,11 @@ namespace BinaryObjectScanner.Protection
|
||||
// TODO: Confirm if these checks are only for ProRing or if they are also for older Ring PROTECH
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Collections.Concurrent;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
using SabreTools.Matching;
|
||||
@@ -51,17 +53,17 @@ namespace BinaryObjectScanner.Protection
|
||||
if (pex.EntryPointData.StartsWith(new byte?[]
|
||||
{
|
||||
0x60, 0xEB, 0x03, 0xC7, 0x84, 0xE8, 0xEB, 0x03,
|
||||
0xC7, 0x84, 0x9A, 0xE8, 0x00, 0x00, 0x00, 0x00,
|
||||
0xC7, 0x84, 0x9A, 0xE8, 0x00, 0x00, 0x00, 0x00,
|
||||
0x5D, 0x81, 0xED, 0x10, 0x00, 0x00, 0x00, 0xEB,
|
||||
0x03, 0xC7, 0x84, 0xE9, 0x64, 0xA0, 0x23, 0x00,
|
||||
0x00, 0x00, 0xEB
|
||||
}))
|
||||
return "SVKP v1.051";
|
||||
|
||||
|
||||
// Found in the SVKP 1.11 demo.
|
||||
if (pex.EntryPointData.StartsWith(new byte?[]
|
||||
{
|
||||
0x60, 0xE8, null, null, null, null, 0x5D, 0x81,
|
||||
0x60, 0xE8, null, null, null, null, 0x5D, 0x81,
|
||||
0xED, 0x06, null, null, null, 0x64, 0xA0, 0x23
|
||||
}))
|
||||
return "SVKP v1.11";
|
||||
@@ -69,8 +71,8 @@ namespace BinaryObjectScanner.Protection
|
||||
// Found in the SVKP 1.32 demo and Redump entry 84122.
|
||||
if (pex.EntryPointData.StartsWith(new byte?[]
|
||||
{
|
||||
0x60, 0xE8, 0x00, 0x00, 0x00, 0x00, 0x5D, 0x81,
|
||||
0xED, 0x06, 0x00, 0x00, 0x00, 0xEB, 0x05, 0xB8,
|
||||
0x60, 0xE8, 0x00, 0x00, 0x00, 0x00, 0x5D, 0x81,
|
||||
0xED, 0x06, 0x00, 0x00, 0x00, 0xEB, 0x05, 0xB8,
|
||||
null, null, null, null, 0x64, 0xA0, 0x23
|
||||
}))
|
||||
return "SVKP v1.3+";
|
||||
@@ -90,7 +92,11 @@ namespace BinaryObjectScanner.Protection
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Collections.Concurrent;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
using SabreTools.Matching;
|
||||
@@ -20,7 +22,11 @@ namespace BinaryObjectScanner.Protection
|
||||
public class SafeLock : IPathCheck
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
// Technically all need to exist but some might be renamed
|
||||
var matchers = new List<PathMatchSet>
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -65,7 +67,7 @@ namespace BinaryObjectScanner.Protection
|
||||
if (nthSection == null)
|
||||
continue;
|
||||
|
||||
#if NET40 || NET452
|
||||
#if NET20 || NET35 || NET40 || NET452
|
||||
string nthSectionName = Encoding.UTF8.GetString(nthSection.Name ?? []).TrimEnd('\0');
|
||||
#else
|
||||
string nthSectionName = Encoding.UTF8.GetString(nthSection.Name ?? Array.Empty<byte>()).TrimEnd('\0');
|
||||
@@ -83,7 +85,7 @@ namespace BinaryObjectScanner.Protection
|
||||
};
|
||||
|
||||
var match = MatchUtil.GetFirstMatch(file, nthSectionData, matchers, includeDebug);
|
||||
if (!string.IsNullOrWhiteSpace(match))
|
||||
if (!string.IsNullOrEmpty(match))
|
||||
return match;
|
||||
}
|
||||
}
|
||||
@@ -109,7 +111,11 @@ namespace BinaryObjectScanner.Protection
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Collections.Concurrent;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
@@ -29,7 +31,11 @@ namespace BinaryObjectScanner.Protection
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Collections.Concurrent;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
@@ -82,7 +84,11 @@ namespace BinaryObjectScanner.Protection
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
@@ -66,7 +68,7 @@ namespace BinaryObjectScanner.ProtectionType
|
||||
};
|
||||
|
||||
var match = MatchUtil.GetFirstMatch(file, initData, matchers, includeDebug);
|
||||
if (!string.IsNullOrWhiteSpace(match))
|
||||
if (!string.IsNullOrEmpty(match))
|
||||
return match;
|
||||
}
|
||||
}
|
||||
@@ -109,7 +111,11 @@ namespace BinaryObjectScanner.ProtectionType
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
@@ -150,7 +156,7 @@ namespace BinaryObjectScanner.ProtectionType
|
||||
|
||||
int position = positions[0];
|
||||
|
||||
#if NET40
|
||||
#if NET20 || NET35 || NET40
|
||||
byte[] id1 = new byte[3];
|
||||
Array.Copy(fileContent, position + 5, id1, 0, 3);
|
||||
byte[] id2 = new byte[4];
|
||||
@@ -180,7 +186,7 @@ namespace BinaryObjectScanner.ProtectionType
|
||||
return null;
|
||||
|
||||
int position = positions[0];
|
||||
#if NET40
|
||||
#if NET20 || NET35 || NET40
|
||||
byte[] id1 = new byte[3];
|
||||
Array.Copy(fileContent, position + 4, id1, 0, 3);
|
||||
byte[] id2 = new byte[4];
|
||||
@@ -224,7 +230,7 @@ namespace BinaryObjectScanner.ProtectionType
|
||||
private static string GetInternalVersion(PortableExecutable pex)
|
||||
{
|
||||
var companyName = pex.CompanyName?.ToLowerInvariant();
|
||||
if (!string.IsNullOrWhiteSpace(companyName) && (companyName!.Contains("solidshield") || companyName.Contains("tages")))
|
||||
if (!string.IsNullOrEmpty(companyName) && (companyName!.Contains("solidshield") || companyName.Contains("tages")))
|
||||
return pex.GetInternalVersion() ?? string.Empty;
|
||||
|
||||
return string.Empty;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
@@ -100,7 +102,11 @@ namespace BinaryObjectScanner.Protection
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Collections.Concurrent;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
using SabreTools.Matching;
|
||||
@@ -41,7 +43,11 @@ namespace BinaryObjectScanner.Protection
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Collections.Concurrent;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
using SabreTools.Matching;
|
||||
@@ -53,7 +55,11 @@ namespace BinaryObjectScanner.Protection
|
||||
public class TZCopyProtection : IPathCheck
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
@@ -54,7 +56,7 @@ namespace BinaryObjectScanner.ProtectionType
|
||||
};
|
||||
|
||||
var match = MatchUtil.GetFirstMatch(file, dataSectionRaw, matchers, includeDebug);
|
||||
if (!string.IsNullOrWhiteSpace(match))
|
||||
if (!string.IsNullOrEmpty(match))
|
||||
return match;
|
||||
}
|
||||
|
||||
@@ -62,7 +64,11 @@ namespace BinaryObjectScanner.ProtectionType
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Collections.Concurrent;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
@@ -12,7 +14,11 @@ namespace BinaryObjectScanner.Protection
|
||||
public class TivolaRingProtection : IPathCheck
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Collections.Concurrent;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
using SabreTools.Matching;
|
||||
@@ -44,7 +46,11 @@ namespace BinaryObjectScanner.Protection
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
@@ -43,7 +45,11 @@ namespace BinaryObjectScanner.Protection
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Collections.Concurrent;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
@@ -51,7 +53,11 @@ namespace BinaryObjectScanner.Protection
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Collections.Concurrent;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
using SabreTools.Matching;
|
||||
@@ -19,7 +21,11 @@ namespace BinaryObjectScanner.Protection
|
||||
public class WinLock : IPathCheck
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -41,9 +43,17 @@ namespace BinaryObjectScanner.Protection
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
#if NET20 || NET35
|
||||
var protections = new Queue<string>();
|
||||
#else
|
||||
var protections = new ConcurrentQueue<string>();
|
||||
#endif
|
||||
if (files == null)
|
||||
return protections;
|
||||
|
||||
@@ -52,10 +62,10 @@ namespace BinaryObjectScanner.Protection
|
||||
|| files.Any(f => Path.GetFileName(f).Equals("ECDPlayerControl.ocx", StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
var versionDatPath = files.FirstOrDefault(f => Path.GetFileName(f).Equals("VERSION.DAT", StringComparison.OrdinalIgnoreCase));
|
||||
if (!string.IsNullOrWhiteSpace(versionDatPath))
|
||||
if (!string.IsNullOrEmpty(versionDatPath))
|
||||
{
|
||||
var xcpVersion = GetDatVersion(versionDatPath);
|
||||
if (!string.IsNullOrWhiteSpace(xcpVersion))
|
||||
if (!string.IsNullOrEmpty(xcpVersion))
|
||||
protections.Enqueue(xcpVersion!);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
@@ -10,11 +12,19 @@ namespace BinaryObjectScanner.Protection
|
||||
public class Zzxzz : IPathCheck
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
#if NET20 || NET35
|
||||
new PathMatchSet(Path.Combine(Path.Combine(path, "Zzxzz"), "Zzz.aze").Replace("\\", "/"), "Zzxzz"),
|
||||
#else
|
||||
new PathMatchSet(Path.Combine(path, "Zzxzz", "Zzz.aze").Replace("\\", "/"), "Zzxzz"),
|
||||
#endif
|
||||
new PathMatchSet($"Zzxzz/", "Zzxzz"),
|
||||
};
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Collections.Concurrent;
|
||||
#if NET40_OR_GREATER || NETCOREAPP
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
using SabreTools.Matching;
|
||||
@@ -78,7 +80,11 @@ namespace BinaryObjectScanner.Protection
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
#if NET20 || NET35
|
||||
public Queue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#else
|
||||
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string>? files)
|
||||
#endif
|
||||
{
|
||||
var matchers = new List<PathMatchSet>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user