开发者

C# on Linux: How to enumerate the computers on the local network?

How can I enumerate all machine names and IPs of remote computers in the local network ?

Note: NOT on Windows (how to d开发者_C百科o that one finds via google), I need something that works on Linux ! Or a C/C++ sample would also do it, I can call libc from C#.


You can run smbtree make sure samba is installed.

run smbtree which will show all the domain, computer and public share on the network.Write this detail in a file and use this file to get required info

See the output of smbtree

[paul@RHEL4b ~]$ smbtree
Password: 
WORKGROUP
    \\W2000          
PEGASUS
    \\WINXP          
    \\RHEL4B                        Pegasus Domain Member Server
        \\RHEL4B\ADMIN$                 IPC Service (Pegasus Domain Member Server)
        \\RHEL4B\IPC$                   IPC Service (Pegasus Domain Member Server)
        \\RHEL4B\domaindata             Active Directory users only
    \\HM2003  

WORKGROUP, PEGASUS are domain name

W2000, WINXP, RHEL4B, HM2003 these are server name

RHEL4B\ADMIN$, RHEL4B\IPC$, RHEL4B\domaindata these are the shares


Look at the source of smbtree from samba.


The easiest way would be to send out a broadcast icmp packet, and see who responds, and count that. This should be doable in a pretty standard manner with any programming language that has standard networking libraries for tcp/ip.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜