mirror of
https://github.com/niklasb/libc-database.git
synced 2026-10-12 02:19:58 +00:00
* Change a message with the right path
Indeed, the script is position independant, thus `./db` is not always
the path to the db.
* Add return codes
It allows automatic tests and, if everything is find, to reproduce 22ad329
21 lines
497 B
Bash
Executable File
21 lines
497 B
Bash
Executable File
#!/bin/bash
|
|
cd "$(dirname "$0")"
|
|
. common/libc.sh
|
|
if [[ $# < 1 ]]; then
|
|
echo >&2 "Usage: $0 id [name1 [name2 ...]]"
|
|
exit 2
|
|
fi
|
|
id=$1
|
|
shift 1
|
|
if [[ $# == 0 ]]; then
|
|
names="__libc_start_main_ret system dup2 read write str_bin_sh"
|
|
else
|
|
names="$@"
|
|
fi
|
|
ls -1 "db/${id}."* >/dev/null 2>&1 || die "Invalid ID '$id'"
|
|
for name in $names; do
|
|
offset=`cat db/${id}.symbols | grep "^$name " | cut -d' ' -f2`
|
|
[ -z "$offset" ] && die "Invalid symbol '$name'"
|
|
echo "offset_${name} = 0x${offset}"
|
|
done
|