Skip to content

Instantly share code, notes, and snippets.

@gitnepal
Created December 23, 2018 10:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gitnepal/bb525637f3433239453b58de89e5fc23 to your computer and use it in GitHub Desktop.
Save gitnepal/bb525637f3433239453b58de89e5fc23 to your computer and use it in GitHub Desktop.
Encoding Strings to charcode | Bash scripts
#!/bin/bash
if [ -z "$1" ]; then
echo "Enter Text"
exit 1
fi
#Run script as
#./asciigen.sh texthere | awk {'print $6'} | tr "\n" " "
#Usage if you want numbers only
foo=$1
for (( i=0; i<${#foo}; i++ ));
do
bar=$(echo ${foo:$i:1})
raw=$(ascii $bar)
final=$(echo $raw | grep "prints" | awk {'print $5'} | tr -d ',' )
echo "ASCII value of $bar is $final"
done
#Encoding strings to charcode
#//rootnep.al /@__0x00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment