blob: 986296116d2695474672bff60c004c8f16dc3d05 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#!/usr/bin/env python
import argparse
import atexit
from contextlib import suppress
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):
while True:
for _title, frame in udp_server:
bdf.printframe(frame)
udp_server.close()
|