一个类,它发送一个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…

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java如何在springmvc POST webservice中验证集合?   java将变量传递到@Optional注释   浮点Java字节到浮点   java为什么我的结果字符串在解析json数据后不打印到logcat?   多线程应用程序中的java可选调试输出是为客户机提供的,而不是为了找出死锁或bug   java Hibernate模型对象作为VO对象   java字体未应用于复选框并切换到Android Studio 3   list Java equals方法无法按预期工作   java将未知对象强制转换为特定接口可以吗?   调用后未擦除方法中的Java变量   数组求和不正确,线程“main”java中出现异常。lang.ArrayIndexOutofBounds异常:100   java超级类应该实例化并调用其子类吗?   在java apache中。平民io,如何避免读取旧的日志消息   BuffereImage如何使用apache在TIFF图像中保持透明性。平民java中的图像处理   java转换。将文件分类为二进制代码(1和0)   Java:。类搜索器   java如何使用谓词生成器返回“Todays Orders”