Host: Add console CRAP client

This commit is contained in:
jaseg 2016-01-01 15:55:52 +01:00
parent 245fbf3d6b
commit 330e1eb20e
6 changed files with 237 additions and 192 deletions

30
host/viewer.py Executable file
View file

@ -0,0 +1,30 @@
#!/usr/bin/env python
import socket
from time import time
import sys
from contextlib import suppress
import argparse
import atexit
import config
import bdf
import crap
atexit.register(print, '\033[?1049l') # Restore normal screen buffer at exit
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('addr', default='127.0.0.1', nargs='?')
parser.add_argument('port', type=int, default=1337, nargs='?')
args = parser.parse_args()
print('\033[?1049h'+'\n'*9)
udp_server = crap.CRAPServer(args.addr, args.port, blocking=True, log=lambda *_a: None)
with suppress(KeyboardInterrupt):
for frame in udp_server:
bdf.printframe(frame)
udp_server.close()