Get 'ifconfig' information via Python

David N. Welton dwelton at linuxcare.com
Tue Aug 3 17:41:13 EDT 1999


So, I think I'm getting close...

import fcntl
import IN
import struct

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

res = fcntl.ioctl(s, IN.SIOCSIFHWADDR, ??????)

I can't seem to find what goes in ?????.

Is this the right way to be doing things?  I suppose I can always go
pull apart the sources for ifconfig itself, and make a .so that does
what I need, but I get the feeling that I can do what I need from
within Python.

Yeah, I could popen ifconfig, too, but that's ugly.

Downloading python sources now to see what I can see in the fcntl
module...

Thanks,
-- 
David N. Welton, Web Engineer, Linuxcare, Inc.
415.354.4878 x241 tel, 415.701.7457 fax
dwelton at linuxcare.com, http://www.linuxcare.com/
Linuxcare. At the center of Linux.




More information about the Python-list mailing list