#!/usr/bin/python import dbus, flimflam, sys if (len(sys.argv) < 2): print "Usage: %s
" % (sys.argv[0]) sys.exit(1) (_, address) = sys.argv flim = flimflam.FlimFlam(dbus.SystemBus()) for device in flim.GetObjectList("Device"): device_properties = device.GetProperties(utf8_strings = True) for path in device_properties["IPConfigs"]: ipconfig = flim.GetObjectInterface("IPConfig", path) ipconfig_properties = ipconfig.GetProperties(utf8_strings = True) if ipconfig_properties["Method"] not in ["ipv4","ipv6"]: print "Skip %s; method %s" % (ipconfig.object_path, ipconfig_properties["Method"]) continue ipconfig.SetProperty("Address", address)