Earlier I posted a message asking how to access low-level Linux network
information in Python - Shae Erisson was kind enough to point out gnetstat
(http://www.linuxcare.com.au/projects/gnetstat) to me...
Unfortunately, this wasn't quite what I was after. What I'd really like
to get is low-level NIC configuration information, such as the device
names of all configured ethernet cards (eth0, eth1... ethx), their IP
addresses, netmasks, etc.
I could do this by parsing the output of ifconfig, but for various reasons
don't want to do that. Is there any sort of low-level interface that I
can access via Python to get this information? I've looked through /proc
to see if there was something I could read, but nothing that seems to
contain the information I'm after.
Help! :)
- Mike K.
SIOCGIFADDR via ioctl() on a socket() (which does not have to be connected).
Was mentioned in several news articles in the last two weeks.
Bye, Jürgen
> Unfortunately, this wasn't quite what I was after. What I'd really like
> to get is low-level NIC configuration information, such as the device
> names of all configured ethernet cards (eth0, eth1... ethx), their IP
> addresses, netmasks, etc.
>
> I could do this by parsing the output of ifconfig, but for various reasons
> don't want to do that. Is there any sort of low-level interface that I
> can access via Python to get this information? I've looked through /proc
> to see if there was something I could read, but nothing that seems to
> contain the information I'm after.
I'd suggest browsing around in /proc/net/
My /proc/net/arp looked like it had most of the information you wanted,
I wasn't sure if the netmask there is the real netmask though.
/proc/sys/net/ also appears to contain useful information.
--
Shae Matijs Erisson - http://www.webwitches.com/~shae/
VirtualPairProgramming Wanted - Linux/Emacs/Python/Speak Freely
.fi: rakastan ohjelmointia - python kengittää aasia