python - Discover devices plugged in via ethernet cables? -
i have controller hardwire ethernet cable into. find devices connected via ethernet cable or similar , devices are. eg:
>>> ??? [{ host: "192.168.1.4", port: 23, device: 'galil dmc-4143' }]
is possible via python?
take @ netifaces. should help.
here example documentation:
>>> netifaces.interfaces() ['lo0', 'gif0', 'stf0', 'en0', 'en1', 'fw0'] >>> netifaces.ifaddresses('lo0') {18: [{'addr': ''}], 2: [{'peer': '127.0.0.1', 'netmask': '255.0.0.0', 'addr': '127.0.0.1'}], 30: [{'peer': '::1', 'netmask': 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff', 'addr': '::1'}, {'peer': '', 'netmask': 'ffff:ffff:ffff:ffff::', 'addr': 'fe80::1%lo0'}]}
and should work on os x, linux , windows.
Comments
Post a Comment