using the dnet Python module:
Python 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import dnet
>>> dnet.route().get(dnet.addr('0.0.0.0/0'))
10.0.1.1
>>> dnet.intf().get('eth3')
{'addr': 10.0.1.28/2
it's not a piece of code but still may be helpful:
int pcap_lookupnet(char *device, bpf_u_int32 *netp,
bpf_u_int32 *maskp, char *errbuf)
pcap_lookupnet() is used to determine the network number and mask
associated with the network device device. Both netp and maskp are
bpf_u_in
Hi to all,
Does anyone know of some piece of C code that can allow me to get me the ip
addr, subnet mask and gateway ip addr of my machine itself (the one I'm running
the code on)?
I got a code snippet for getting the mac addr of my NIC but concerning the
above info. that I require, I don't kn