Add support for PlayJ (#155)

* Add support for PlayJ

* Add support for detecting PlayJ format audio files and PlayJ Music Player related files.
* Add an incomplete summary for Cactus Data Shield.
* Improve Cactus Data Shield Detection for CDS-200 (PlayJ).

* Address PlayJ PR comments

Fix whitespace and improve safety of PlayJ header check.

* Address further PlayJ PR comments

Reduce redundancy and further improve safety.
This commit is contained in:
TheRogueArchivist
2022-10-11 22:00:30 -06:00
committed by GitHub
parent 137f7fcc01
commit 4e2c5313f3
5 changed files with 212 additions and 6 deletions

View File

@@ -0,0 +1,57 @@
using System;
using System.Collections.Concurrent;
using System.IO;
using System.Linq;
using BurnOutSharp.Interfaces;
using BurnOutSharp.Tools;
namespace BurnOutSharp.FileType
{
public class PLJ : IScannable
{
/// <inheritdoc/>
public bool ShouldScan(byte[] magic)
{
// https://www.iana.org/assignments/media-types/audio/vnd.everad.plj
if (magic.StartsWith(new byte?[] { 0xFF, 0x9D, 0x53, 0x4B }))
return true;
return false;
}
/// <inheritdoc/>
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, string file)
{
if (!File.Exists(file))
return null;
using (var fs = File.OpenRead(file))
{
return Scan(scanner, fs, file);
}
}
/// <inheritdoc/>
public ConcurrentDictionary<string, ConcurrentQueue<string>> Scan(Scanner scanner, Stream stream, string file)
{
var protections = new ConcurrentDictionary<string, ConcurrentQueue<string>>();
try
{
byte[] magic = new byte[16];
stream.Read(magic, 0, 16);
if (ShouldScan(magic))
{
Utilities.AppendToDictionary(protections, file, "PlayJ Audio File");
return protections;
}
}
catch (Exception ex)
{
if (scanner.IncludeDebug) Console.WriteLine(ex);
}
return null;
}
}
}

View File

@@ -10,6 +10,23 @@ using BurnOutSharp.Matching;
namespace BurnOutSharp.ProtectionType
{
/// <summary>
/// CactusDataShield was a copy protection originally developed by Midbar Technologies, which was then purchased by Macrovision in 2002 (https://variety.com/2002/digital/news/macrovision-acquires-midbar-cuts-ttr-link-1117875824/).
/// CDS-100 appears to function by attempting to prevent dumping/ripping the discs protected with it.
/// CDS-200+ uses a dedicated audio player to play the music "legitimately".
/// Patent relating to CDS-100: https://patents.google.com/patent/US6425098B1/
/// Known CDS versions:
/// CDS-100 ("The Loveparade Compilation 2001" by various artists (Barcode 74321 86986 2) (Likely Discogs Release Code [r155963]) and "World Of Our Own" (Limited Edition) by Westlife (Barcode 7 43218 98572 0) (Discogs Release Code [r1357706])).
/// CDS-200 (PlayJ) (("Volumia!" by Puur (Barcode 7 43218 63282 2) (Discogs Release Code [r795427])) (Confirmed to be CDS-200 from https://www.cdrinfo.com/d7/content/cactus-data-shield-200?page=2).
/// CDS200.0.4 - 3.0 build 16a (Redump entry 95036)
/// CDS200.0.4 - 3.0 build 16c ("TMF Hitzone 20" by various artists (Barcode 7 31458 37062 8)).
/// CDS200.0.4 - 4.1 build 2a ("Ich Habe Einen Traum" by Uwe Busse (Barcode 9 002723 251203)).
/// CDS200.0.4 - 4.1 build 2e ("Hallucinations" by David Usher (Barcode 7 24359 30322 2)).
/// CDS-300
/// Further information:
/// https://www.cdrinfo.com/d7/content/cactus-data-shield-200
/// https://www.cdmediaworld.com/hardware/cdrom/cd_protections_cactus_data_shield.shtml
/// </summary>
public class CactusDataShield : IContentCheck, IPathCheck, IPortableExecutableCheck
{
/// <inheritdoc/>
@@ -60,6 +77,23 @@ namespace BurnOutSharp.ProtectionType
return match;
}
// Get the .rsrc section, if it exists
var rsrcSectionRaw = pex.ReadRawSection(".rsrc", first: false);
if (rsrcSectionRaw != null)
{
var matchers = new List<ContentMatchSet>
{
// CactusPJ
// Found in "Volumia!" by Puur (Barcode 7 43218 63282 2) (Discogs Release Code [r795427]).
// Modified version of the PlayJ Music Player specificaly for CDS, as indicated by the About page present when running the executable.
new ContentMatchSet(new byte?[] { 0x43, 0x61, 0x63, 0x74, 0x75, 0x73, 0x50, 0x4A }, "PlayJ Music Player (Cactus Data Shield)"),
};
string match = MatchUtil.GetFirstMatch(file, rsrcSectionRaw, matchers, includeDebug);
if (!string.IsNullOrWhiteSpace(match))
return match;
}
return null;
}
@@ -69,10 +103,19 @@ namespace BurnOutSharp.ProtectionType
// TODO: Verify if these are OR or AND
var matchers = new List<PathMatchSet>
{
new PathMatchSet(new PathMatch("CACTUSPJ.exe", useEndsWith: true), GetVersion, "Cactus Data Shield"),
new PathMatchSet(new PathMatch("CDSPlayer.app", useEndsWith: true), GetVersion, "Cactus Data Shield"),
new PathMatchSet(new PathMatch("PJSTREAM.DLL", useEndsWith: true), GetVersion, "Cactus Data Shield"),
new PathMatchSet(new PathMatch("wmmp.exe", useEndsWith: true), GetVersion, "Cactus Data Shield"),
// Found in "Volumia!" by Puur (Barcode 7 43218 63282 2) (Discogs Release Code [r795427]).
// Modified version of the PlayJ Music Player specificaly for CDS, as indicated by the About page present when running the executable.
// The file "DATA16.BML" is also present on this disc but the name is too generic to check for.
new PathMatchSet(new PathMatch("CACTUSPJ.exe", useEndsWith: true), "PlayJ Music Player (Cactus Data Shield)"),
// Found in "Volumia!" by Puur (Barcode 7 43218 63282 2) (Discogs Release Code [r795427]).
// In "Volumina! - Puur" (7 43218 63282 2), this file is composed of multiple PLJ files combined together.
// In later versions, this file is a padded dummy file. ("Ich Habe Einen Traum" by Uwe Busse (Barcode 9 002723 251203)).
new PathMatchSet(new PathMatch("YUCCA.CDS", useEndsWith: true), "Cactus Data Shield"),
// TODO: Find samples of the following:
new PathMatchSet(new PathMatch("CDSPlayer.app", useEndsWith: true), "Cactus Data Shield"),
new PathMatchSet(new PathMatch("wmmp.exe", useEndsWith: true), "Cactus Data Shield"),
// Present on CDS-300, as well as SafeDisc. This is likely due to both protections being created by Macrovision.
new PathMatchSet(new PathMatch("00000001.TMP", useEndsWith: true), Get00000001TMPVersion, "Cactus Data Shield 300 (Confirm presence of other CDS-300 files)"),
@@ -86,9 +129,18 @@ namespace BurnOutSharp.ProtectionType
{
var matchers = new List<PathMatchSet>
{
new PathMatchSet(new PathMatch("CACTUSPJ.exe", useEndsWith: true), "Cactus Data Shield 200"),
// Found in "Volumia!" by Puur (Barcode 7 43218 63282 2) (Discogs Release Code [r795427]).
// Modified version of the PlayJ Music Player specificaly for CDS, as indicated by the About page present when running the executable.
// The file "DATA16.BML" is also present on this disc but the name is too generic to check for.
new PathMatchSet(new PathMatch("CACTUSPJ.exe", useEndsWith: true), "PlayJ Music Player (Cactus Data Shield)"),
// Found in "Volumia!" by Puur (Barcode 7 43218 63282 2) (Discogs Release Code [r795427]),
// In "Volumia! - Puur", this file is composed of multiple PLJ files combined together.
// In later versions, this file is a padded dummy file. ("Ich Habe Einen Traum" by Uwe Busse (Barcode 9 002723 251203)).
new PathMatchSet(new PathMatch("YUCCA.CDS", useEndsWith: true), "Cactus Data Shield"),
// TODO: Find samples of the following:
new PathMatchSet(new PathMatch("CDSPlayer.app", useEndsWith: true), "Cactus Data Shield 200"),
new PathMatchSet(new PathMatch("PJSTREAM.DLL", useEndsWith: true), "Cactus Data Shield 200"),
new PathMatchSet(new PathMatch("wmmp.exe", useEndsWith: true), "Cactus Data Shield 200"),
// Present on CDS-300, as well as SafeDisc. This is likely due to both protections being created by Macrovision.

View File

@@ -0,0 +1,89 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using BurnOutSharp.ExecutableType.Microsoft.PE;
using BurnOutSharp.Interfaces;
using BurnOutSharp.Matching;
namespace BurnOutSharp.ProtectionType
{
/// <summary>
/// PlayJ (https://web.archive.org/web/20000815053956/http://www.playj.com/) by EverAd was a form of DRM protected audio that was intended to be distributed freely, but that showed advertisements to the listener.
/// This format didn't live for very long, having started in the February of 2000 (https://web.archive.org/web/20000301013405/http://www.playj.com/digital_music.htm) and ending with the parent company shutting down in 2001 (https://www.thestreet.com/technology/everad-closes-down-after-having-raised-345m-in-past-two-years-1505964).
/// The file format itself appears to be an encrypted MP3 (https://www.wired.com/2000/03/ads-take-aim-at-online-music/).
/// The IANA assignment for the PlayJ format: https://www.iana.org/assignments/media-types/audio/vnd.everad.plj
/// The official player has been archived and can still be used to listen to the music (https://web.archive.org/web/20010417025347/http://dlp.playj.com:80/playj/PlayJIns266.exe).
/// The music files themselves do not contain advertisements, which is instead handled on the side of the music players and plugins capable of playing the format.
/// According to the ReadMe.txt found in https://web.archive.org/web/20010417025347/http://dlp.playj.com:80/playj/PlayJIns266.exe, there's 2 distinct versions of the format. The differences between versions are currently unknown.
/// There are a few sources of PlayJ music archived online, these being a few examples:
/// https://web.archive.org/web/*/http://dlp.playj.com/*/
/// https://web.archive.org/web/*/http://brightnet.music.tucows.com/*/
/// Also noted in the ReadMe.txt present in https://web.archive.org/web/20010417025347/http://dlp.playj.com:80/playj/PlayJIns266.exe as hosting PlayJ music:
/// http://www.listen.com
/// http://www.launch.com
/// Further information and resources:
/// https://www.entrepreneur.com/business-news/sales-marketing-playing-around/33284
/// https://www.adweek.com/brand-marketing/j-records-and-everad-ink-pact-47882/
/// https://adage.com/article/news/everad-s-playj-partners-clive-davis-j-records/11043
/// https://www.nytimes.com/2000/07/07/technology/search-for-digital-music-revenue-takes-new-direction.html
/// </summary>
public class PlayJ : IPathCheck, IPortableExecutableCheck
{
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;
// Found in "PlayJ.exe" (https://web.archive.org/web/20010417025347/http://dlp.playj.com:80/playj/PlayJIns266.exe) and "CACTUSPJ.exe" ("Volumia!" by Puur (Barcode 7 43218 63282 2) (Discogs Release Code [r795427])).
string name = pex.FileDescription;
if (!string.IsNullOrWhiteSpace(name) && name.StartsWith("PlayJ Music Player", StringComparison.OrdinalIgnoreCase))
return $"PlayJ Music Player";
// Found in "PJSTREAM.DLL" ("Volumia!" by Puur (Barcode 7 43218 63282 2) (Discogs Release Code [r795427])).
name = pex.FileDescription;
if (!string.IsNullOrWhiteSpace(name) && name.StartsWith("EVAUX32 Module", StringComparison.OrdinalIgnoreCase))
return $"PlayJ Music Player Component";
// Found in "PlayJ.exe" (https://web.archive.org/web/20010417025347/http://dlp.playj.com:80/playj/PlayJIns266.exe) and "CACTUSPJ.exe" ("Volumia!" by Puur (Barcode 7 43218 63282 2) (Discogs Release Code [r795427])).
name = pex.ProductName;
if (!string.IsNullOrWhiteSpace(name) && name.StartsWith("PlayJ", StringComparison.OrdinalIgnoreCase))
return $"PlayJ";
return null;
}
/// <inheritdoc/>
public ConcurrentQueue<string> CheckDirectoryPath(string path, IEnumerable<string> files)
{
var matchers = new List<PathMatchSet>
{
// Found in https://web.archive.org/web/20010417025347/http://dlp.playj.com:80/playj/PlayJIns266.exe.
// The files "Data8.bml" and "Data16.bml" are also present in the installation directory, but it is currently unknown if they are specific to this DRM or not.
new PathMatchSet(new PathMatch("PlayJ.exe", useEndsWith: true), "PlayJ Music Player"),
new PathMatchSet(new PathMatch("PLJFilter.ax", useEndsWith: true), "PlayJ Windows Media Player Plug-in"),
// Found in "Volumia!" by Puur (Barcode 7 43218 63282 2) (Discogs Release Code [r795427]).
new PathMatchSet(new PathMatch("PJSTREAM.DLL", useEndsWith: true), "PlayJ Music Player Component"),
};
return MatchUtil.GetAllMatches(files, matchers, any: false);
}
/// <inheritdoc/>
public string CheckFilePath(string path)
{
var matchers = new List<PathMatchSet>
{
// Found in https://web.archive.org/web/20010417025347/http://dlp.playj.com:80/playj/PlayJIns266.exe.
// The files "Data8.bml" and "Data16.bml" are also present in the installation directory, but it is currently unknown if they are specific to this DRM or not.
new PathMatchSet(new PathMatch("PlayJ.exe", useEndsWith: true), "PlayJ Music Player"),
new PathMatchSet(new PathMatch("PLJFilter.ax", useEndsWith: true), "PlayJ Windows Media Player Plug-in"),
// Found in "Volumia!" by Puur (Barcode 7 43218 63282 2) (Discogs Release Code [r795427]).
new PathMatchSet(new PathMatch("PJSTREAM.DLL", useEndsWith: true), "PlayJ Music Player Component"),
};
return MatchUtil.GetFirstMatch(path, matchers, any: true);
}
}
}

View File

@@ -314,6 +314,13 @@ namespace BurnOutSharp
Utilities.AppendToDictionary(protections, subProtections);
}
// PLJ
if (new PLJ().ShouldScan(magic))
{
var subProtections = new PLJ().Scan(this, stream, fileName);
Utilities.AppendToDictionary(protections, subProtections);
}
// Text-based files
if (new Textfile().ShouldScan(magic, extension))
{

View File

@@ -70,6 +70,7 @@ Below is a list of protections detected by BurnOutSharp. The two columns explain
| OpenMG | True | True | |
| Origin | True | True | |
| phenoProtect | False | False | Text file check only |
| PlayJ | True | True | |
| ProtectDISC / VOB ProtectCD/DVD | True | False | |
| Protect DVD-Video | False | True | Unconfirmed¹ |
| PlayStation Anti-modchip | True | False | En/Jp, not "Red Hand"; PSX executables only |