Skip to content
Snippets Groups Projects
Commit dfee2974 authored by Symphorien Gibol's avatar Symphorien Gibol
Browse files

base64

parent f8d7b393
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,7 @@ from pytun import TunTapDevice
import selectors
import socket
import sys
import base64
tun = TunTapDevice()
......@@ -11,7 +12,7 @@ tun = TunTapDevice()
tun.addr = '10.8.0.1'
tun.dstaddr = '10.8.0.2'
tun.netmask = '255.255.255.0'
tun.mtu = 400
tun.mtu = 100
tun.up()
......@@ -30,10 +31,10 @@ while 1:
for key, events in sel.select():
if key.data=="tun":
print("tun")
s.sendto(tun.read(tun.mtu), (PEER, PORT))
s.sendto(base64.b64encode(tun.read(tun.mtu)), (PEER, PORT))
elif key.data == "sms":
print("sms")
tun.write(s.recv(tun.mtu))
tun.write(base64.b64decode(s.recv(tun.mtu*4)))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment