Skip to content

Instantly share code, notes, and snippets.

Avatar

ChrisGuest ChrisGuest

  • Melbourne, Australia
View GitHub Profile
@pklaus
pklaus / enumerate_interfaces.py
Last active Sep 22, 2022
Python: List all Network Interfaces On Computer
View enumerate_interfaces.py
"""
Determine IPv4 addresses on a Linux machine via the socket interface.
Thanks @bubthegreat the changes to make it Py2/3 compatible and the helpful
code comments: https://gist.github.com/pklaus/289646#gistcomment-2396272
This version has all comments removed for brevity.
"""
import socket
import array
import struct