List of IP addresses/hostnames from local network

2019-01-13 02:41发布

How can I get a list of the IP addresses or host names from a local network easily in Python?

It would be best if it was multi-platform, but it needs to work on Mac OS X first, then others follow.

Edit: By local I mean all active addresses within a local network, such as 192.168.xxx.xxx.

So, if the IP address of my computer (within the local network) is 192.168.1.1, and I have three other connected computers, I would want it to return the IP addresses 192.168.1.2, 192.168.1.3, 192.168.1.4, and possibly their hostnames.

7条回答
甜甜的少女心
2楼-- · 2019-01-13 03:15

One of the answers in this question might help you. There seems to be a platform agnostic version for python, but I haven't tried it yet.

查看更多
登录 后发表回答