Port Scanner

Steven Stringham sstringh "at" lrlaw.com
Sat, 25 Aug 2001 14:45:16 +0000


Sure, Look below.

>>> chidiebube "at" yahoo.com 06:47:38 PM 08/24/2001 >>>
Steve,

Could you help me out. I need to take a look at your script. I may
modify
and if you wish, send it back to you. Thanks.

Chidi.

-----Original Message-----
From: owner-vnc-list "at" uk.research.att.com 
[mailto:owner-vnc-list "at" uk.research.att.com]On Behalf Of Steven
Stringham
Sent: Friday, August 24, 2001 2:36 PM
To: vnc-list "at" uk.research.att.com 
Subject: Re: Port Scanner


I had a similar need.
I developed a script using NMAP on a linux box. It could be made much
prettier, and more efficient I am sure, but... it works.
It scans my network every 5 minutes and publishes a web page with the
DNS names and IP addresses of stations with port 5800 open.

Good luck
Steve


vncscan.sh
****************
#!/bin/csh
set VNC1='/root/tmp1/vnc1.sh'
set VNC2='/root/tmp1/vnc2.sh'
set VNC3='/root/tmp1/vnc3.sh'
set FILE2='/root/tmp1/fil1.lst'
set FILE='/root/tmp1/working.htm'
set FILEBK1='/home/httpd/html/vnc/vncbak1.htm'
set FILEBK2='/home/httpd/html/vnc/vncbak2.htm'
set FILEBK3='/home/httpd/html/vnc/vncbak3.htm'
set FILECUR='/home/httpd/html/vnc/index.htm'
#call first subscripts
${VNC1} ${FILE2}>${FILE}
#rename the old files for temp backup
rm -f $FILEBK3
cp $FILEBK2 $FILEBK3
rm -f $FILEBK2
cp $FILEBK1 $FILEBK2
rm -f $FILEBK1
cp $FILECUR $FILEBK1
rm -f $FILECUR
cp $FILE    $FILECUR
****************


vnc1.sh
****************
#!/bin/csh
set VNC2='/root/tmp1/vnc2.sh'
set VNC3='/root/tmp1/vnc3.sh'
set FILE2=$1
echo "<html><head>"
echo "<TITLE>Active VNC Clients</TITLE>"
echo "<style type='text/css'>"
echo "  a:active  {font-weight: bold; text-decoration: none; color:
blue;}"
echo "  a:visited {font-weight: bold; text-decoration: none;color:
blue;}"
echo "  a:link   {font-weight: bold; text-decoration: none;color:
blue;}"
echo "  a:hover  {font-weight: bold; text-decoration: none; color:
purple;}"
echo "</style>"
echo "</HEAD>"
echo "<BODY>"
echo "<center><h1>VNC Network Machine List</h1><br>"
echo "Last update started: `date`<br>"
echo "<table border=1>"
echo "<tr><td><h2><center>Workstations</center></h2></td></tr>"
echo "<tr><td valign=top>"
echo "<center><h2>Location</h2>"
#core of the scan.
${VNC3} 5800 ******YOUR_IP_ADDRESS_RANGE_HERE**** >$FILE2
${VNC2} $FILE2 5800
echo "</center></td></tr>"
echo
"</table>"
echo "</center></body></html>"

****************

vnc2.sh
****************
#!/bin/csh
set FILE=$1
set PORT=$2
#make it pretty
echo "<table border=1>"
echo "<tr><td><b>DNS Name</b></td><td><b>IP Address</b></td></tr>"
set mylist="`cat $FILE|sort`"
foreach x1 ($mylist)
# - check if address is in my line.
   if ("`echo $x1|cut '-d.' -f 1`" != "63") then
 	echo "<tr><td>"${x1}"</td>"
   else
	echo "<td><a href='http://"${x1}":${PORT}'>${x1}</a></td></tr>"
   endif
end
echo "</table>"
****************

vnc3.sh
****************
#!/bin/csh
#scan for stations and put out a file with ip address and dns name
set PORT=$1
set ADDR=$2
#actual scan of the stations
/usr/bin/nmap -v -sS -p ${PORT} ${ADDR} |grep Interesting | cut '-d '
-f 4,5 |cut '-d)' -f1 |cut '-d(' --output-delimiter=" " -f 1,2|sort
****************





---------------------------------------------------------------------------
NOTE:  This message is intended only for the use of the individual or
entity to which it is addressed. If the reader of this message is not the
intended recipient, or the employee or agent responsible for delivering
the message to the intended recipient, you are hereby notified that any
dissemination, distribution or copying of this message is strictly
prohibited.  If you have received this communication in error,
please notify us immediately by replying to the sender of this E-Mail or
by telephone at: 

Phoenix (602) 262-5311
Tucson (520) 622-2090
Las Vegas (702) 949-8200
---------------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, send a message with the line: unsubscribe vnc-list
to majordomo "at" uk.research.att.com
See also: http://www.uk.research.att.com/vnc/intouch.html
---------------------------------------------------------------------