From f8780fef2ee40ef241d3ef09b7788ec14c4a0192 Mon Sep 17 00:00:00 2001 From: ed Date: Sat, 30 Mar 2024 01:00:24 +0000 Subject: [PATCH] revision: proxy support, and map the delete-key * option to specify list of known proxy IPs; any connections coming from these IPs will be forced through the config wizard, to avoid mixing up client configs * the delete-key now works as expected in most clients --- r0c/__main__.py | 3 +++ r0c/ivt100.py | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/r0c/__main__.py b/r0c/__main__.py index 37664f0..55cb450 100644 --- a/r0c/__main__.py +++ b/r0c/__main__.py @@ -49,6 +49,7 @@ def optgen(ap, pwd): ac.add_argument("-pw", metavar="PWD", type=u, default=pwd, help="admin password") ac.add_argument("--ara", action="store_true", help="admin-access requires auth (even for localhost)") ac.add_argument("--nsalt", metavar="TXT", type=u, default="lammo/", help="salt for generated nicknames based on IP") + ac.add_argument("--proxy", metavar="A,A", type=u, default="", help="comma-sep. list of IPs which are relays to disable config persistence on") ac = ap.add_argument_group("logging") ac.add_argument("--log-rx", action="store_true", help="log incoming traffic from clients") @@ -197,6 +198,8 @@ class Core(object): rap = run_ap ar = self.ar = rap(argv, pwd) # type: argparse.Namespace + ar.proxy = ar.proxy.split(",") + Util.HEX_WIDTH = ar.hex_w Itelnet.init(ar) diff --git a/r0c/ivt100.py b/r0c/ivt100.py index 9c64524..f5caf10 100644 --- a/r0c/ivt100.py +++ b/r0c/ivt100.py @@ -485,6 +485,9 @@ class VT100_Client(object): self.user.admin = self.adr[0] == "127.0.0.1" and not self.ar.ara try: + if self.adr[0] in self.ar.proxy: + raise Exception() + ( ts, nick, @@ -2884,6 +2887,16 @@ class VT100_Client(object): self.user.exec_cmd("a") elif act == "tab": self.tabcomplete() + elif act == "del": + self.linepos += 1 + if self.linepos > len(self.linebuf): + self.linepos = len(self.linebuf) + if self.linepos > 0: + self.linebuf = ( + self.linebuf[: self.linepos - 1] + + self.linebuf[self.linepos :] + ) + self.linepos -= 1 else: print("unimplemented action: {0}".format(act))