From 959123381a53f27c9ffb15c0fcec75ae295f0ca6 Mon Sep 17 00:00:00 2001 From: sjanusz-r7 Date: Tue, 20 Aug 2024 11:02:30 +0100 Subject: [PATCH] Add Reline autocompletion prompt behind a feature flag --- lib/msf/core/feature_manager.rb | 8 ++++++++ lib/rex/ui/text/shell.rb | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/lib/msf/core/feature_manager.rb b/lib/msf/core/feature_manager.rb index 3ab3865ae771e..a3309618775b2 100644 --- a/lib/msf/core/feature_manager.rb +++ b/lib/msf/core/feature_manager.rb @@ -28,6 +28,7 @@ class FeatureManager MSSQL_SESSION_TYPE = 'mssql_session_type' LDAP_SESSION_TYPE = 'ldap_session_type' SHOW_SUCCESSFUL_LOGINS = 'show_successful_logins' + SHOW_AUTOCOMPLETION_PROMPT = 'show_autocompletion_prompt' DEFAULTS = [ { @@ -124,6 +125,13 @@ class FeatureManager requires_restart: false, default_value: true, developer_notes: 'Enabled in Metasploit 6.4.x' + }.freeze, + { + name: SHOW_AUTOCOMPLETION_PROMPT, + description: 'When enabled, an autocompletion prompt will be shown when typing in commands', + requires_restart: true, + default_value: false, + developer_notes: 'To be enabled once the Readline to Reline upgrade has been confirmed to not cause issues' }.freeze ].freeze diff --git a/lib/rex/ui/text/shell.rb b/lib/rex/ui/text/shell.rb index 69edf50214bdb..44724bfbd4a9b 100644 --- a/lib/rex/ui/text/shell.rb +++ b/lib/rex/ui/text/shell.rb @@ -133,6 +133,10 @@ def run(&block) # Pry is a development dependency, if not available suppressing history_load can be safely ignored. end + if framework.features.enabled?(Msf::FeatureManager::SHOW_AUTOCOMPLETION_PROMPT) + Reline.autocompletion = true + end + with_history_manager_context do begin while true