⬢ DragonFlyBSD Kernel Audit
DF-5845 / symbols5845.sh
← back to finding ↓ download raw
#!/bin/sh
# symbols5845.sh -- harvest kernel symbol addresses + struct offsets into
# /tmp/df5845.const (read by df5845rig attack).
set -e
K=/usr/obj/usr/src/sys/FWH/kernel
[ -f "$K" ] || K=/boot/kernel/kernel

nm -an "$K" > /tmp/df5845.nm

getsym() {
    awk -v s="$1" '$3 == s { print "0x" $1; exit }' /tmp/df5845.nm
}

{
    echo "pfindn $(getsym pfindn)"
    echo "fw_asy_callback $(getsym fw_asy_callback)"
    echo "fwh_fc $(getsym fwh_fc)"
    echo "fwh_atq $(getsym fwh_atq)"
} > /tmp/df5845.const

/root/fw5845/offsets5845 | awk '{ if ($2 ~ /^0x/) print; else printf "%s 0x%x\n", $1, ($2+0) }' >> /tmp/df5845.const
chmod 644 /tmp/df5845.const
cat /tmp/df5845.const
echo SYMBOLS5845_OK