Skip to content
This repository was archived by the owner on Oct 22, 2020. It is now read-only.

Commit b6336e4

Browse files
committed
Add exploits and auxiliary args to the show command
1 parent 4ea510f commit b6336e4

File tree

3 files changed

+37
-11
lines changed

3 files changed

+37
-11
lines changed

lib/cli/auto_complete.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,12 @@ def build_cmd_list
4141
permitted_commands.each { |c| cmds[c] = {} }
4242
Wpxf::Auxiliary.module_list.each { |m| cmds['use'][m] = {} }
4343
Wpxf::Exploit.module_list.each { |m| cmds['use'][m] = {} }
44-
cmds['show'] = { 'options' => {}, 'advanced' => {} }
44+
cmds['show'] = {
45+
'options' => {},
46+
'advanced' => {},
47+
'exploits' => {},
48+
'auxiliary' => {}
49+
}
4550
cmds
4651
end
4752

lib/cli/help.rb

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,28 @@ def show_advanced_options
5252
end
5353
end
5454

55+
def show_exploits
56+
results = search_modules(['exploit/'])
57+
print_good "#{results.length} Exploits"
58+
print_module_table results
59+
end
60+
61+
def show_auxiliary
62+
results = search_modules(['auxiliary/'])
63+
print_good "#{results.length} Auxiliary Modules"
64+
print_module_table results
65+
end
66+
5567
def show(target)
56-
if target.eql?('options')
57-
show_options
58-
elsif target.eql?('advanced')
59-
show_advanced_options
68+
handlers = {
69+
'options' => 'show_options',
70+
'advanced' => 'show_advanced_options',
71+
'exploits' => 'show_exploits',
72+
'auxiliary' => 'show_auxiliary'
73+
}
74+
75+
if handlers[target]
76+
send(handlers[target])
6077
else
6178
print_bad("\"#{target}\" is not a valid argument")
6279
end

lib/cli/modules.rb

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,21 @@ def search_modules(args)
5454
results
5555
end
5656

57+
def print_module_table(modules)
58+
modules = modules.sort_by { |k| k[:path] }
59+
modules.unshift(path: 'Module', title: 'Title')
60+
puts
61+
indent_cursor 2 do
62+
print_table(modules)
63+
end
64+
end
65+
5766
def search(*args)
5867
results = search_modules(args)
5968

6069
if !results.empty?
6170
print_good "#{results.length} Results for \"#{args.join(' ')}\""
62-
results = results.sort_by { |k| k[:path] }
63-
results.unshift(path: 'Module', title: 'Title')
64-
puts
65-
indent_cursor 2 do
66-
print_table(results)
67-
end
71+
print_module_table results
6872
else
6973
print_bad "No results for \"#{args.join(' ')}\""
7074
end

0 commit comments

Comments
 (0)