From fcd4e62f4a2a42205e08ba850e9ab693febbf577 Mon Sep 17 00:00:00 2001
From: Symphorien Gibol <symphorien.gibol@gmail.com>
Date: Fri, 20 May 2016 15:30:27 +0200
Subject: [PATCH] =?UTF-8?q?survivre=20aux=20sms=20malform=C3=A9s?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 tunmgr/tunmgr.py | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/tunmgr/tunmgr.py b/tunmgr/tunmgr.py
index 2ae4008..017f31b 100755
--- a/tunmgr/tunmgr.py
+++ b/tunmgr/tunmgr.py
@@ -5,6 +5,7 @@ import selectors
 import socket
 import sys
 import base64
+import traceback
 
 tun = TunTapDevice()
 
@@ -29,12 +30,15 @@ sel.register(s, selectors.EVENT_READ, "sms")
 
 while 1:
     for key, events in sel.select():
-        if key.data=="tun":
-            print("tun")
-            s.sendto(base64.b64encode(tun.read(tun.mtu)), (PEER, PORT))
-        elif key.data == "sms":
-            print("sms")
-            tun.write(base64.b64decode(s.recv(tun.mtu*4))+b"\n")
+        try:
+            if key.data=="tun":
+                print("tun")
+                s.sendto(base64.b64encode(tun.read(tun.mtu)), (PEER, PORT))
+            elif key.data == "sms":
+                print("sms")
+                tun.write(base64.b64decode(s.recv(tun.mtu*4))+b"\n")
+        except Exception:
+            traceback.print_exc()
             
 
 
-- 
GitLab