mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-02-10 05:40:03 +00:00
This change also removes a couple of things from `BurnOutSharp.Tools.Utilities` that are no longer needed there. Linear executables are included in the scanning classes. Update the guides accordingly.
85 lines
4.7 KiB
C#
85 lines
4.7 KiB
C#
using System.Collections.Concurrent;
|
|
using System.Collections.Generic;
|
|
using BinaryObjectScanner.Interfaces;
|
|
using BinaryObjectScanner.Matching;
|
|
using BinaryObjectScanner.Wrappers;
|
|
|
|
namespace BinaryObjectScanner.Protection
|
|
{
|
|
// Got renamed to Ubisoft Connect / Ubisoft Game Launcher
|
|
public class Uplay : IPathCheck, IPortableExecutableCheck
|
|
{
|
|
/// <inheritdoc/>
|
|
public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug)
|
|
{
|
|
// Get the sections from the executable, if possible
|
|
var sections = pex?.SectionTable;
|
|
if (sections == null)
|
|
return null;
|
|
|
|
string name = pex.FileDescription;
|
|
if (!string.IsNullOrEmpty(name) && name.Contains("Ubisoft Connect Installer"))
|
|
return "Uplay / Ubisoft Connect";
|
|
else if (!string.IsNullOrEmpty(name) && name.Contains("Ubisoft Connect Service"))
|
|
return "Uplay / Ubisoft Connect";
|
|
else if (!string.IsNullOrEmpty(name) && name.Contains("Ubisoft Connect WebCore"))
|
|
return "Uplay / Ubisoft Connect";
|
|
else if (!string.IsNullOrEmpty(name) && name.Contains("Ubisoft Crash Reporter"))
|
|
return "Uplay / Ubisoft Connect";
|
|
else if (!string.IsNullOrEmpty(name) && name.Contains("Ubisoft Game Launcher"))
|
|
return "Uplay / Ubisoft Connect";
|
|
else if (!string.IsNullOrEmpty(name) && name.Contains("Ubisoft Uplay Installer"))
|
|
return "Uplay / Ubisoft Connect";
|
|
else if (!string.IsNullOrEmpty(name) && name.Contains("Uplay launcher"))
|
|
return "Uplay / Ubisoft Connect";
|
|
|
|
// There's also a variant that looks like "Uplay <version> installer"
|
|
name = pex.ProductName;
|
|
if (!string.IsNullOrEmpty(name) && name.Contains("Ubisoft Connect"))
|
|
return "Uplay / Ubisoft Connect";
|
|
else if (!string.IsNullOrEmpty(name) && name.Contains("Uplay"))
|
|
return "Uplay / Ubisoft Connect";
|
|
|
|
return null;
|
|
}
|
|
|
|
/// <inheritdoc/>
|
|
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string> files)
|
|
{
|
|
var matchers = new List<PathMatchSet>
|
|
{
|
|
new PathMatchSet(new PathMatch("UbisoftConnect.exe", useEndsWith: true), "Uplay / Ubisoft Connect"),
|
|
new PathMatchSet(new PathMatch("UbisoftGameLauncher.exe", useEndsWith: true), "Uplay / Ubisoft Connect"),
|
|
new PathMatchSet(new PathMatch("UbisoftGameLauncher64.exe", useEndsWith: true), "Uplay / Ubisoft Connect"),
|
|
new PathMatchSet(new PathMatch("UbisoftGameLauncherInstaller.exe", useEndsWith: true), "Uplay / Ubisoft Connect"),
|
|
new PathMatchSet(new PathMatch("Uplay.exe", useEndsWith: true), "Uplay / Ubisoft Connect"),
|
|
new PathMatchSet(new PathMatch("UplayCrashReporter.exe", useEndsWith: true), "Uplay / Ubisoft Connect"),
|
|
new PathMatchSet(new PathMatch("UplayInstaller.exe", useEndsWith: true), "Uplay / Ubisoft Connect"),
|
|
new PathMatchSet(new PathMatch("UplayService.exe", useEndsWith: true), "Uplay / Ubisoft Connect"),
|
|
new PathMatchSet(new PathMatch("UplayWebCore.exe", useEndsWith: true), "Uplay / Ubisoft Connect"),
|
|
};
|
|
|
|
return MatchUtil.GetAllMatches(files, matchers, any: true);
|
|
}
|
|
|
|
/// <inheritdoc/>
|
|
public string CheckFilePath(string path)
|
|
{
|
|
var matchers = new List<PathMatchSet>
|
|
{
|
|
new PathMatchSet(new PathMatch("UbisoftConnect.exe", useEndsWith: true), "Uplay / Ubisoft Connect"),
|
|
new PathMatchSet(new PathMatch("UbisoftGameLauncher.exe", useEndsWith: true), "Uplay / Ubisoft Connect"),
|
|
new PathMatchSet(new PathMatch("UbisoftGameLauncher64.exe", useEndsWith: true), "Uplay / Ubisoft Connect"),
|
|
new PathMatchSet(new PathMatch("UbisoftGameLauncherInstaller.exe", useEndsWith: true), "Uplay / Ubisoft Connect"),
|
|
new PathMatchSet(new PathMatch("Uplay.exe", useEndsWith: true), "Uplay / Ubisoft Connect"),
|
|
new PathMatchSet(new PathMatch("UplayCrashReporter.exe", useEndsWith: true), "Uplay / Ubisoft Connect"),
|
|
new PathMatchSet(new PathMatch("UplayInstaller.exe", useEndsWith: true), "Uplay / Ubisoft Connect"),
|
|
new PathMatchSet(new PathMatch("UplayService.exe", useEndsWith: true), "Uplay / Ubisoft Connect"),
|
|
new PathMatchSet(new PathMatch("UplayWebCore.exe", useEndsWith: true), "Uplay / Ubisoft Connect"),
|
|
};
|
|
|
|
return MatchUtil.GetFirstMatch(path, matchers, any: true);
|
|
}
|
|
}
|
|
}
|