Created
January 13, 2017 23:47
-
-
Save wincentbalin/8b87080e7549196b9c0cf0396819394f to your computer and use it in GitHub Desktop.
Look at the data at different offsets of a file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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