如何使用java获取连接到LAN的所有系统名称? [英] how to get all the system names connected to LAN using java?

查看:51
本文介绍了如何使用java获取连接到LAN的所有系统名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将所有系统连接到一个 LAN 中?有人可以推荐我吗?

I want to get all the systems connected in a LAN? Can anyone suggest me?

推荐答案

我在 Java 中用于实现此目的的包称为 jcifs.这是图书馆的链接.

The Package I used in Java to achieve this was called jcifs. Here is the link to the Library .

请注意,要识别子网上的机器,您需要 ping 子网上所有可用的 IP 地址.从那里您可以执行反向 IP 地址查找以获取机器详细信息.

Please note, to identify a machine on a subnet you will need to ping all the avaliable Ip addresses on the subnet. From there you can do a reverse IP Address lookup to get the machines details.

从 OSI 的记忆中,您要 ping 网络上的所有机器的原因是因为 ICMP 仍然是 OSI 模型的最低层.尽管您不能信任仅对子网上的所有机器使用 ICMP(ping)请求.这样做的原因是大多数防止钓鱼攻击的 Windows 机器都会阻止该协议.因此,您需要采用两阶段检测方法.首先,使用 ICMP ping 请求通过子网 Ip 地址进行广播.从等待 1 秒后的 ICMP ping 请求,继续执行到非响应 IP 地址的 SMB 连接.您会发现大多数人都拥有 Microsoft Network 的共享打印机,可以响应该端口下的请求.

From memory from the OSI the reason why you want to ping all the machines on the network is because ICMP is still the lowest layer on the OSI Model. Though you just cannot trust just using ICMP (ping) requests to all machines on the subnet. The reason for this is most Windows Machines to prevent fishing attacks will block that protocol. So instead, you need to take a two stage detection approach. First, broadcast over the SubNet Ip address with a ICMP ping request. From the ICMP ping request after waiting 1 second, proceed to perform a SMB connection to the non responding IP addresses. You will find that most people will have either a shared printer of Microsoft Network that will respond to a request under that port.

另一种方法是使用 NetBios 反向名称查找,尽管它仍然涉及向子网的 IP 地址范围发送垃圾邮件.

The alternative is to use a NetBios reverse name lookup, though it still involves spamming the IP address range of the subnet.

希望这会有所帮助.

这篇关于如何使用java获取连接到LAN的所有系统名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆