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

Updates new sessions to have a consistent local file system API #18926

Conversation

cgranleese-r7
Copy link
Contributor

@cgranleese-r7 cgranleese-r7 commented Mar 6, 2024

This PR takes existing local file system functions from lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/fs.rb and create a new mixin in order to make these reusable so that we can include them in our new SMB, and all the SQL session types.

Local fs commands:

          'getlwd' => 'Print local working directory (alias for lpwd)',
          'lcat' => 'Read the contents of a local file to the screen',
          'lcd' => 'Change local working directory',
          'lmkdir' => 'Create new directory on local machine',
          'lpwd' => 'Print local working directory',
          'lls' => 'List local files',
          'ldir' => 'List local files (alias for lls)'

Verification

  • Start msfconsole
  • Ensure you have the features set for the new session types - features set <session type> true
  • Get a session for Meterpreter, MySQL, MSSQL, PostgreSQL and SMB - mysql_login, mssql_login, postgres_login and smb_login
  • Verify Meterpreter works the same as on master
  • Verify the new session type work with the new local file system commands
  • Verify code changes are sane

@cgranleese-r7 cgranleese-r7 added the rn-enhancement release notes enhancement label Mar 6, 2024
@cgranleese-r7 cgranleese-r7 changed the title Updates new sessions to have a consistent local fs API Updates new sessions to have a consistent local file system API Mar 6, 2024
# This module provides commands for the local file system
#
###
module LocalFs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
module LocalFs
module LocalFileSystem

Not a blocker, as I know it's consistent with meterpreter's fs

#
# @param [Array] args
# @return [TrueClass]
def cmd_lcat(*args)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not a blocker; we're missing help commands for some of these

postgresql @ 127.0.0.1:9000 (template1) > help lcat
[-] No help for lcat, try -h

lib/rex/post/postgresql/ui/console.rb Outdated Show resolved Hide resolved
@cgranleese-r7 cgranleese-r7 force-pushed the update-new-sessions-to-have-consistent-local-fs-api branch from 19bd907 to a9c013c Compare March 6, 2024 15:46
@cgranleese-r7 cgranleese-r7 force-pushed the update-new-sessions-to-have-consistent-local-fs-api branch from a9c013c to 64831b6 Compare March 6, 2024 15:52
@adfoster-r7 adfoster-r7 merged commit a3a331a into rapid7:master Mar 6, 2024
33 of 34 checks passed
@adfoster-r7
Copy link
Contributor

Release Notes

Update sessions to have a consistent set of local file system commands

@cgranleese-r7 cgranleese-r7 deleted the update-new-sessions-to-have-consistent-local-fs-api branch March 6, 2024 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rn-enhancement release notes enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants