Skip to content

Instantly share code, notes, and snippets.

@gitnepal
Created Dec 23, 2018
Embed
What would you like to do?
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