From 848811e24717126973d0370afdd4ad32fc1e6480 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 872087c35049..0c904a661a21 100644 --- a/lib/msf/core/feature_manager.rb +++ b/lib/msf/core/feature_manager.rb @@ -29,6 +29,7 @@ class FeatureManager LDAP_SESSION_TYPE = 'ldap_session_type' SHOW_SUCCESSFUL_LOGINS = 'show_successful_logins' DISPLAY_MODULE_ACTION = 'display_module_action' + SHOW_AUTOCOMPLETION_PROMPT = 'show_autocompletion_prompt' DEFAULTS = [ { @@ -132,6 +133,13 @@ class FeatureManager requires_restart: false, default_value: true, developer_notes: 'Added as a feature so users can turn it off if they wish to reduce clutter in their terminal' + }.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 56a323c5bfac..fa7972e3620b 100644 --- a/lib/rex/ui/text/shell.rb +++ b/lib/rex/ui/text/shell.rb @@ -130,6 +130,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