Skip to content

Commit

Permalink
Alias ls and dir inside new smb session type prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
cgranleese-r7 committed Feb 20, 2024
1 parent a3d8b0f commit 92d1bec
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions lib/rex/post/smb/ui/console/command_dispatcher/shares.rb
Expand Up @@ -55,6 +55,7 @@ def commands
cmds = {
'shares' => 'View the available shares and interact with one',
'ls' => 'List all files in the current directory',
'dir' => 'List all files in the current directory (alias for ls)',
'pwd' => 'Print the current remote working directory',
'cd' => 'Change the current remote working directory',
'cat' => 'Read the file at the given path'
Expand Down Expand Up @@ -181,12 +182,31 @@ def cmd_ls(*args)
print_line table.to_s
end

#
# Alias the ls command to dir, for those of us who have windows muscle-memory
#
alias cmd_dir cmd_ls

def cmd_ls_help
print_line 'Usage:'
print_line 'ls [options] [glob/path]'
print_line
print_line 'COMMAND ALIASES:'
print_line
print_line ' dir'
print_line
print_line 'Lists contents of directory or file info, searchable'
print_line @@ls_opts.usage
end

def cmd_ls_tabs(_str, words)
return [] if words.length > 1

@@ls_opts.option_keys
end

alias cmd_dir_tabs cmd_ls_tabs

def cmd_pwd_help
print_line 'Usage: pwd'
print_line
Expand Down

0 comments on commit 92d1bec

Please sign in to comment.