Skip to content

Latest commit

 

History

History
70 lines (45 loc) · 3.12 KB

README.md

File metadata and controls

70 lines (45 loc) · 3.12 KB

DiskRead

What is DiskRead?

DiskRead is a program that allows you to read raw chunks of a disk or a file. It aims to replace xxd or hexdump present on Linux, but for Windows. Furthermore, the low level WinAPI functions enable DiskRead to DiskRead access any file, including boot sectors and disks.

Usage

diskread <drive | file> [-b <bytes per line>] [-e <export file>] [-h] [-o <offset>] [-s <read size>] [-u] [-x] [-y]

Switches

-b, --bytes <bytecount>
Change the number of bytes per line displayed

-e, --export <file>
Export to a file

-h, --hideoffset
Hide the offset display

-o, --offset <offset>
Set a custom starting offset for the file

-s, --size <read size>
Read a specific amount of bytes from the file. 512 bytes are read by default

-u, --uppercase
Display hexadecimal values in uppercase

-x, --hexadecimal
Only display the hexadecimal representation

-y, --yes
Do not prompt for confirmation when exporting to a device file

Examples

diskread \\.\PhysicalDrive0 -s 512 -o 0 -e bootsect.bak
Reads the first 512 bytes from physical drive 0 and writes them to bootsect.bak (a boot sector backup). The boot sector can be restored if needed using diskread bootsect.bak -s 512 -o 0 -e \\.\PhysicalDrive0.

Caution

Writing to a boot sector or MBR can cause serious data loss and may leave your computer unbootable if done incorrectly. Using the option -y to avoid the warning message when writing to a device is strongly discouraged outside of a script.

diskread file.txt -s 40 -o 10 -h
Prints 40 bytes from file.txt, starting to read at the 10th byte without displaying the offset.

diskread image.png -x -u -b 12
Prints only 512 bytes of image.png in uppercase hexadecimal, displaying 12 bytes per line.

Return code

The number of bytes read is returned on success, or a negative error value on failure.

Note

Due to Windows limitations, both disk reading and disk offset are performed in chunks of 512 bytes. Values will be rounded up to the nearest multiple of 512.

Why use DiskRead?

DiskRead is a tiny and fast program, yet powerful, portable, and easy to use. It's the perfect tool for backing up the boot sector, viewing the raw data of files and disks, or using it as a hexadecimal dumping tool for Windows, ranging from the old Windows XP to the latest version, Windows 11.

Contributing

If you found a bug or want to add a new feature, don't hesitate to create a pull request or an issue! I would greatly appreciate your contributions.

Article

Here's an article written on Batch-Man by me explaining more in-depth an older version of DiskRead.

Copyright © 2024 anic17 Software