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

Update the SMB session pwd command output to be in line with SMB client output #18905

Merged
merged 1 commit into from Mar 1, 2024

Conversation

cgranleese-r7
Copy link
Contributor

This PR updates the SMB session types pwd command to be inline with what the SMB client currently returns:

smb: \> pwd
Current directory is \\192.168.123.147\foo\

SMB session before:

msf6 auxiliary(scanner/smb/smb_login) > sessions -i -1
[*] Starting interaction with 1...

SMB (127.0.0.1\my_share\test) > pwd
\test
SMB (127.0.0.1\my_share) > cd ..
SMB (127.0.0.1\my_share) > pwd

SMB (127.0.0.1\my_share) >

SMB session output now:

msf6 auxiliary(scanner/smb/smb_login) > sessions -i -1
[*] Starting interaction with 1...

SMB (127.0.0.1\my_share\test) > pwd
Current directory is \\127.0.0.1\my_share\test\
SMB (127.0.0.1\my_share) > cd ..
SMB (127.0.0.1\my_share) > pwd
Current directory is \\127.0.0.1\my_share\
SMB (127.0.0.1\my_share) >

Verification

List the steps needed to make sure this thing works

  • Start msfconsole
  • use the smb_login module to get an SMB session
  • Interact with the SMB session
  • run pwd in various scenarios and make sure you get the expected output

@cgranleese-r7 cgranleese-r7 added the rn-enhancement release notes enhancement label Feb 29, 2024
@sjanusz-r7
Copy link
Contributor

Works well 👍

Before

SMB > pwd
[-] No active share selected. Use the shares command to view available shares, and shares -i <id> to interact with one
SMB > shares -i C$
[+] Successfully connected to C$
SMB (192.168.112.3\C$) > pwd

SMB (192.168.112.3\C$) > cd Users
SMB (192.168.112.3\C$\Users) > pwd
Users
SMB (192.168.112.3\IPC$) > shares -i ADMIN$
[+] Successfully connected to ADMIN$
SMB (192.168.112.3\ADMIN$) > pwd

SMB (192.168.112.3\ADMIN$) > shares
...

After

SMB > pwd
[-] No active share selected. Use the shares command to view available shares, and shares -i <id> to interact with one
SMB > shares -i C$
[+] Successfully connected to C$
SMB (192.168.112.3\C$) > pwd
Current directory is \\192.168.112.3\C$\
SMB (192.168.112.3\C$) > cd Users
SMB (192.168.112.3\C$\Users) > pwd
Current directory is \\192.168.112.3\C$\Users\
SMB (192.168.112.3\C$\Users) > shares -i ADMIN$
[+] Successfully connected to ADMIN$
SMB (192.168.112.3\ADMIN$) > pwd
Current directory is \\192.168.112.3\ADMIN$\
SMB (192.168.112.3\ADMIN$) > shares
...

@adfoster-r7 adfoster-r7 merged commit 8e5f26f into rapid7:master Mar 1, 2024
35 checks passed
@adfoster-r7
Copy link
Contributor

adfoster-r7 commented Mar 1, 2024

Release Notes

Improves the pwd command output for SMB sessions

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

3 participants