google / nogotofail

An on-path blackbox network traffic security testing tool
Apache License 2.0
2.94k stars 417 forks source link

Local ip parsing shouldn't use ifconfig #18

Open chadbrubaker opened 9 years ago

chadbrubaker commented 9 years ago

As seen in #17 ifconfig output is platform dependent and we should find a more platform independent way to find all the ip addresses bound to interfaces.

nikhilgeo commented 9 years ago

Python netifaces package can be made used to find the IP address of the all the interfaces.

from netifaces import interfaces, ifaddresses, AF_INET for ifaceName in interfaces(): addresses = [i['addr'] for i in ifaddresses(ifaceName).setdefault(AF_INET, [{'addr':'No IP addr'}] )] print '%s: %s' % (ifaceName, ', '.join(addresses))

jack17529 commented 7 years ago

Can I work on this?