The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Operating Systems > SUN Solaris
.
google unix.com



SUN Solaris The Solaris Operating System, usually known simply as Solaris, is a free Unix-based operating system introduced by Sun Microsystems .

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Looking for monitor/top pavelmac UNIX for Dummies Questions & Answers 1 09-27-2005 11:12 PM
How to monitor pty l-roner AIX 2 07-08-2005 10:17 AM
PC monitor mangolinux SUN Solaris 1 02-14-2005 04:58 PM
Ports... TechKnow UNIX for Dummies Questions & Answers 5 05-20-2004 11:34 AM
Sun Monitor Jai UNIX for Dummies Questions & Answers 8 12-13-2001 01:12 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-11-2007
mhm4 mhm4 is offline
Registered User
  
 

Join Date: Jul 2005
Location: Chicago, IL
Posts: 86
how to monitor ports

I run into this issue occasionally and just looking for suggestions on how others solved it. I would like to monitor ports on a large number of systems and would like to determine which systems are listening on specific ports. I know there are heavy-weight apps that provide this such as HP ovo but I am looking for some light-weight open source options. I believe a syn scan will be sufficient for my purpose but I have not used any tools previously or not sure if their is a way to use default system tools or commands for this. Also for the those that have used syn scanning, does anyone run into issues due to simulating a syn attack in any of your networks?

Before you relpy, please do not recommend ping as it does not provide the functionality that I am looking for. Also, telnet will not provide this functionality because I do not what to have to script any break out or termination sequences for various connections (ie sendmail - port 25).
  #2 (permalink)  
Old 06-11-2007
reborg's Avatar
reborg reborg is online now Forum Staff  
Administrator
  
 

Join Date: Mar 2005
Location: Ireland
Posts: 4,208
You could use nmap.
  #3 (permalink)  
Old 06-11-2007
blowtorch's Avatar
blowtorch blowtorch is offline Forum Advisor  
Supporter
  
 

Join Date: Dec 2004
Location: Singapore
Posts: 2,350
lsof might be another option here.
  #4 (permalink)  
Old 06-11-2007
ghostdog74 ghostdog74 is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2006
Posts: 2,509
I use this Python script to check for port availability for my site. If you have Python, you are try this.
Code:
import socket
remote_host="localhost"
for remote_port in [22,901,139]:
        sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        sock.settimeout(60)
        try:
                sock.connect((remote_host, remote_port))
        except Exception,e:
                print "%d closed " % remote_port                
        else: 
                print "%d open" % remote_port
        sock.close()
  #5 (permalink)  
Old 06-12-2007
sysgate's Avatar
sysgate sysgate is offline Forum Advisor  
Unix based
  
 

Join Date: Nov 2006
Location: Bulgaria
Posts: 1,318
GhostDog, nice one, I just changed it a little bit per my needs, thanks for sharing that.
Code:
#!/usr/bin/python

import socket
import sys

if ( len(sys.argv) != 2 ):
    print "Usage: " + sys.argv[0] + " you must enter IP or FQDN"
    sys.exit(1)

remote_host = sys.argv[1]

for remote_port in [22,80,8080,993]:
        sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        sock.settimeout(60)
        try:
                sock.connect((remote_host, remote_port))
        except Exception,e:
                print "%d closed " % remote_port
        else:
                print "%d open" % remote_port
        sock.close()
  #6 (permalink)  
Old 06-27-2008
JeepResQ's Avatar
JeepResQ JeepResQ is offline
Registered User
  
 

Join Date: Nov 2007
Location: maryland...until i move back to va
Posts: 10
Smile cheers mate

Good looking script to the both of ya! Gotta love python...or as I call it...miniJava in the Shell! lol
  #7 (permalink)  
Old 06-13-2007
mhm4 mhm4 is offline
Registered User
  
 

Join Date: Jul 2005
Location: Chicago, IL
Posts: 86
Thanks all for your feedback.
I was not aware for nmap. This looks like a great tool.
I love the simplicity of the python script also.
I believe lsof is for the local system, meaning that it must be installed on the local system to gather info which may not be effective for monitoring a large number of systems. Plus, one will have to handle remote login access to run the command.
Closed Thread

Bookmarks

Tags
ping, ping port, port, port ping, sendmail

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:11 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0