Skip to content

Instantly share code, notes, and snippets.

@tpruzina
Created August 10, 2017 21:00
Show Gist options
  • Save tpruzina/d30eb213b15e57b8158c5cf0bb528c1c to your computer and use it in GitHub Desktop.
Save tpruzina/d30eb213b15e57b8158c5cf0bb528c1c to your computer and use it in GitHub Desktop.
Radare2 automatic session store (.zshrc function)
# automatically calculates md5 of binary path and saves it as a name for project file
function r2()
{
BACKUP="$@"
MD5=""
NAME=""
while [[ "$#" -gt 0 ]]; do
if [ -f "$1" ]; then
NAME=$(realpath $1)
MD5=$(echo $NAME | md5sum | awk '{print $1}')
#echo "MD5 $MD5"
#echo "NAME $NAME"
fi
shift
done
if [[ $MD5 == "" ]]; then
radare2 $BACKUP
else
#echo "executing radare2 -p $MD5 $BACKUP"
radare2 -p $MD5 ${ARG}
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment