dbenders
Joined: 14 Oct 2002 Posts: 28 Location: Santiago, CHILE
|
Posted: Wed Aug 18, 2004 12:42 am Post subject: port_count.sh |
|
|
This script will count the number of opened ports. Is very usefull to count for example POP3, SMTP and HTTP conections.
In order to count remote ports, i.e. for remote servers, just configure the snmpd to transport the info.
Hope this help!
| Code: |
#!/bin/sh
#
# port_count.sh
#
# Autor : $Author: dbenders $
# Date : $Date: 2004/08/16 17:49:42 $
# Version : $Revision: 1.4 $
# Description : Count the number of TCP ports opened
#
# Example: port_count.sh 25
#
total=`netstat -tn | grep ":$1 " | awk {'print $4'} | wc -l|awk '{print $1}'`
echo $total
#############################################################################
# END OF FILE
#############################################################################
|
|
|