Skip to content

Instantly share code, notes, and snippets.

@wincentbalin
Created January 13, 2017 23:47
Show Gist options
  • Save wincentbalin/8b87080e7549196b9c0cf0396819394f to your computer and use it in GitHub Desktop.
Save wincentbalin/8b87080e7549196b9c0cf0396819394f to your computer and use it in GitHub Desktop.
Look at the data at different offsets of a file
#!/bin/sh
#
# Rip files from the specified file using dd and file
#
# Copyright (C) 2017 Wincent Balin
# Check for supplied filename
if [ -z "$1" ]
then
echo Usage: ripper.sh file_to_rip
exit 1
fi
# Rip the file
SIZE=`stat -L -c '%s' "$1"`
for i in `seq 0 $SIZE`
do
TYPE=`dd if="$1" skip=$i bs=1M iflag=skip_bytes | file -b -`
if [ "$TYPE" != "data" ]
then
echo At $i: $TYPE
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment