Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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