Skip to content

Commit 06b3004

Browse files
authored
Land #18864, allias ls and dir commands inside new SMB session type prompt
2 parents a30a7f8 + 768ad16 commit 06b3004

File tree

1 file changed

+20
-0
lines changed
  • lib/rex/post/smb/ui/console/command_dispatcher

1 file changed

+20
-0
lines changed

lib/rex/post/smb/ui/console/command_dispatcher/shares.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ def commands
5555
cmds = {
5656
'shares' => 'View the available shares and interact with one',
5757
'ls' => 'List all files in the current directory',
58+
'dir' => 'List all files in the current directory (alias for ls)',
5859
'pwd' => 'Print the current remote working directory',
5960
'cd' => 'Change the current remote working directory',
6061
'cat' => 'Read the file at the given path'
@@ -181,12 +182,31 @@ def cmd_ls(*args)
181182
print_line table.to_s
182183
end
183184

185+
def cmd_ls_help
186+
print_line 'Usage:'
187+
print_line 'ls [options] [path]'
188+
print_line
189+
print_line 'COMMAND ALIASES:'
190+
print_line
191+
print_line ' dir'
192+
print_line
193+
print_line 'Lists contents of directory or file info'
194+
print_line @@ls_opts.usage
195+
end
196+
184197
def cmd_ls_tabs(_str, words)
185198
return [] if words.length > 1
186199

187200
@@ls_opts.option_keys
188201
end
189202

203+
#
204+
# Alias the ls command to dir, for those of us who have windows muscle-memory
205+
#
206+
alias cmd_dir cmd_ls
207+
alias cmd_dir_help cmd_ls_help
208+
alias cmd_dir_tabs cmd_ls_tabs
209+
190210
def cmd_pwd_help
191211
print_line 'Usage: pwd'
192212
print_line

0 commit comments

Comments
 (0)