diff --git a/host/utils/umtrx_net_burner b/host/utils/umtrx_net_burner index 323076c9..f8e46d40 100755 --- a/host/utils/umtrx_net_burner +++ b/host/utils/umtrx_net_burner @@ -137,25 +137,14 @@ def is_valid_fw_image(fw_image): ######################################################################## # interface discovery and device enumeration ######################################################################## -def command(*args): - p = subprocess.Popen( - args, - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, - ) - ret = p.wait() - verbose = p.stdout.read().decode() - if ret != 0: raise Exception(verbose) - return verbose - def get_interfaces(): if(platform.system() is "Windows"): return win_get_interfaces() else: return unix_get_interfaces() def unix_get_interfaces(): - ifconfig = command("/sbin/ifconfig") - ip_addr_re = "cast\D*(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})" - bcasts = re.findall(ip_addr_re, ifconfig) + ipint = subprocess.check_output(["/sbin/ip", "-4", "a", "s", "up"]) + ip_addr_re = "brd\D*(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})" + bcasts = re.findall(ip_addr_re, ipint) return bcasts def win_get_interfaces():