1#!/bin/bash
2port=8888
3if [ "x$1" = "x-p" ]; then
4  shift
5  port=$1
6  shift
7fi
8addr=08
9if [ "x$1" = "x-a" ]; then
10  shift
11  addr=$1
12  shift
13fi
14for (( i=0; i<512; i++ )) ; do
15  h=`printf "%4.4X" $i`
16  ret=`echo "hex ${addr}b509030d${h##??}${h%%??}"|nc -q 1 localhost $port|head -n 1`
17  echo $i "=" $ret
18done
19