Add output of disc key and sector CMI info from media info command

This commit is contained in:
Rebecca Wallander
2021-01-14 18:42:28 +01:00
parent 9390e1761b
commit 89bbbbc712
3 changed files with 38 additions and 11 deletions

View File

@@ -45,10 +45,12 @@ using Aaru.Decoders.SCSI;
using Aaru.Decoders.SCSI.MMC; using Aaru.Decoders.SCSI.MMC;
using Aaru.Decoders.SCSI.SSC; using Aaru.Decoders.SCSI.SSC;
using Aaru.Decoders.Xbox; using Aaru.Decoders.Xbox;
using Aaru.Decryption.DVD;
using Aaru.Devices; using Aaru.Devices;
using DeviceInfo = Aaru.Core.Devices.Info.DeviceInfo; using DeviceInfo = Aaru.Core.Devices.Info.DeviceInfo;
using DMI = Aaru.Decoders.Xbox.DMI; using DMI = Aaru.Decoders.Xbox.DMI;
using Inquiry = Aaru.CommonTypes.Structs.Devices.SCSI.Inquiry; using Inquiry = Aaru.CommonTypes.Structs.Devices.SCSI.Inquiry;
using DVDDecryption = Aaru.Decryption.DVD.Dump;
namespace Aaru.Core.Media.Info namespace Aaru.Core.Media.Info
{ {
@@ -712,18 +714,33 @@ namespace Aaru.Core.Media.Info
#endregion DVD-R and HD DVD-R #endregion DVD-R and HD DVD-R
} }
var dvdDecrypt = new Dump(dev);
sense = dvdDecrypt.ReadBusKey(out cmdBuf, out senseBuf, CopyrightType.CSS, dev.Timeout, out _);
if(!sense)
{
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.DiscKey, dvdDecrypt.Agid, dev.Timeout, out _);
if(sense)
AaruConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Disc Key\n{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
DvdDiscKey = cmdBuf;
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.SectorCopyrightInformation, dvdDecrypt.Agid,
dev.Timeout, out _);
if(sense)
AaruConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Sector CMI\n{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
DvdSectorCmi = cmdBuf;
}
#region Require drive authentication, won't work #region Require drive authentication, won't work
/* /*
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DiscKey, 0, dev.Timeout, out _);
if(sense)
AaruConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Disc Key\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_disckey.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.SectorCopyrightInformation, 0, dev.Timeout, out _);
if(sense)
AaruConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Sector CMI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_sectorcmi.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.MediaIdentifier, 0, dev.Timeout, out _); sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.MediaIdentifier, 0, dev.Timeout, out _);
if(sense) if(sense)
AaruConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Media ID\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); AaruConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Media ID\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
@@ -1514,5 +1531,7 @@ namespace Aaru.Core.Media.Info
public DensitySupport.DensitySupportHeader? DensitySupportHeader { get; } public DensitySupport.DensitySupportHeader? DensitySupportHeader { get; }
public byte[] MediaTypeSupport { get; } public byte[] MediaTypeSupport { get; }
public DensitySupport.MediaTypeSupportHeader? MediaTypeSupportHeader { get; } public DensitySupport.MediaTypeSupportHeader? MediaTypeSupportHeader { get; }
public byte[] DvdSectorCmi { get; }
public byte[] DvdDiscKey { get; }
} }
} }

View File

@@ -810,7 +810,7 @@ namespace Aaru.Gui.ViewModels.Windows
Persistent, StopOnError, _resume, dumpLog, encoding, _outputPrefix, Destination, Persistent, StopOnError, _resume, dumpLog, encoding, _outputPrefix, Destination,
parsedOptions, _sidecar, (uint)Skipped, ExistingMetadata == false, Trim == false, parsedOptions, _sidecar, (uint)Skipped, ExistingMetadata == false, Trim == false,
Track1Pregap, true, false, DumpSubchannel.Any, 0, false, false, false, false, false, Track1Pregap, true, false, DumpSubchannel.Any, 0, false, false, false, false, false,
true, errorLog, false, 64, true); true, errorLog, false, 64, true, false, true, false);
new Thread(DoWork).Start(); new Thread(DoWork).Start();
} }

View File

@@ -296,6 +296,14 @@ namespace Aaru.Commands.Media
AaruConsole.WriteLine("Lead-In CMI:\n{0}", CSS_CPRM.PrettifyLeadInCopyright(scsiInfo.DvdCmi)); AaruConsole.WriteLine("Lead-In CMI:\n{0}", CSS_CPRM.PrettifyLeadInCopyright(scsiInfo.DvdCmi));
} }
if(scsiInfo.DvdDiscKey != null)
DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_disckey.bin",
"SCSI READ DISC STRUCTURE", scsiInfo.DvdDiscKey);
if(scsiInfo.DvdSectorCmi != null)
DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_sectorcmi.bin",
"SCSI READ DISC STRUCTURE", scsiInfo.DvdSectorCmi);
if(scsiInfo.DvdBca != null) if(scsiInfo.DvdBca != null)
DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_bca.bin", DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_bca.bin",
"SCSI READ DISC STRUCTURE", scsiInfo.DvdBca); "SCSI READ DISC STRUCTURE", scsiInfo.DvdBca);