Skip to content

Instantly share code, notes, and snippets.

View JCloudYu's full-sized avatar

JCloudYu JCloudYu

View GitHub Profile
@EONRaider
EONRaider / get_ip_address.py
Last active August 17, 2024 18:47
Get the IP address of a network interface in Python 3
#!/usr/bin/env python3
# https://gist.github.com/EONRaider/3b7a8ca433538dc52b09099c0ea92745
__author__ = 'EONRaider, keybase.io/eonraider'
import fcntl
import socket
import struct
try:
from netifaces import AF_INET, ifaddresses