Changes to disguise as image script

master
Jonathan Hodgson 5 years ago
parent 339ba9e889
commit 26023c5a4c
  1. 25
      bin/.bin/payload-generation/disguiseAsImage
  2. 5
      bin/.bin/payload-generation/templates/README.md
  3. BIN
      bin/.bin/payload-generation/templates/payload.gif
  4. BIN
      bin/.bin/payload-generation/templates/payload.jpg
  5. BIN
      bin/.bin/payload-generation/templates/payload.png

@ -8,8 +8,12 @@ CURRENT=$(pwd)
PAYLOAD="$1" PAYLOAD="$1"
IMAGETYPE="${2:-jpg}" IMAGETYPE="${2:-jpg}"
# Make sure the image type is lower case # Make sure the image type is lower case
IMAGETYPE=$(echo "$IMAGETYPE" | tr '[:upper:]' '[:lower:]') IMAGETYPE=$(echo "$IMAGETYPE" | tr '[:lower:]' '[:upper:]')
# Hex encoded versions of the magic bytes of images
MAGIC_GIF='47494638396140004000e7ff0002050101070a0d'
MAGIC_JPG='ffd8ffe000104a46494600010101012c012c0000'
MAGIC_PNG='89504e470d0a1a0a0000000d49484452000000400a'
# This function prints the usage # This function prints the usage
function printUsage(){ function printUsage(){
echo "Usage: $(basename "$0") PAYLOAD TYPE" echo "Usage: $(basename "$0") PAYLOAD TYPE"
@ -31,26 +35,19 @@ function getPayload(){
fi fi
} }
function getTemplate(){
local template="$SCRIPTPATH/templates/payload.$IMAGETYPE"
echo "$template"
if [ -f "$template" ]; then
exit 0
else
exit 1
fi
}
function getDestination(){ function getDestination(){
echo "$CURRENT/$PAYLOAD.$IMAGETYPE" local ext=$(echo "$IMAGETYPE" | tr '[:upper:]' '[:lower:]')
echo "$CURRENT/$PAYLOAD.$ext"
exit 0 exit 0
} }
if template=$(getTemplate); then eval template="\$MAGIC_$IMAGETYPE"
if [ -n "$template" ]; then
if payload=$(getPayload); then if payload=$(getPayload); then
# Do copy stuff # Do copy stuff
destination=$(getDestination) destination=$(getDestination)
cp "$template" "$destination" echo "$template" | xxd -r -p > "$destination"
cat "$payload" >> $destination cat "$payload" >> $destination
else else
"No such payload $payload" "No such payload $payload"

@ -1,5 +0,0 @@
# Image templates
These images are not real images. They take the first 20 bites of an example image of each type.
By adding code to these, you will be able to evade many upload filters that only allow images

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 B

Loading…
Cancel
Save