1827293 Members
4106 Online
109717 Solutions
New Discussion

Finding Open ports

 
Ronit_1
Occasional Advisor

Finding Open ports

I want to find out the number of ports they r open and in use in HPUX 11i system.

5 REPLIES 5
Patrick Wallek
Honored Contributor

Re: Finding Open ports

You would be best served by getting the tool 'lsof' and installing it. That will most easily allow you to do this.

You can get lsof from:
http://hpux.connect.org.uk/hppd/hpux/Sysadmin/lsof-4.78/

You can also use the 'netstat' command to see what is listening.

A 'netstat -a' will show a lot of network information. Have a look at 'man netstat' for more information.
Anshumali
Esteemed Contributor

Re: Finding Open ports

May be you want to try nmap as well....search google for this
Dreams are not which you see while sleeping, Dreams are which doesnt allow you to sleep while you are chasing for them!!
Kapil Jha
Honored Contributor

Re: Finding Open ports

Still in lsof you will have to grep a port you looking for.
I suppose there is no command which could give u a list of open and used port.
Br,
Kapil
I am in this small bowl, I wane see the real world......
Anshumali
Esteemed Contributor

Re: Finding Open ports

Kapil: I suppose there is no command which could give u a list of open and used port.
-----------------

There are lot many tools like nmap and satan..which could give you the ports opened from your machine to the server.(It may be illegal to use in your country may be) but They are widely used in network scanning for open ports. ( Blackheads may call it back door;) )

If that is not what you need you can still use the lsof with decent combination of UNIX supplied commands (grep, netstat)on the server itself. Combining options available in UNIX doesn't deface the value of a particular utility or command.It increases the power, thats why i love UNIX....


Dreams are not which you see while sleeping, Dreams are which doesnt allow you to sleep while you are chasing for them!!
Ralph Grothe
Honored Contributor

Re: Finding Open ports

As said, there are numerous tools for port scanning.
One of the most versatile is nmap
which you can use if you not only want to check from a different host which ports are serviced by your host, but also which are open or closed (but reachable), viz. not filtered by a firewall.
nmap can also perform many sorts of stealth scans, or even scans that pretend to be coming from a different host (idle scan) which could be helpful in tricking some state inspecting firewalls or intrusion detection systems.
Where nmap lacks a bit however, sometimes can be where UDP port scans are of interest because it might not be able to tell whether a UDP port really is open or filtered.
For determining a real open UDP port the scanner would have to send a valid UDP datagram for the particular UDP service which would require knowledge of too many protocols at application layer, and catch a response datagram.
But there are other port scanners that partly cover this for the more general services that use UDP.

If you are only interested to quickly check on your host locally ports that service, the netstat command is more than sufficient
e.g.

$ netstat -an|awk '$NF~/LISTEN/{print a[split($4,a,".")]}'|sort -n
Madness, thy name is system administration