Welcome![Sign In][Sign Up]
Location:
Search - recvfrom m

Search list

[Linux-UnixLinux-MAC20081224

Description: 在linux下,c语言编写,可以根据对方的IP,查看其MAC地址,也可以扫描局域网在线IP的MAC和主机名。原理:建立socket ,构造netbios-ns包,循环sendto()把数据发送给对方并recvfrom()读取返回信息。根据返回的netbios回应包,读取对方的主机名,组名和mac地址。 显示结果如下: IP: 192.168.116.124 Host Name: BRN_8EEE6A/BRN_8EEE6A MAC: 00-80-77-8E-EE-6A IP: 192.168.116.130 Host Name: XIAOXIAO/MSHOME MAC: 00-12-3F-D5-5E-A6 IP: 192.168.116.131 Host Name: NA MAC: NA [time out!] 一个网段扫描MAC,可以建立一个socket,连续向多个不同IP发送NBNS包,然后等待接受,根据返回包就可以扫描一个网段多个IP的MAC啦。 而windows下可以运行命令:nbtstat -A ip-address来查看 windows c 要改改头文件 -C language, based on each other s IP, to see its MAC address, can also scann more online IP-LAN MAC and host name. Principle: To establish a socket, constructed netbios-ns package, cycle to use sendto () function sent the data to the other side , and use recvfrom () to read back-information. Netbios respond in accordance with the return package, read each other s host name, group name and mac address.
Platform: | Size: 14336 | Author: darinwang | Hits:

CodeBus www.codebus.net