fix shell history

This commit is contained in:
n1nj4sec 2022-11-08 10:48:01 +01:00
parent 2f558cd626
commit 12e8e1b1c4
3 changed files with 5 additions and 2 deletions

View File

@ -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

View File

@ -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
))

View File

@ -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: