#!/bin/bash


HOST=192.168.1.1


echo -n -e "\x00\xFE\x04\00" | nc -w1 $HOST 4223 > data.enumerate.bin
od -w54 -A n -t x1 data.enumerate.bin | cut -b 2- > data.enumerate.hex

echo "Enumeration: Scan Stack on IP:$HOST"
while read LINE ; do
DATA=`echo $LINE | tr -d " "`
count=1
DEVICENAME=""
for i in $LINE ; do
 if [ "$count" -eq 5 ] ; then echo -n "Device UID:$i" ; fi
 if [ "$count" -ge 6 ] && [ "$count" -le 11 ] ; then echo -n "$i" ; fi
 if [ "$count" -eq 12 ] ; then echo -n "$i   " ;  fi
 if [ "$count" -eq 13 ] ; then DEVICENAME=`echo -n -e "\x$i"` ; fi
 if [ "$count" -ge 14 ] && [ "$count" -le 51 ] ; then DEVICENAME=$DEVICENAME`echo -n -e "\x$i"` ; fi
 if [ "$count" -eq 52 ] ; then DEVICENAME=$DEVICENAME`echo -n -e "\x$i"` ; echo -n "Device Name:$DEVICENAME  " ; fi
 if [ "$count" -eq 53 ] ; then echo "Device Stack ID:$i" ; fi
count=`expr $count + 1`
done
done < data.enumerate.hex

# Aufraeumen
## rm data.enumerate.bin
## rm data.enumerate.hex


