import android, os, time droid = android.Android() def getIfList(): """Returns a dict of iface/ip for all up non-loopback interfaces.""" npipe = os.popen("netcfg") ret = {} for line in npipe: # format: a = line.split() # ignore the DOWN ones and loopback if (a[1] == "UP"): if (a[0] != "lo"): ret[a[0]] = a[2] # ifname = ip return ret # main print getIfList() time.sleep(1)