start | find | index | login or register | edit
2006-12-13
by earl, 6583 days ago
a simple shellscript that prints basic stats about the nat usage of a zyxel router (should work with a wide range of prestige routers, tested on p324 and p660).

#!/bin/bash
if [ "$#" -ne "3" ]; then
echo "Usage: $0 ip password interface" 1>&2
exit 1
fi

HOST=$1; PASS=$2; INTF=$3

printf "${PASS}\n24\n8\nip nat hash ${INTF}\nexit\n99\n" |
nc ${HOST} 23 |
sgrep '("Idle".."=\r\n")__"\r\n\r\n"' |
awk '{print $3,$2}' |
sort |
uniq -c

requires netcat and sgrep. don't you love the unix toolchain?
powered by vanilla
echo earlZstrainYat|tr ZY @.
earl.strain.at • esa3 • online for 8692 days • c'est un vanilla site