Tuesday, December 11, 2012

Decode Hex to ASCII

#!/bin/bash

# Written: December 2012

# This program is built to decode hex to ASCII text
# The program takes what it is given at the command line and then decodes it...

testInput=$1

# echo $testInput -- If you echo it will read the string from the command line
# cat $testInput -- Takes the filename and decodes it
cat $testInput | sed 's/%20/ /g' | \
        sed 's/%21/!/g' | sed 's/%22/"/g' | sed 's/%23/#/g' | sed 's/%24/$/g' | \
        sed 's/%25/%/g' | sed 's/%26/&/g' | sed "s/%27/'/g" | sed 's/%28/(/g' | \
        sed 's/%29/)/g' | sed 's/%2a/*/g' | sed 's/%2b/+/g' | sed 's/%2c/,/g' | \
        sed 's/%2d/-/g' | sed 's/%2e/./g' | sed 's/%2f/\//g' | sed 's/%30/0/g' | \
        sed 's/%31/1/g' | sed 's/%32/2/g' | sed 's/%33/3/g' | sed 's/%34/4/g' | \
        sed 's/%35/5/g' | sed 's/%36/6/g' | sed 's/%37/7/g' | sed 's/%38/8/g' | \
        sed 's/%39/9/g' | sed 's/%3a/:/g' | sed 's/%3b/;/g' | sed 's/%3c/</g' | \
        sed 's/%3d/=/g' | sed 's/%3e/>/g' | sed 's/%3f/?/g' | sed 's/%40/@/g' | \
        sed 's/%41/A/g' | sed 's/%42/B/g' | sed 's/%43/C/g' | sed 's/%44/D/g' | \
        sed 's/%45/E/g' | sed 's/%46/F/g' | sed 's/%47/G/g' | sed 's/%48/H/g' | \
        sed 's/%49/I/g' | sed 's/%4a/J/g' | sed 's/%4b/K/g' | sed 's/%4c/L/g' | \
        sed 's/%4d/M/g' | sed 's/%4e/N/g' | sed 's/%4f/O/g' | sed 's/%50/P/g' | \
        sed 's/%51/Q/g' | sed 's/%52/R/g' | sed 's/%53/S/g' | sed 's/%54/T/g' | \
        sed 's/%55/U/g' | sed 's/%56/V/g' | sed 's/%57/W/g' | sed 's/%58/X/g' | \
        sed 's/%59/Y/g' | sed 's/%5a/Z/g' | sed 's/%5b/[/g' | sed 's/%5c/\\/g' | \
        sed 's/%5d/]/g' | sed 's/%5e/^/g' | sed 's/%5f/_/g' | sed 's/%60/`/g' | \
        sed 's/%61/a/g' | sed 's/%62/b/g' | sed 's/%63/c/g' | sed 's/%64/d/g' | \
        sed 's/%65/e/g' | sed 's/%66/f/g' | sed 's/%67/g/g' | sed 's/%68/h/g' | \
        sed 's/%69/i/g' | sed 's/%6a/j/g' | sed 's/%6b/k/g' | sed 's/%6c/l/g' | \
        sed 's/%6d/m/g' | sed 's/%6e/n/g' | sed 's/%6f/o/g' | sed 's/%70/p/g' | \
        sed 's/%71/q/g' | sed 's/%72/r/g' | sed 's/%73/s/g' | sed 's/%74/t/g' | \
        sed 's/%75/u/g' | sed 's/%76/v/g' | sed 's/%77/w/g' | sed 's/%78/x/g' | \
        sed 's/%79/y/g' | sed 's/%7a/z/g' | sed 's/%7b/{/g' | sed 's/%7c/|/g' | \
        sed 's/%7d/}/g' | sed 's/%7e/~/g' | sed 's/%0a/\n/g'

No comments:

Post a Comment

Test Authentication from Linux Console using python3 pexpect

Working with the IT420 lab, you will discover that we need to discover a vulnerable user account.  The following python3 script uses the pex...