How to find out which process opens tcp connection ?

kultakala

New Member
Joined
Jul 13, 2023
Messages
4
Reaction score
1
Credits
41
Hi all,

I have a SUSE linux server which repeatedly tries to open a tcp connection to a proxy server on port 8080.
But i do not know which process opens the connection and what url it tries to reach.
Thats because the proxy server is not in my hands and the server is not allowed to access the proxy.
The tcp session itself is not accepted so i never see any url request within a capture.
I tried to find which process tries to open the connection by using "lsof", "ss" and "netstat" commands but the only thing i see is an output like this:

# netstat -nap | grep 8080
tcp 0 0 10.183.45.88:53550 10.182.33.105:8080 TIME_WAIT -

So, there is no process listed.
I guess i am not able to catch the moment during the tcp session init.

Any idea how i can find out which process is initiating the tcp connection to the proxy ?

Thanks!
 


Hi,

I didnt find that forum thread while i searched for a solution, thanks for the hint.

I looked for the source port with netstat and used ss -tp sport command to find the initiating process id.

At first i thought i solved the problem, but before i can manually check the source port its already in use by a different process.
Sometimes its even not open anymore at all.

I guess i need to debug the network process itself or something.
 
Last edited:
lsof -i
 
Unfortunately netstat or lsof does not help.
I ran a while loop which executed a netstat or lsof command multiple dozen times a second but even then i was able only one time to get the open local port. But when i checked this local port it was already closed and i didnt find out the process.
So i need a script or something to automatically parse the local port and find the process.
But i dont know how to do that.
The opening of the tcp connection until it gets closed is only 1 millisecond according to the packet capture so i guess even a script wouldnt help.
Is there any chance to debug the service which opens the connections for the processes ? Dont know how to describe it better.
 
The opening of the tcp connection until it gets closed is only 1 millisecond according to the packet capture so i guess even a script wouldnt help.
Is there any chance to debug the service which opens the connections for the processes ? Dont know how to describe it better.

tcpdump
 
Hi all,

I have a SUSE linux server which repeatedly tries to open a tcp connection to a proxy server on port 8080.
But i do not know which process opens the connection and what url it tries to reach.
Thats because the proxy server is not in my hands and the server is not allowed to access the proxy.
The tcp session itself is not accepted so i never see any url request within a capture.
I tried to find which process tries to open the connection by using "lsof", "ss" and "netstat" commands but the only thing i see is an output like this:

# netstat -nap | grep 8080
tcp 0 0 10.183.45.88:53550 10.182.33.105:8080 TIME_WAIT -

So, there is no process listed.
I guess i am not able to catch the moment during the tcp session init.

Any idea how i can find out which process is initiating the tcp connection to the proxy ?

Thanks!
I always use netstat -tulpen Maybe this is already enough for you
 

Members online


Latest posts

Top