简体   繁体   中英

Is there any way to find servers present in a local network using java?

I want to find a list of servers present in a local network using java. Is that possible? Or is there any way to differentiate servers from host machine when doing network scan?

The simplest solution is to call nmap from Java. This will port scan and attempt to classify the ports a computer is listening on. You can, of course, do the same thing from Java but it's unlikely to be worth the effort. https://nmap.org/

NOTE: This is a common tool used by network hackers, so make sure you have approval to run this on your network before you do it.

I am not aware of there being a clear distinction between a "normal host" and a "server". The systems I use all operate BOTH as "normal hosts" AND as "servers" ... depending on your perspective. (And you certainly can't distinguish typical systems based on the OS that they run. My laptop runs Linux, for example.)

If (hypothetically) you can come up with some objective criteria for distinguishing the two kinds of system (based on how they behave / respond to network requests), then it would be possible to tell them apart using a tool like nmap. Another option would be to use a tool like OpenVAS which can make an "educated guess" at a system's OS based on various clues.

But it really comes down to you providing some objective / measurable criteria for deciding if a system is a server.


But nmap just tries to guess the host machines OS and most of the time it failed to guess.

Well yes. Do you expect a typical OS to give away that kind of information to anyone / anything on the network that asks?

Now back in the 1980's ... before the Morris Worm was released into the wild ... people were a lot more trusting. But not in 2018!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM