Files
BinaryObjectScanner/BurnOutSharp/ProtectionType/Uplay.cs

85 lines
4.7 KiB
C#
Raw Normal View History

using System.Collections.Concurrent;
using System.Collections.Generic;
2022-03-14 14:56:41 -07:00
using BurnOutSharp.ExecutableType.Microsoft.PE;
2022-05-01 17:41:50 -07:00
using BurnOutSharp.Interfaces;
using BurnOutSharp.Matching;
namespace BurnOutSharp.ProtectionType
{
2022-03-14 14:56:41 -07:00
// Got renamed to Ubisoft Connect / Ubisoft Game Launcher
2022-05-01 17:23:00 -07:00
public class Uplay : IPathCheck, IPortableExecutableCheck
{
2022-03-14 14:56:41 -07:00
/// <inheritdoc/>
2022-05-01 17:17:15 -07:00
public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug)
2022-03-14 14:56:41 -07:00
{
// Get the sections from the executable, if possible
var sections = pex?.SectionTable;
if (sections == null)
return null;
2022-04-02 16:12:23 -07:00
string name = pex.FileDescription;
2022-03-14 14:56:41 -07:00
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";
2022-03-14 15:08:27 -07:00
else if (!string.IsNullOrEmpty(name) && name.Contains("Ubisoft Uplay Installer"))
return "Uplay / Ubisoft Connect";
2022-03-14 14:56:41 -07:00
else if (!string.IsNullOrEmpty(name) && name.Contains("Uplay launcher"))
return "Uplay / Ubisoft Connect";
2022-03-14 15:08:27 -07:00
// There's also a variant that looks like "Uplay <version> installer"
2022-04-02 16:12:23 -07:00
name = pex.ProductName;
2022-03-14 14:56:41 -07:00
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;
}
2021-02-26 00:32:09 -08:00
/// <inheritdoc/>
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string> files)
{
var matchers = new List<PathMatchSet>
{
2022-03-14 14:56:41 -07:00
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"),
};
2021-03-19 15:41:49 -07:00
return MatchUtil.GetAllMatches(files, matchers, any: true);
2021-03-19 15:41:49 -07:00
}
/// <inheritdoc/>
public string CheckFilePath(string path)
{
var matchers = new List<PathMatchSet>
{
2022-03-14 14:56:41 -07:00
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);
}
}
}