diff options
author | Papoteur <papoteur@mageia.org> | 2020-05-31 12:15:29 +0200 |
---|---|---|
committer | Papoteur <papoteur@mageia.org> | 2020-05-31 12:15:29 +0200 |
commit | 42d7135849a9069b2e04f3107ca2bda9b53d103a (patch) | |
tree | 36c3aa6f659d2cb5975169c625764d16cb19aa90 /src/monitor.py | |
parent | fbe6a0a6793b736aedb44182008586d17b5b4f94 (diff) | |
download | net_monitor-42d7135849a9069b2e04f3107ca2bda9b53d103a.tar net_monitor-42d7135849a9069b2e04f3107ca2bda9b53d103a.tar.gz net_monitor-42d7135849a9069b2e04f3107ca2bda9b53d103a.tar.bz2 net_monitor-42d7135849a9069b2e04f3107ca2bda9b53d103a.tar.xz net_monitor-42d7135849a9069b2e04f3107ca2bda9b53d103a.zip |
Add checking of present protocols, to avoid exception.
Diffstat (limited to 'src/monitor.py')
-rw-r--r-- | src/monitor.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/monitor.py b/src/monitor.py index e7a3c12..3198b78 100644 --- a/src/monitor.py +++ b/src/monitor.py @@ -328,6 +328,13 @@ class Monitor: pass return routes, default_routes + def protocols_list(self): + protos = [] + for proto in ["tcp", "tcp6", "udp", "udp6"]: + if os.path.exists("/proc/net/%s" % proto): + protos.append(proto) + return protos + def get_connections(self, proto="tcp"): """Reads active connections""" connections=[] |