I wanna develop a small application to monitor arp and scan arp list in local network.
Currently, I need to retrieve the list of network interfaces and its configuration.
Most of the time I work with Linux, so I don't know much about Win32 API, is there anyway to do this in python way ? I'm using Python 2.6 with PyQt and Scapy (has pywin32 aswell, so if you provide the detail way with win32, I will try)
I found pcapy.findalldevs(), but it cannot retrive configuration. I don't care much about the name, just configuration(IP,netmask) is OK.
对于跨平台解决方案,我使用过netifaces 。
Not sure exactly what info you want, but ipconfig /all
certainly sounds like what you want:
import subprocess
subprocess.call('ipconfig /all')
For Linux, I use pynetlinux
pip install pynetlinux==1.1
>>> from pynetlinux import ifconfig >>> ifconfig.Interface("eth0").get_ip() '192.168.1.66'
Edit: This is indeed for Linux, for a cross-platform solution, see my other answer .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.