Files
libc-database/dump
T
Ajabep d69f04c887 Path + Return code (#27)
* 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
2020-09-01 23:05:58 +02:00

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