2

I have an issue I can't manage to solve.

What I know :

  • Some information about the process I'm looking for : It's a java process but if I have access to information similar to what's in ps -ef | grep java, then I can find it's PID.
  • The IP address of a remote machine running Linux version 3.16.7-35-desktop (SUSE Linux)

I would like to find the port used by that process on that machine, with some constraints :

  • Must be done programmatically, in java
  • Must work from Windows and Linux (if needed, the java code could handle both cases separately)
  • Doesn't require to install any other application (neither on the caller machine nor on the remote one)

I also know the port should be between 10000 and 20000. I have network access to the remote machine (both machines are on the same subnet).

How would you do that ?

Note : I found this, but it's old and not remote.

Community
  • 1
  • 1

1 Answers1

1

This is a standard hacking requirement. You can do do what nmap does.

Connect to every port in the range in turn and try to determine which the service is this listens to or responds to that port based on the data you get from the service as you connect. It is very slow and will look like a hack if you have any tools to detect this, but it is a technique which has been in use for a long time as it is the only way to do this without a service to tell you what is running on that machine.

A much better approach is to have a service discover process somewhere which has all the services you can contact, ideally with their status so you can easily find one which is available to your client.

Peter Lawrey
  • 525,659
  • 79
  • 751
  • 1,130