def show_connections():
"""Get list of network connections"""
connections = subprocess.check_output(
"/usr/share/harbour-infraview/helper/infraview-helper",
shell=True)
dlist = []
netstat_keys = [
"udp_tcp",
"ConnID",
"UID",
"localhost",
"localport",
"remotehost",
"remoteport",
"conn_state",
"pid",
"exe_name"]
for line in connections.splitlines():
x = ast.literal_eval(line.decode("utf-8"))
key_value = zip(netstat_keys, x)
key_value_dict = dict(key_value)
dlist.append(dict(key_value_dict))
return dlist
评论列表
文章目录