diff options
author | antialias <antialias@leap.se> | 2012-11-16 17:38:46 -0800 |
---|---|---|
committer | kali <kali@leap.se> | 2013-01-15 22:42:17 +0900 |
commit | 348eb0852d6f1b8b2b72baba8a236bc30a6f2a4e (patch) | |
tree | 9ca25989e77ff353dd784ddb1e2f1c3e30534785 /src | |
parent | f90f9df1d09e12ba64e9401530684d5a36220ad3 (diff) |
reads and searches for strings from openvpn logs via the management interface.
Diffstat (limited to 'src')
-rw-r--r-- | src/leap/base/network.py | 9 | ||||
-rw-r--r-- | src/leap/baseapp/eip.py | 4 | ||||
-rw-r--r-- | src/leap/eip/openvpnconnection.py | 4 |
3 files changed, 17 insertions, 0 deletions
diff --git a/src/leap/base/network.py b/src/leap/base/network.py index 765d8ea0..bd8f15c7 100644 --- a/src/leap/base/network.py +++ b/src/leap/base/network.py @@ -14,6 +14,9 @@ from time import sleep logger = logging.getLogger(name=__name__) +#EVENTS OF NOTE +EVENT_CONNECT_REFUSED = "[ECONNREFUSED]: Connection refused (code=111)" + class NetworkCheckerThread(object): """ @@ -54,6 +57,12 @@ class NetworkCheckerThread(object): def run_checks(self): pass + def parse_log(self, log): + for line in log: + if EVENT_CONNECT_REFUSED in line: + #fire cb to stop openvpn server + pass + #private methods #here all the observers in fail_callbacks expect one positional argument, diff --git a/src/leap/baseapp/eip.py b/src/leap/baseapp/eip.py index 41f4c541..f18a62e7 100644 --- a/src/leap/baseapp/eip.py +++ b/src/leap/baseapp/eip.py @@ -174,6 +174,10 @@ class EIPConductorAppMixin(object): self.tun_read_bytes.setText(tun_read) self.tun_write_bytes.setText(tun_write) + # connection information via management interface + log = self.conductor.get_log() + self.network_checker.parse_log(log) + @QtCore.pyqtSlot() def start_or_stopVPN(self): """ diff --git a/src/leap/eip/openvpnconnection.py b/src/leap/eip/openvpnconnection.py index b36b0b16..233b9da3 100644 --- a/src/leap/eip/openvpnconnection.py +++ b/src/leap/eip/openvpnconnection.py @@ -400,3 +400,7 @@ to be triggered for each one of them. if process.name == "openvpn": return process return None + + def get_log(self, lines=1): + log = self._send_command("log %s" % lines) + return log |