Skip to content

Instantly share code, notes, and snippets.

@terremoth
Last active December 11, 2023 23:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save terremoth/117e375885c236d896d635718f34781c to your computer and use it in GitHub Desktop.
Save terremoth/117e375885c236d896d635718f34781c to your computer and use it in GitHub Desktop.
Simple DD like tool made in PHP, just change the disk you want to read and dump
<?php
echo "Disk size: ".disk_total_space("D:").PHP_EOL;
$disk = fopen('\\\\.\\D:', 'rb+'); //escaping the escape
$chunk_size = 4096;
while (!feof($disk)) {
$bin_data = fread($disk, 4096);
file_put_contents("dump.bin", $bin_data, FILE_APPEND);
}
fclose($disk);
echo PHP_EOL."100% completed. Done.";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment