Get a list of all computers on a network w/o DNS

2019-01-18 16:07发布

Greetings,

I need a way (either via C# or in a .bat file) to get a list of all the computers on a given network. Normally, I use "net view", but this tends to work (from my understanding) only within your domain. I need the names (or at least the IP Addresses) of all computers available on my network.

Being able to get all computers on a domain that isn't mine (in which case I'd use WORKGROUP, or whatever the default is) would also work.

4条回答
老娘就宠你
2楼-- · 2019-01-18 16:40

In one of my web app I used the NetApi32 function for network browsing.

Code: http://gist.github.com/11668

查看更多
Bombasti
3楼-- · 2019-01-18 16:41

Nmap is good for this - use the -O option for OS fingerprinting and -oX "filename.xml" for output as xml that you can then parse from c#.

A suitable commandline would be (where 192.168.0.0/24 is the subnet to scan):

nmap -O -oX "filename.xml" 192.168.0.0/24

leave out the -O if you aren't interested in guessing the OS - if you just want a ping sweep use -sP, or read the docs for the myriad other options.

查看更多
来,给爷笑一个
4楼-- · 2019-01-18 16:53

Ping everything in the rage, then you can get netbios info from the systems that respond to identify it's name.

查看更多
姐就是有狂的资本
5楼-- · 2019-01-18 16:54

To expand on what Unkwntech has said -

You can also do a "broadcast" ping to avoid having to ping each IP address individually.

Immediately after than you can use "arp" to examine the ARP cache and get a list of which IP addresses are on which MAC address.

查看更多
登录 后发表回答