Skip to content

Instantly share code, notes, and snippets.

@tanaka-geek
Created February 24, 2021 19:47
Show Gist options
  • Save tanaka-geek/7d374ff976884f3c1e2aa9431fe7fb1e to your computer and use it in GitHub Desktop.
Save tanaka-geek/7d374ff976884f3c1e2aa9431fe7fb1e to your computer and use it in GitHub Desktop.
This is for 32bits based offset detection with msf-pattern_offset -q ""
#!/bin/bash
if [ $# -eq 0 ]
then
echo "No arguments supplied"
exit 1
fi
w=$1
if [ ${#w} != '8' ]; then
echo "it must be 8 bytes length like 0001020304"
exit 1
fi
conv=$(printf "$1" | xxd -r -p)
f=${conv: 0:2}
s=${conv: 2:4}
k1=$(echo -n $f | rev)
k2=$(echo -n $s | rev)
word=$(printf "$k2$k1")
msf-pattern_offset -q "$word"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment