-
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
Builds metasploit-payload gem as part of acceptance tests #19575
Builds metasploit-payload gem as part of acceptance tests #19575
Conversation
94c84de
to
5a20fcb
Compare
5a20fcb
to
31e780b
Compare
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.
You might want to replace the run: |\n$COMMAND
pattern with run: $COMMAND
instead.
@@ -159,7 +159,7 @@ jobs: | |||
- name: Get mettle version | |||
if: ${{ matrix.meterpreter.name == 'mettle' && inputs.build_mettle }} | |||
run: | | |||
echo "METTLE_VERSION=$(grep -oh '[0-9].[0-9].[0-9]*' lib/metasploit_payloads/mettle/version.rb)" | tee -a $GITHUB_ENV | |||
echo "METTLE_VERSION=$(ruby -ne 'puts $& if /[0-9].[0-9].[0-9]*/' lib/metasploit_payloads/mettle/version.rb)" | tee -a $GITHUB_ENV |
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.
echo "METTLE_VERSION=$(ruby -ne 'puts $& if /[0-9].[0-9].[0-9]*/' lib/metasploit_payloads/mettle/version.rb)" | tee -a $GITHUB_ENV | |
echo "METTLE_VERSION=$(ruby -ne 'puts $& if /[0-9][.][0-9][.][0-9]*/' lib/metasploit_payloads/mettle/version.rb)" | tee -a $GITHUB_ENV |
Otherwise, .
will match any character.
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.
@cgranleese-r7 It'd be worth verifying that the old/new regexes supports multiple digit releases too, i.e. 1.10.0
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.
Hopefully this link works - https://regex101.com/r/W8QwSG/1
I looked at this again this morning and @adfoster-r7 was right, it wasn't matching 1.10.0
. So I have landed on the following regex, which seems to cover everything I need 🤞:
\d+\.?(\*|\d+\.)?(\*|\d+)
This will match:
- 1.1
- 11.1
- 1.11
- 11.11
- 111.111.1
- 111.111.111
- 1.0.0
- 1.1.0
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.
It might be more future proof things to use:
ruby -ne "puts Regexp.last_match(1) if /VERSION\s+=\s+'([^']+)'/" lib/metasploit_payloads/mettle/version.rb
That way you'll be able to handle words etc in releases, such as VERSION = '1.11.0.beta1'
etc
8dc0883
to
a349615
Compare
- name: Get metasploit-payloads version | ||
if: ${{ inputs.build_metasploit_payloads && matrix.meterpreter.name != 'mettle' }} | ||
shell: bash | ||
run: echo "METASPLOIT_PAYLOADS_VERSION=$(ruby -ne 'puts Regexp.last_match(1) if /VERSION\s+=\s+'([^']+)'/' gem/lib/metasploit-payloads/version.rb)" | tee -a $GITHUB_ENV |
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.
The quote handling here needs some extra cycles to work 👍
959fbfb
to
0fca57d
Compare
0fca57d
to
86f9554
Compare
This PR adds support for metasploit-payloads gem being built as part of the acceptance testing. Continuation off #19564.
Verification
payload-testing-branch
andpayload-testing-mettle-branch
labels applied, ensure those jobs build the appropriate gems as part of the workflows