Skip to content

Instantly share code, notes, and snippets.

@pyllyukko
Last active September 9, 2020 13:43
Show Gist options
  • Save pyllyukko/389dc630c09644d58efec76a8b8783b7 to your computer and use it in GitHub Desktop.
Save pyllyukko/389dc630c09644d58efec76a8b8783b7 to your computer and use it in GitHub Desktop.
Patch
#!/bin/sh
if [ -z "${R2PIPE_IN}" ]; then
echo "r2 -wqi ${0} /path/to/binary"
exit 1
fi
R="r2p"
hit="$(${R} '/x 83f81e0f8417')"
if [ -z "${hit}" ]
then
${R} '?E Failed :(' 1>&2
hit="$(${R} '/x 83f81e909090909090')"
if [ -n "${hit}" ]
then
${R} '?e Looks like it has been patched already'
fi
exit 1
fi
${R} 's hit0_0+3'
${R} '?E Day of month == 30 before:'
${R} 'pd 1'
${R} 'wx 909090909090'
${R} '?e After:'
${R} 'pd 6'
hit="$(${R} '/x 83f802746283f818')"
if [ -z "${hit}" ]
then
${R} '?e Failed :(' 1>&2
exit 1
fi
${R} 's hit1_0+3'
${R} '?E Day of month == 2 before:'
${R} 'pd 1'
${R} 'wx eb'
${R} '?e After:'
${R} 'pd 1'
${R} 's +0x69'
${R} '?E Month != 7 before:'
${R} 'pd 1'
${R} 'wx 9090'
${R} '?e After:'
${R} 'pd 2'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment