Skip to content

Instantly share code, notes, and snippets.

@zachwalton
Created August 14, 2013 00:21
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 zachwalton/6226970 to your computer and use it in GitHub Desktop.
Save zachwalton/6226970 to your computer and use it in GitHub Desktop.
reads the stage-1 MBR bootloader to discover the location of the stage-2 bootloader. dumps the first 512 bytes of the secondary bootloader to the screen (filtered through hexdump -C)
dd if=/dev/sda \
of=/dev/stdout \
bs=512 \
skip=$( \
dc -e " 16i $( \
dd if=/dev/sda \
of=/dev/stdout \
bs=512 \
count=1 2> /dev/null \
| hexdump -C \
| awk '/^00000040/ {print $9,$8,$7,$6}' \
| tr -d ' ' \
| tr '[a-z]' '[A-Z]' \
) \
p") \
count=1 \
| hexdump -C
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment