获取没有 DNS 的网络上所有计算机的列表 [英] Get a list of all computers on a network w/o DNS
问题描述
您好,
我需要一种方法(通过 C# 或 .bat 文件)来获取给定网络上所有计算机的列表.通常,我使用网络视图",但这往往(根据我的理解)仅在您的域内起作用.我需要网络上所有可用计算机的名称(或至少是 IP 地址).
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.
能够在不属于我的域中获取所有计算机(在这种情况下,我将使用 WORKGROUP 或任何默认设置)也可以.
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.
推荐答案
Nmap 对此有好处 - 使用 -用于操作系统指纹识别的 O 选项和用于 output 作为 xml 的 -oX "filename.xml"然后可以从 c# 解析.
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#.
合适的命令行是(其中 192.168.0.0/24 是要扫描的子网):
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
如果您对猜测操作系统不感兴趣,请省略 -O - 如果您只想进行 ping 扫描,请使用 -sP,或者阅读文档以了解无数其他选项.
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.
这篇关于获取没有 DNS 的网络上所有计算机的列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!