Skip to content

Instantly share code, notes, and snippets.

@W4nn4Die
Created August 7, 2020 20:55
Show Gist options
  • Select an option

  • Save W4nn4Die/36c9b5b82dfcb2b45e593a0e86cea492 to your computer and use it in GitHub Desktop.

Select an option

Save W4nn4Die/36c9b5b82dfcb2b45e593a0e86cea492 to your computer and use it in GitHub Desktop.
This small code in bash can convert your address into a valid address for BOF
#!/bin/bash
if [ $# -ne 1 ]; then
echo "Must enter one parameter"
exit 1
fi
if [ $(expr length $1) -ne 8 ]; then
echo "Length is not 8"
exit 2
fi
addr=$(echo $1 | sed 's|..|\\x&|g')
declare finalA=""
declare -i cont=5
while [ ${cont} -ne 1 ]; do
finalA+="\\"`echo ${addr} | cut -d'\\' -f${cont}`
let cont=${cont}-1
done
echo $finalA
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment