Skip to content

Commit fb76355

Browse files
committed
Tab completion for exploit and handler commands
1 parent 68a43fe commit fb76355

File tree

4 files changed

+39
-11
lines changed

4 files changed

+39
-11
lines changed

lib/msf/ui/console/command_dispatcher/exploit.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,21 @@ def cmd_exploit(*args)
164164
end
165165
end
166166

167+
def cmd_exploit_tabs(str, words)
168+
fmt = {
169+
'-e' => [ framework.encoders.map { |refname, mod| refname } ],
170+
'-f' => [ nil ],
171+
'-h' => [ nil ],
172+
'-j' => [ nil ],
173+
'-n' => [ framework.nops.map { |refname, mod| refname } ],
174+
'-o' => [ true ],
175+
'-p' => [ framework.payloads.map { |refname, mod| refname } ],
176+
'-t' => [ true ],
177+
'-z' => [ nil ]
178+
}
179+
tab_complete_generic(fmt, str, words)
180+
end
181+
167182
alias cmd_run cmd_exploit
168183

169184
def cmd_exploit_help

lib/msf/ui/console/command_dispatcher/jobs.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,19 @@ def cmd_handler(*args)
341341

342342
print_status "Payload handler running as background job #{job_id}."
343343
end
344+
345+
def cmd_handler_tabs(str, words)
346+
fmt = {
347+
'-h' => [ nil ],
348+
'-x' => [ nil ],
349+
'-p' => [ framework.payloads.map { |refname, mod| refname } ],
350+
'-P' => [ true ],
351+
'-H' => [ :address ],
352+
'-e' => [ framework.encoders.map { |refname, mod| refname } ],
353+
'-n' => [ true ]
354+
}
355+
tab_complete_generic(fmt, str, words)
356+
end
344357
end
345358
end
346359
end

lib/msf/ui/console/command_dispatcher/payload.rb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -155,17 +155,17 @@ def cmd_generate(*args)
155155
def cmd_generate_tabs(str, words)
156156
fmt = {
157157
'-b' => [ true ],
158-
'-E' => [ nil, ],
158+
'-E' => [ nil ],
159159
'-e' => [ framework.encoders.map { |refname, mod| refname } ],
160-
'-h' => [ nil, ],
161-
'-o' => [ true, ],
162-
'-s' => [ true, ],
163-
'-f' => [ :file, ],
164-
'-t' => [ @@supported_formats, ],
165-
'-p' => [ true, ],
166-
'-k' => [ nil, ],
167-
'-x' => [ :file, ],
168-
'-i' => [ true, ]
160+
'-h' => [ nil ],
161+
'-o' => [ true ],
162+
'-s' => [ true ],
163+
'-f' => [ :file ],
164+
'-t' => [ @@supported_formats ],
165+
'-p' => [ true ],
166+
'-k' => [ nil ],
167+
'-x' => [ :file ],
168+
'-i' => [ true ]
169169
}
170170
tab_complete_generic(fmt, str, words)
171171
end

lib/rex/ui/text/dispatcher_shell.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ def tab_complete_generic(fmt, str, words)
259259

260260
tabs = []
261261
if arg.to_s.to_sym == :address
262-
tabs = tab_complete_source_addresses
262+
tabs = tab_complete_source_address
263263
elsif arg.to_s.to_sym == :bool
264264
tabs = ['true', 'false']
265265
elsif arg.to_s.to_sym == :file

0 commit comments

Comments
 (0)