一个类,它发送一个arp请求以知道主机是否在本地网络上联机
arprequest的Python项目详细描述
一般
arp request是一个python模块,用于发出arp无偿请求。 了解主机是否联机。它作用于OSI模型的2级 icmp echo(ping),因此,您可以在没有ip配置的情况下使用它,或者 “ping”其他IP网络中的主机。但是,您只能在 本地网络。
用法
>>> from arprequest import ArpRequest >>> ar = ArpRequest('10.0.0.1', 'eth0') >>> ar.request() True >>> ar2 = ArpRequest('10.0.0.123', 'eth0') # 10.0.0.123 doesen't exist >>> ar2.request() False
更改日志
0.3:
You can now select type of ARP request. This is done with “arp_type” argument of ArpRequest class. You can use arprequest.ARP_GRATUITOUS to make an ARP Gratuitous request (what is currently done) or use arprequest.ARP_STANDARD to do a standard ARP request.
This option was created to use this library with systems which are configured to block Arp Gratuitous.
约束条件
- ArpRequest work only on unix or unix-like platforms because it uses unix signals.
- ArpRequest work only as root, because it uses raw sockets.
- Module is commented in french. I will translate comments in english, some day…