Skip to content

Commit caf79d8

Browse files
committed
Add a basic theme to make it look more integrated
1 parent ae26319 commit caf79d8

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

plugins/fzuse.rb

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,24 @@ class Plugin::FuzzyUse < Msf::Plugin
3232
class ConsoleCommandDispatcher
3333
include Msf::Ui::Console::CommandDispatcher
3434

35+
FZF_THEME = {
36+
'fg' => '-1',
37+
'fg+' => 'white:regular:bold',
38+
'bg' => '-1',
39+
'bg+' => '-1',
40+
'hl' => '-1',
41+
'hl+' => 'red:regular:bold',
42+
'info' => '-1',
43+
'marker' => '-1',
44+
'prompt' => '-1',
45+
'spinner' => '-1',
46+
'pointer' => 'blue:bold',
47+
'header' => '-1',
48+
'border' => '-1',
49+
'label' => '-1',
50+
'query' => '-1'
51+
}.freeze
52+
3553
def initialize(driver)
3654
super
3755

@@ -92,7 +110,8 @@ def cmd_fzuse(*args)
92110
query = args.empty? ? '' : args.first
93111
ruby = RbConfig::CONFIG['bindir'] + '/' + RbConfig::CONFIG['ruby_install_name'] + RbConfig::CONFIG['EXEEXT']
94112

95-
Open3.popen3('fzf', '--select-1', '--query', query, '--preview', "'#{ruby}' '#{__FILE__}' '#{socket_path}' '{1}'", '--preview-label', "Module Information") do |stdin, stdout, stderr, wait_thr|
113+
color = "--color=#{FZF_THEME.map { |key, value| "#{key}:#{value}" }.join(',')}"
114+
Open3.popen3('fzf', '--select-1', '--query', query, '--pointer=->', color, '--preview', "'#{ruby}' '#{__FILE__}' '#{socket_path}' '{1}'", '--preview-label', "Module Information") do |stdin, stdout, stderr, wait_thr|
96115
framework.modules.module_types.each do |module_type|
97116
framework.modules.module_names(module_type).each do |module_name|
98117
stdin.puts "#{module_type}/#{module_name}"

0 commit comments

Comments
 (0)