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

Expose MSSQL initial connection info in client #18863

Merged
merged 1 commit into from Feb 20, 2024

Conversation

sjanusz-r7
Copy link
Contributor

@sjanusz-r7 sjanusz-r7 commented Feb 19, 2024

This PR adds in the ENVCHANGE types to the MSSQL client mixin, and uses those to fetch the initial DB name received from the server. This data is stored as the initial_connection_info.
The prompt still calls off to def format_prompt(val) -> database_name -> session.client.mssql_query('SELECT DB_NAME();')[:rows][0][0], but this will be changed in a future PR that will ensure all SQL session prompts are updated when the user connects to a different database using query.

For context, this initial_connection_info has previously been discussed here: #18747 (comment)

Verification

  • Start msfconsole
  • use mssql_login
  • Get a session
  • Ensure the prompt contains the correct value

@sjanusz-r7 sjanusz-r7 force-pushed the mssql-get-db-from-server branch 2 times, most recently from aecb5de to 814cc81 Compare February 19, 2024 16:13
@cgranleese-r7 cgranleese-r7 self-assigned this Feb 20, 2024
@cgranleese-r7 cgranleese-r7 added enhancement rn-enhancement release notes enhancement labels Feb 20, 2024
@adfoster-r7 adfoster-r7 changed the title Exponse MSSQL initial connection info in client Expose MSSQL initial connection info in client Feb 20, 2024
@sjanusz-r7 sjanusz-r7 force-pushed the mssql-get-db-from-server branch 2 times, most recently from 33c3e7e to 48e749a Compare February 20, 2024 10:47
@cgranleese-r7
Copy link
Contributor

Docker - mcr.microsoft.com/mssql/server:2022-preview-ubuntu-22.04

image

Windows

image

Copy link
Contributor

@cgranleese-r7 cgranleese-r7 left a comment

Choose a reason for hiding this comment

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

Looks good to me 👍

@cgranleese-r7 cgranleese-r7 merged commit 4fcb4a4 into rapid7:master Feb 20, 2024
35 checks passed
@cgranleese-r7
Copy link
Contributor

Release Notes

This PR adds in the ENVCHANGE types to the MSSQL client mixin, and uses those to fetch the initial DB name received from the server.

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

3 participants