Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Reline autocomplete prompt behind feature flag #19403

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/msf/core/feature_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem like the right feature flag name; maybe we just name it what it is:

Suggested change
SHOW_AUTOCOMPLETION_PROMPT = 'show_autocompletion_prompt'
USE_RELINE = 'use_reline'

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also happy with other names, but show_autocompletion_prompt isn't what this PR does anymore I don't think 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the other cherry-picked commit. The PR now does what it says, but I will need to circle back to it after the Reline library has been merged. Leaving it as draft for now 👍


DEFAULTS = [
{
Expand Down Expand Up @@ -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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this could be false if we update def set(name, value) to have a set-effect like it does for wrapped tables

default_value: false,
developer_notes: 'To be enabled once the Readline to Reline upgrade has been confirmed to not cause issues'
}.freeze
].freeze

Expand Down
4 changes: 4 additions & 0 deletions lib/rex/ui/text/shell.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down