From 12e8e1b1c4e5747360bc51560c8cbe7e6b14ed98 Mon Sep 17 00:00:00 2001 From: n1nj4sec Date: Tue, 8 Nov 2022 10:48:01 +0100 Subject: [PATCH] fix shell history --- pupy/conf/pupy.conf.default | 1 + pupy/network/lib/transports/websocket.py | 2 +- pupy/pupylib/PupyCmd.py | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pupy/conf/pupy.conf.default b/pupy/conf/pupy.conf.default index 88a87f5b..820a378e 100644 --- a/pupy/conf/pupy.conf.default +++ b/pupy/conf/pupy.conf.default @@ -119,6 +119,7 @@ display_banner = yes colors = yes #If 'shadow_screen = no', this can fix some scrollback issues in some terminals (e.g. Terminator) shadow_screen = no +history_size = 10000 [paths] prefer_workdir = no diff --git a/pupy/network/lib/transports/websocket.py b/pupy/network/lib/transports/websocket.py index 6c0cf0c2..00af0b76 100644 --- a/pupy/network/lib/transports/websocket.py +++ b/pupy/network/lib/transports/websocket.py @@ -48,7 +48,7 @@ error_response = b'\r\n'.join(( b'Server: Apache', b'Content-Type: text/html; charset=utf-8', b'Content-Length: %d' % len(error_response_body), - b'\r\n', + b'', error_response_body )) diff --git a/pupy/pupylib/PupyCmd.py b/pupy/pupylib/PupyCmd.py index 79006625..e833e39e 100644 --- a/pupy/pupylib/PupyCmd.py +++ b/pupy/pupylib/PupyCmd.py @@ -467,6 +467,8 @@ class PupyCmd(cmd.Cmd): self.display_lock = Lock() + self.history_file = self.config.get_path("history") + self.init_readline() self._intro = [ @@ -478,7 +480,6 @@ class PupyCmd(cmd.Cmd): self.prompt = colorize('>> ', 'blue', prompt=True) self.default_filter = None - self.history_file = self.config.get_path("history") try: if not self.config.getboolean('cmdline', 'display_banner'): @@ -589,6 +590,7 @@ class PupyCmd(cmd.Cmd): return True def init_readline(self): + readline.set_history_length(self.config.getint('cmdline', 'history_size', fallback=10000)) try: readline.read_history_file(self.history_file) except Exception: