Skip to content

Commit

Permalink
add gadget cache
Browse files Browse the repository at this point in the history
  • Loading branch information
rorymcnamara committed Jul 13, 2017
1 parent 6e94b8f commit 80b3dd3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,13 @@ getlibc() {
done
}

declare -A gadgetcache
findgadget() {
if [[ ${gadgetcache[${1}]+FOUND} ]]; then
# cache hit
gadgetaddr=${gadgetcache[${1}]}
else
# cache miss
getlibs | read -a LIBS

# eval splits up the LIBS as args
Expand Down Expand Up @@ -123,6 +129,8 @@ findgadget() {

findregion ${match[0]}
gadgetaddr=$(hexlify $(($((16#${BASE}))+${match[1]})))
gadgetcache[${1}]=${gadgetaddr}
fi #cache miss
}

relocatelibc() {
Expand Down

0 comments on commit 80b3dd3

Please sign in to comment.