Python 3 Script to Get IPs
#!/usr/bin/env python3
def getips():
import re
import subprocess
# get ip(s) from ifconfig
found_ips = []
ips = re.findall( r'[0-9]+(?:\.[0-9]+){3}', subprocess.getoutput("/sbin/ifconfig"))
for ip in ips:
if ip.startswith("255") or ip.startswith("127") or ip.endswith("255"):
continue
found_ips.append(ip)
return ", ".join(found_ips)