Skip to content

Instantly share code, notes, and snippets.

View dominickpastore's full-sized avatar

Dominick C. Pastore dominickpastore

View GitHub Profile
@dominickpastore
dominickpastore / getnifs.py
Last active June 5, 2021 02:40 — forked from chadmiller/getnifs.py
Get network addresses for interfaces on Linux (and possibly macOS and BSDs)
#!/usr/bin/python3
# Based on https://gist.github.com/provegard/1536682, which was
# Based on getifaddrs.py from pydlnadms [http://code.google.com/p/pydlnadms/].
# Only tested on Linux!
from socket import AF_INET, AF_INET6, inet_ntop, if_nametoindex
from ctypes import (
Structure, Union, POINTER,
pointer, get_errno, cast,