Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alias ls and dir commands inside new SMB session type prompt #18864

Merged

Conversation

cgranleese-r7
Copy link
Contributor

@cgranleese-r7 cgranleese-r7 commented Feb 20, 2024

This PR adds support for aliasing the ls and dir commands. In aims to improve workflows for those who have windows muscle-memory.

I also spotted an issue when running the ls -h command which return an error:

SMB (192.168.175.193\my_share) > ls -h
[-] Error running command ls: NameError undefined local variable or method `cmd_ls_help' for #<Rex::Post::SMB::Ui::Console::CommandDispatcher::Shares:0x00007fbb9e12d750 @shell=#
...
Did you mean?  cmd_bg_help
               cmd_cd_help
               cmd_help
               cmd_pry_help
               cmd_irb_help
               cmd_cat_help
               cmd_pwd_help
               cmd_help_help

So I added what I believed was required and tested it and it seems to now be working as intended.

Verification

List the steps needed to make sure this thing works

  • Start msfconsole
  • Get a SMB session via the smb_login module
  • Use a share via the following command: shares -i <share name here>
  • Verify the dir and ls commands now both work
  • Verify the dir -h and ls -h commands now both work
  • Verify the help dir and help ls commands now both work
  • Verify the tab completion for both dir and ls works as expected

@cgranleese-r7 cgranleese-r7 force-pushed the alias-dir-ls-smb-session-type branch 4 times, most recently from 4259039 to 2afcaf1 Compare February 20, 2024 14:02
@adfoster-r7 adfoster-r7 merged commit 06b3004 into rapid7:master Feb 20, 2024
35 checks passed
@adfoster-r7
Copy link
Contributor

adfoster-r7 commented Feb 20, 2024

Release Notes

Adds an alias for ls and dir inside SMB sessions

@cgranleese-r7 cgranleese-r7 deleted the alias-dir-ls-smb-session-type branch February 21, 2024 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement rn-enhancement release notes enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants