Skip to content

Instantly share code, notes, and snippets.

@alseambusher
Last active August 29, 2015 14:05
Show Gist options
  • Save alseambusher/5e2d52280a849e38b5e5 to your computer and use it in GitHub Desktop.
Save alseambusher/5e2d52280a849e38b5e5 to your computer and use it in GitHub Desktop.
#!/bin/bash
while getopts "de:" OPTION
do
case $OPTION in
d)
# mailexe -d [original] [duplicate]
#decoding
base64 $2 > original
base64 $3 > duplicate
diff -ed original duplicate > diffed
tail -n +2 diffed | head -n -1 > exe.64
base64 -d exe.64 > output.exe
rm original duplicate diffed exe.64
echo "output.exe generated"
;;
e)
# mailexe -e [exe file] [image file]
#encoding
base64 $3 > temp
base64 $2 >> temp
base64 -d temp > image.png
rm temp
echo "image.png has the exe file embedded"
;;
esac
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment