def get_gateway_ip():
# get the 'default' gateway
try:
return netifaces.gateways()['default'][netifaces.AF_INET][0]
except KeyError:
print("\n{R}ERROR: Unable to retrieve gateway IP address.\n{N}".format(R=RED, N=NORMAL))
return raw_input("Please enter gateway IP address manually: ")
评论列表
文章目录