#!/bin/tcsh
/bin/rm prp.*
set ddd = `date +"%F %H:%M:%S"`
echo $ddd"> Pocetak " >> izvestaj
set net=1
set ispis=0
while ($net<255)
   set net = `expr $net + 1`
   set host=0
   while ($host<255)
      set ispis = `expr $ispis + 1`
      set host = `expr $host + 1`
      set ipaddr = `echo "89.216."$net"."$host`
      wget -t1 --timeout=2 "http://"$ipaddr":25/index.html" >& prp.$$
      set klko = `grep 'Connection timed out.' prp.$$ | wc -l`
      set ddd = `date +"%F %H:%M:%S"`
      if ($klko>0) then
         echo $ddd">" $ipaddr >> izvestaj
      else
         echo $ddd"> (SMTP)" $ipaddr >> izvestaj 
      endif
      if ($ispis>20) then
         set zzz = `grep "SMTP" izvestaj | wc -l`
         echo $ispis $net"."$host" ==" $zzz
         set ispis=0
      endif
      /bin/rm prp.$$
   end  
end
/bin/rm prp.*
