#!/bin/sh
# root/sean/nmap_port
#                                        Sean Boran, 7.jun.01
#

port="600";
user="root";
ignore="^Port|filtered|^$|seconds to scan|Initiating"
cmd="/usr/local/bin/nmap -P0 -sS -p $port";

f=$0.$$;

for target in 176.17.17.0/24 10.2.3.0/24 ; do
  date > $f
  echo "$cmd $target" >> $f 2>&1
  $cmd $target        >> $f 2>&1 
  date >> $f
  echo "see $0 for more details." >> $f 2>&1

  egrep -v "$ignore" $f |mailx -s "Security port $port scan $target" $user
  # empty file for next scan, but leave a copy hanging around
  mv $f $f.done
done

