0.5.5 • Published 1 month ago

netmd-exploits v0.5.5

Weekly downloads
-
License
GPL-2.0
Repository
github
Last release
1 month ago

netmd-exploits

What is it?

netmd-exploits is a library aiming to store all the available exploits for Sony NetMD devices.

What exploits are available?

The exploits currently available are:

Exploit nameFirmware Versions* compatibleJavaScript class name
Firmware DumpingAll versions supportedFirmwareDumper
USB Code ExecutionS1.600, S1.500, S1.400, S1.300, S1.200, S1.100, S1.000, R1.400, R1.300, R1.200, R1.100, R1.000, Hr1.000, Hn1.000, Hn1.100, Hn1.10A, Hn1.200, Hx1.070, Hx1.090, Hx1.0A0USBCodeExecution
TetrisS1.600, S1.500, S1.400, S1.300, S1.200, S1.100, S1.000Tetris
Force TOC FlushingS1.600, S1.500, S1.400, S1.300, S1.200, S1.100, S1.000, R1.400, R1.300, R1.200, R1.100, R1.000ForcedTOCEdit
Upload SP MonoS1.600, S1.500, S1.400, S1.300, S1.200, S1.100, S1.000, R1.400, R1.300, R1.200, R1.100, R1.000MonoSPUpload
Atrac USB Control TransferS1.600, S1.500, S1.400, S1.300, S1.200, S1.100, S1.000, R1.400, R1.300, R1.200, R1.100, R1.000CachedSectorControlDownload
Atrac USB No-RAM TransferS1.600, S1.500, S1.400, S1.300, S1.200, S1.100, S1.000, R1.400, R1.300, R1.200, R1.100, R1.000CachedSectorNoRAMDownload
Atrac USB Bulk TransferS1.600, S1.500, S1.400, S1.300, S1.200, S1.100, S1.000, Hr1.000, Hn1.000, Hn1.100, Hn1.10A, Hn1.200CachedSectorBulkDownload
SP Faster UploadS1.600, S1.500, S1.400, S1.300, S1.200, S1.100, S1.000PCMFasterUpload
ATRAC1 UploadS1.600, S1.500, S1.400, S1.300, S1.200, S1.100, S1.000SPUpload
EEprom Write LockS1.600, S1.500, S1.400, S1.300, S1.200, S1.100, S1.000, R1.400, R1.300, R1.200, R1.100, R1.000KillEepromWrite
Disc Spinning Notifier**S1.600, S1.500, S1.400, S1.300, S1.200, S1.100, S1.000, R, Hr, Hn*WaitForDiscToStopSpinning
Unbounded memory accessHr1.000, Hn1.000, Hn1.100, Hn1.10A, Hn1.200HiMDUnboundedReading
HiMD USB Class OverrideHr1.000, Hn1.000, Hn1.100, Hn1.10A, Hn1.200, Hx1.070, Hx1.090, Hx1.0A0HiMDUSBClassOverride

*The firmware versions listed here consist of the SOC type letter:

  • R - CXD2677 (Type R)
  • S - CXD2678 / CXD2680 (Type S)
  • Hn - CXD2681 (gen1)
  • Hr - CXD2681 (gen2)
  • Hx - CXD2687

And the actual firmware version reported by the device.

**WaitForDiscToStopSpinning only supports Type-S devices, on Type-R and HiMD it always waits 10 seconds.

Examples

UnitSoCFirmware versionnetmd-exploits firmware version
Sony MZ-N510CXD26801.600S1.600
Sony MZ-N710CXD26801.600S1.600
Sony MZ-N1CXD26771.200R1.200
Sony MZ-N10CXD26781.200S1.300
Sony MZ-RH10CXD2681 (gen2)1.000Hr1.000
Sony MZ-NH600CXD2681 (gen1)1.000Hn1.000
Sony MZ-RH1CXD26871.0A0Hx1.0A0

Hacking

If you would like to help with adding compatibility for your device, pull requests are welcome.

An exploit's structure

The library keeps track of what exploits are compatible with what versions with the help of src/compatibility.ts. Every exploit class has to inherit the Exploit abstract class. It provides multiple functions which make it easier to load the correct versions of exploits for every firmware version. The constants that depend on the firmware version are stored in a VersionStore map returned from getPropertyStore(), from which it's possible to get values by calling getProperty, or by referencing their names in assembly code, prefixed with a '$'. Every exploit class has to also define a static _name const, used for compatibility checking.

Loading and unloading exploits

Once an exploit is loaded using ExploitStateManager.require or ExploitStateManager.envelop, the exploit's init() method is called. Because of how exploits are loaded, exploits shouldn't have their own constructor. Instead, init() should be used as an asynchronous constructor.

To unload an exploit you can use ExploitStateManager.unload. When using ExploitStateManager.envelop, this action will be done automatically.

When an exploit is unloaded, its unload() method is called, where the exploit can perform cleanup. All behavior-modifying exploits should have a valid unload() method defined, in order to automatically restore the device to the default state. If an exploit is using patches, the unload() method should clear the patches from the device, and then call this.stateManager.freePatch(), to mark the patch as unused. All the patches for which ExploitStateManager.freePatch() wasn't called will automatically be unloaded from the device by the state manager.

If a patch is loaded by ExploitStateManager.require, and then reloaded again using ExploitStateManager.envelop, it will not be unloaded after returning from envelop(). To unload it, ExploitStateManager.unload has to be called.

The inbuilt assembler

The assembler has full support for macros (prefixed with '@'), VersionStore constants (prefixed with '$'), as well as variables, passed to the assemble function (prefixed with '%').

The macros available for every assembly program are stored in src/assembler/core-macros.ts. Exploits can define private macros in the _macros property of the VersionStore returned from getPropertyStore().

Happy hacking!

Example

Below is an extremely basic example, which when run will download the first track from the disc onto the computer using the best suited exploit for it:

import { DevicesIds, openNewDevice } from 'netmd-js'
import { AtracRecovery, getBestSuited, ExploitStateManager } from 'netmd-exploits';
import { WebUSB } from 'usb';
import fs from 'fs';

(async() => {
    const usb = new WebUSB({ allowedDevices: DevicesIds, deviceTimeout: 1000000 });
    const dev = await openNewDevice(usb);
    const stateManager = await ExploitStateManager.create(dev!);

    const exploit = await stateManager.require(getBestSuited(AtracRecovery));
    fs.writeFileSync(await exploit.downloadTrack(0, console.log));
    await stateManager.unload(getBestSuited(AtracRecovery));

    process.exit(0);
})();

Credits

The assembler built into netmd-exploits is a modified version of keystone-js by AlexAltea

0.5.5

1 month ago

0.5.4

8 months ago

0.5.3

10 months ago

0.5.2

11 months ago

0.5.1

11 months ago

0.4.3

2 years ago

0.4.2

2 years ago

0.3.0

2 years ago

0.2.1

2 years ago

0.4.1

2 years ago

0.4.0

2 years ago

0.1.13

2 years ago

0.1.12

2 years ago

0.1.11

2 years ago

0.1.10

2 years ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago