2020-09-10 21:10:32 -07:00
|
|
|
|
using System;
|
2021-07-18 09:44:23 -07:00
|
|
|
|
using System.Collections.Concurrent;
|
2020-09-10 21:10:32 -07:00
|
|
|
|
using System.IO;
|
|
|
|
|
|
using System.Text;
|
2022-05-01 17:41:50 -07:00
|
|
|
|
using BurnOutSharp.Interfaces;
|
2022-12-15 00:13:24 -08:00
|
|
|
|
using static BurnOutSharp.Utilities.Dictionary;
|
2020-09-10 21:10:32 -07:00
|
|
|
|
|
|
|
|
|
|
namespace BurnOutSharp.FileType
|
|
|
|
|
|
{
|
2022-12-08 21:32:52 -08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Various generic textfile formats
|
|
|
|
|
|
/// </summary>
|
2021-09-10 16:10:15 -07:00
|
|
|
|
public class Textfile : IScannable
|
2020-09-10 21:10:32 -07:00
|
|
|
|
{
|
2021-02-26 09:26:23 -08:00
|
|
|
|
/// <inheritdoc/>
|
2021-07-18 09:44:23 -07:00
|
|
|
|
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, string file)
|
2021-02-26 09:26:23 -08:00
|
|
|
|
{
|
|
|
|
|
|
if (!File.Exists(file))
|
|
|
|
|
|
return null;
|
|
|
|
|
|
|
2022-12-22 22:03:32 -08:00
|
|
|
|
using (var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
|
2021-02-26 09:26:23 -08:00
|
|
|
|
{
|
|
|
|
|
|
return Scan(scanner, fs, file);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
2021-07-18 09:44:23 -07:00
|
|
|
|
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, Stream stream, string file)
|
2020-09-10 21:10:32 -07:00
|
|
|
|
{
|
2021-02-26 09:26:23 -08:00
|
|
|
|
// Files can be protected in multiple ways
|
2021-07-18 09:44:23 -07:00
|
|
|
|
var protections = new ConcurrentDictionary<string, ConcurrentQueue<string>>();
|
2020-09-10 21:10:32 -07:00
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
// Load the current file content
|
|
|
|
|
|
string fileContent = null;
|
2020-11-03 14:57:23 -08:00
|
|
|
|
using (var sr = new StreamReader(stream, Encoding.Default, true, 1024 * 1024, true))
|
2020-09-10 21:10:32 -07:00
|
|
|
|
{
|
|
|
|
|
|
fileContent = sr.ReadToEnd();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-08-13 21:03:27 -06:00
|
|
|
|
// AegiSoft License Manager
|
|
|
|
|
|
// Found in "setup.ins" (Redump entry 73521/IA item "Nova_HoyleCasino99USA").
|
|
|
|
|
|
if (fileContent.Contains("Failed to load the AegiSoft License Manager install program."))
|
2022-12-15 00:13:24 -08:00
|
|
|
|
AppendToDictionary(protections, file, "AegiSoft License Manager");
|
2022-08-13 21:03:27 -06:00
|
|
|
|
|
2020-09-10 21:10:32 -07:00
|
|
|
|
// CD-Key
|
2020-11-03 14:41:05 -08:00
|
|
|
|
if (fileContent.Contains("a valid serial number is required"))
|
2022-12-15 00:13:24 -08:00
|
|
|
|
AppendToDictionary(protections, file, "CD-Key / Serial");
|
2020-11-03 14:41:05 -08:00
|
|
|
|
else if (fileContent.Contains("serial number is located"))
|
2022-12-15 00:13:24 -08:00
|
|
|
|
AppendToDictionary(protections, file, "CD-Key / Serial");
|
2023-02-07 08:00:04 -07:00
|
|
|
|
// Found in "Setup.Ins" ("Word Point 2002" in IA item "advantage-language-french-beginner-langmaster-2005").
|
|
|
|
|
|
else if (fileContent.Contains("Please enter a valid registration number"))
|
|
|
|
|
|
AppendToDictionary(protections, file, "CD-Key / Serial");
|
2022-11-06 22:30:59 -07:00
|
|
|
|
|
|
|
|
|
|
// Freelock
|
|
|
|
|
|
// Found in "FILE_ID.DIZ" distributed with Freelock.
|
|
|
|
|
|
if (fileContent.Contains("FREELOCK 1.0"))
|
2022-12-15 00:13:24 -08:00
|
|
|
|
AppendToDictionary(protections, file, "Freelock 1.0");
|
2022-11-06 22:30:59 -07:00
|
|
|
|
else if (fileContent.Contains("FREELOCK 1.2"))
|
2022-12-15 00:13:24 -08:00
|
|
|
|
AppendToDictionary(protections, file, "Freelock 1.2");
|
2022-11-06 22:30:59 -07:00
|
|
|
|
else if (fileContent.Contains("FREELOCK 1.2a"))
|
2022-12-15 00:13:24 -08:00
|
|
|
|
AppendToDictionary(protections, file, "Freelock 1.2a");
|
2022-11-06 22:30:59 -07:00
|
|
|
|
else if (fileContent.Contains("FREELOCK 1.3"))
|
2022-12-15 00:13:24 -08:00
|
|
|
|
AppendToDictionary(protections, file, "Freelock 1.3");
|
2022-11-06 22:30:59 -07:00
|
|
|
|
else if (fileContent.Contains("FREELOCK"))
|
2022-12-15 00:13:24 -08:00
|
|
|
|
AppendToDictionary(protections, file, "Freelock");
|
2020-11-03 14:41:05 -08:00
|
|
|
|
|
2022-07-27 14:06:52 -06:00
|
|
|
|
// MediaCloQ
|
|
|
|
|
|
if (fileContent.Contains("SunnComm MediaCloQ"))
|
2022-12-15 00:13:24 -08:00
|
|
|
|
AppendToDictionary(protections, file, "MediaCloQ");
|
2022-07-27 14:06:52 -06:00
|
|
|
|
else if (fileContent.Contains("http://download.mediacloq.com/"))
|
2022-12-15 00:13:24 -08:00
|
|
|
|
AppendToDictionary(protections, file, "MediaCloQ");
|
2022-07-27 14:06:52 -06:00
|
|
|
|
else if (fileContent.Contains("http://www.sunncomm.com/mediacloq/"))
|
2022-12-15 00:13:24 -08:00
|
|
|
|
AppendToDictionary(protections, file, "MediaCloQ");
|
2022-07-27 14:06:52 -06:00
|
|
|
|
|
2020-11-03 14:41:05 -08:00
|
|
|
|
// MediaMax
|
|
|
|
|
|
if (fileContent.Contains("MediaMax technology"))
|
2022-12-15 00:13:24 -08:00
|
|
|
|
AppendToDictionary(protections, file, "MediaMax CD-3");
|
2022-06-29 15:28:46 -06:00
|
|
|
|
else if (fileContent.Contains("exclusive Cd3 technology"))
|
2022-12-15 00:13:24 -08:00
|
|
|
|
AppendToDictionary(protections, file, "MediaMax CD-3");
|
2022-06-29 15:28:46 -06:00
|
|
|
|
else if (fileContent.Contains("<PROTECTION-VENDOR>MediaMAX</PROTECTION-VENDOR>"))
|
2022-12-15 00:13:24 -08:00
|
|
|
|
AppendToDictionary(protections, file, "MediaMax CD-3");
|
2022-06-29 15:28:46 -06:00
|
|
|
|
else if (fileContent.Contains("MediaMax(tm)"))
|
2022-12-15 00:13:24 -08:00
|
|
|
|
AppendToDictionary(protections, file, "MediaMax CD-3");
|
2021-07-01 21:51:40 -06:00
|
|
|
|
|
2022-06-16 23:13:02 -06:00
|
|
|
|
// phenoProtect
|
|
|
|
|
|
if (fileContent.Contains("phenoProtect"))
|
2022-12-15 00:13:24 -08:00
|
|
|
|
AppendToDictionary(protections, file, "phenoProtect");
|
2022-06-16 23:13:02 -06:00
|
|
|
|
|
2022-11-06 22:03:23 -07:00
|
|
|
|
// Rainbow Sentinel
|
|
|
|
|
|
// Found in "SENTW95.HLP" and "SENTINEL.HLP" in BA entry "Autodesk AutoCAD LT 98 (1998) (CD) [English] [Dutch]".
|
|
|
|
|
|
if (fileContent.Contains("Rainbow Sentinel Driver Help"))
|
2022-12-15 00:13:24 -08:00
|
|
|
|
AppendToDictionary(protections, file, "Rainbow Sentinel");
|
2022-11-06 22:03:23 -07:00
|
|
|
|
|
|
|
|
|
|
// Found in "OEMSETUP.INF" in BA entry "Autodesk AutoCAD LT 98 (1998) (CD) [English] [Dutch]".
|
|
|
|
|
|
if (fileContent.Contains("Sentinel Driver Disk"))
|
2022-12-15 00:13:24 -08:00
|
|
|
|
AppendToDictionary(protections, file, "Rainbow Sentinel");
|
2022-11-06 22:03:23 -07:00
|
|
|
|
|
2022-03-14 09:03:43 -07:00
|
|
|
|
// The full line from a sample is as follows:
|
|
|
|
|
|
//
|
|
|
|
|
|
// The files securom_v7_01.dat and securom_v7_01.bak have been created during the installation of a SecuROM protected application.
|
|
|
|
|
|
//
|
|
|
|
|
|
// TODO: Use the filenames in this line to get the version out of it
|
|
|
|
|
|
|
|
|
|
|
|
// SecuROM
|
|
|
|
|
|
if (fileContent.Contains("SecuROM protected application"))
|
2022-12-15 00:13:24 -08:00
|
|
|
|
AppendToDictionary(protections, file, "SecuROM");
|
2022-03-14 09:03:43 -07:00
|
|
|
|
|
2022-06-30 17:18:12 -06:00
|
|
|
|
// Steam
|
|
|
|
|
|
if (fileContent.Contains("All use of the Program is governed by the terms of the Steam Agreement as described below."))
|
2022-12-15 00:13:24 -08:00
|
|
|
|
AppendToDictionary(protections, file, "Steam");
|
2022-06-30 17:18:12 -06:00
|
|
|
|
|
2021-07-01 21:51:40 -06:00
|
|
|
|
// XCP
|
|
|
|
|
|
if (fileContent.Contains("http://cp.sonybmg.com/xcp/"))
|
2022-12-15 00:13:24 -08:00
|
|
|
|
AppendToDictionary(protections, file, "XCP");
|
2020-09-10 21:10:32 -07:00
|
|
|
|
}
|
2022-05-15 20:58:27 -07:00
|
|
|
|
catch (Exception ex)
|
2020-09-10 21:10:32 -07:00
|
|
|
|
{
|
2022-05-15 20:58:27 -07:00
|
|
|
|
if (scanner.IncludeDebug) Console.WriteLine(ex);
|
2020-09-10 21:10:32 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return protections;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|