Skip to content

Instantly share code, notes, and snippets.

@craSH
Created May 23, 2010 10:58
Show Gist options
  • Save craSH/410841 to your computer and use it in GitHub Desktop.
Save craSH/410841 to your computer and use it in GitHub Desktop.
Write out all possible encodings that strings can deal with for a given file.
#!/bin/sh
# Write out all possible encodings that strings can deal with for a given file.
input=$1
# 7 bit ascii
mode="s"
strings $@ -e $mode $input > strings_$input.$mode
# 8 bit characters
mode="S"
strings $@ -e $mode $input > strings_$input.$mode
# 16 bit big endian
mode="b"
strings $@ -e $mode $input > strings_$input.$mode
# 16 bit little endian
mode="l"
strings $@ -e $mode $input > strings_$input.$mode
# 32 bit big endian
mode="B"
strings $@ -e $mode $input > strings_$input.$mode
# 32 bit little endian
mode="L"
strings $@ -e $mode $input > strings_$input.$mode
ls -lh strings_$input.[sSbBlL]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment