|
Home > Archive > Unix Programming > January 2004 > How do I know which ports an application opens
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
How do I know which ports an application opens
|
|
|
| Hello,
I ran a unix application ; I want to know which ports
these application opens.
(This application simply opens sockets with 2 or 3 ports).
How can I do it ?
I of course can do it indirectly.
For example, run nmap before starting the application and
after starting it , and see the difference in ports.
but is there a direct way ?
regards,
sting
| |
| Nils O. =?iso-8859-1?Q?Sel=E5sdal?= 2004-01-23, 5:30 pm |
| In article <2ff4a208.0312100516.1d384887@posting.google.com>, Sting wrote:quote:
> Hello,
> I ran a unix application ; I want to know which ports
> these application opens.
> (This application simply opens sockets with 2 or 3 ports).
>
> How can I do it ?
>
> I of course can do it indirectly.
> For example, run nmap before starting the application and
> after starting it , and see the difference in ports.
> but is there a direct way ?
try netstat , depending on which OS your on, it might show
you pid<->port relations.
--
Vennlig hilsen/Best Regards
Nils Olav Selåsdal <NOS at Utel.no>
System Engineer
UtelSystems a/s
| |
|
| Nils O. Selåsdal wrote:
[QUOTE][color=darkred]
> In article <2ff4a208.0312100516.1d384887@posting.google.com>, Sting wrote:
Look up this program: http://freshmeat.net/projects/lsof/
It's *very* handy for doing this kind of thing. It shows all open file
descriptors for a process. You can just grep the output for the socket
connections.
| |
| Stephane CHAZELAS 2004-01-23, 5:31 pm |
| 2003-12-10, 05:16(-08), Sting:quote:
> I ran a unix application ; I want to know which ports
> these application opens.
> (This application simply opens sockets with 2 or 3 ports).
[...]
lsof -ai -c <cmd-name>
or
lsof -ai -p <pid>
List the opened sockets (either listening or connected ones, TCP
or UDP).
lsof -i
lists every opened socket on your system.
--
Stéphane ["Stephane.Chazelas" at "free.fr"]
|
|
|
|
|