import dns.resolver import ifcfg import json import socket import struct import sys import time def gateway(device): with open("/proc/net/route") as fh: # skip header next(fh) for line in fh: routes = line.strip().split() if routes[0] == device: destination = socket.inet_ntoa(struct.pack("