summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorJari Vetoniemi <mailroxas@gmail.com>2018-10-21 19:48:24 +0300
committerJari Vetoniemi <mailroxas@gmail.com>2018-10-21 19:48:24 +0300
commit840d92358e311b405475ba7488ec55cc3f4f5fae (patch)
treece7246e8dede9372860b49daf47c6fa7abd0566c /contrib
parentf168742fd9c0453ba7270c365838da1d75eeb6c0 (diff)
Give binsearch ability to find all matches
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/brute-map.bash4
1 files changed, 2 insertions, 2 deletions
diff --git a/contrib/brute-map.bash b/contrib/brute-map.bash
index 4a5a811..a05e915 100755
--- a/contrib/brute-map.bash
+++ b/contrib/brute-map.bash
@@ -1,11 +1,11 @@
#!/bin/bash
-# usage: ./brute-map.bash pid file [window-size]
+# usage: ./brute-map.bash pid file [window-size] < regions
# Sometimes region offsets aren't available, but we know that some regions map a file
# Fix the region offsets by bruteforcing the offsets from a known file
while read -r region; do
offset=$(printf '%d' "0x$(awk '{print $3}' <<<"$region")")
if ((offset == 0)); then
- offset=$(binsearch <(ptrace-region-rw "$1" read <<<"$region" 2>/dev/null | bintrim) $3 < "$2")
+ offset=$(binsearch <(ptrace-region-rw "$1" read <(printf '%s\n' "$region") | bintrim) first $3 < "$2" 2>/dev/null)
if [[ -n "$offset" ]]; then
hex=$(printf '%.8x' "$offset")
awk '{printf "%s %s %s %s %s %s\n", $1, $2, "'"$hex"'", $4, $5, $6, $7}' <<<"$region"