Get 'ifconfig' information via Python
Ivan Van Laningham
ivanlan at callware.com
Wed Aug 4 08:00:55 EDT 1999
Hi All--
"M.-A. Lemburg" wrote:
>
> David N. Welton wrote:
> >
> > 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 ?????.
> >
[snip]
> The .ioctl() function can take a string or an integer as
> third argument.
[snip]
>
> Building these structs can be done using the Python struct
> module... playing around with this can probably crash your system
> though.
>
> In the end, I think you're better off hacking together a
> new extension module.
>
Why on earth would reading this information into a struct crash his
system? Or am I missing something here? At worst, writing a messed-up
struct might hose his ethernet connection, but I really doubt that he
would be any more likely to crash his system using Python than C.
<c-is-your-friend-while-it-gnaws-your-hand-off>-ly y'rs,
Ivan
----------------------------------------------
Ivan Van Laningham
Callware Technologies, Inc.
ivanlan at callware.com
ivanlan at home.com
http://www.pauahtun.org
See also:
http://www.foretec.com/python/workshops/1998-11/proceedings.html
Army Signal Corps: Cu Chi, Class of '70
----------------------------------------------
More information about the Python-list
mailing list