-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
Adds pattern to catch other arch and platform values #19125
Merged
adfoster-r7
merged 1 commit into
rapid7:master
from
zgoldman-r7:mssql-arch-detection-default-matching
May 3, 2024
Merged
Adds pattern to catch other arch and platform values #19125
adfoster-r7
merged 1 commit into
rapid7:master
from
zgoldman-r7:mssql-arch-detection-default-matching
May 3, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Looks like the PR needs a rebase on master |
zgoldman-r7
force-pushed
the
mssql-arch-detection-default-matching
branch
from
April 23, 2024 19:25
528ad85
to
b11a712
Compare
zgoldman-r7
force-pushed
the
mssql-arch-detection-default-matching
branch
from
May 1, 2024 23:58
b11a712
to
434d9c2
Compare
adfoster-r7
reviewed
May 2, 2024
lib/rex/proto/mssql/client.rb
Outdated
@@ -116,9 +116,20 @@ def detect_platform_and_arch | |||
result = {} | |||
|
|||
server_vars = query('select @@version')[:rows][0][0] | |||
if server_vars.match?(/\b\d+\.\d+\.\d+\.\d+\s\(([^)]*)\)/) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can use capture groups similar to:
query_result = query('select version()').rows.join.match(/on (?<architecture>\w+)-\w+-(?<platform>\w+)/) |
Or you can pluck out the values directly
server_vars = query('select @@version')[:rows][0][0]
architecture = server_vars[/\b\d+\.\d+\.\d+\.\d+\s\(([^)]*)\)/, 1]
But named capture groups seems legit
zgoldman-r7
force-pushed
the
mssql-arch-detection-default-matching
branch
from
May 2, 2024 19:39
434d9c2
to
fa6ce27
Compare
adfoster-r7
reviewed
May 3, 2024
adfoster-r7
reviewed
May 3, 2024
zgoldman-r7
force-pushed
the
mssql-arch-detection-default-matching
branch
from
May 3, 2024 12:05
fa6ce27
to
6547fdb
Compare
Release NotesUpdates mssql platform/arch fingerprinting to be more resilient |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We noticed that thte mssql platform/arch detection would return the full
@@version
query result for both arch and platform, and have a very noisy result:To test this, I'm not sure how to actually return a string that doesn't match the existing patterns, but just create a session (
mssql_login
createsession=true
), and list themsessions
and make sure the arch/platform looks right. You can also pry in to the method and change the string, or just make sure the tests actually look good & add/suggest more if it's not covered.