Skip to content

Commit 103451d

Browse files
authored
Compile with Ruby 3.2.5 (#219)
* Compile with Ruby 3.2.5 * Remove fiddle for windows * Test windows artifacts
1 parent 6ea9624 commit 103451d

File tree

10 files changed

+227
-75
lines changed

10 files changed

+227
-75
lines changed

Diff for: .github/workflows/verify.yml

+98-39
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ jobs:
295295
os:
296296
- macos-13
297297
ruby:
298-
- 3.0.6
298+
- 3.2.5
299299

300300
name: ${{ matrix.os }}
301301
steps:
@@ -368,9 +368,9 @@ jobs:
368368
os:
369369
- windows-2022
370370
ruby:
371-
- 3.0.6
371+
- 3.2.5
372372

373-
name: ${{ matrix.os }}
373+
name: ${{ matrix.os }} compilation
374374
steps:
375375
# https://github.com/actions/runner-images/issues/5143
376376
# https://github.com/actions/runner-images/issues/9701
@@ -393,6 +393,12 @@ jobs:
393393
submodules: true
394394
path: metasploit-omnibus
395395

396+
- name: Update bundler version
397+
# Github actions with Ruby requires Bundler 2.2.18+
398+
# https://github.com/ruby/setup-ruby/tree/d2b39ad0b52eca07d23f3aa14fdf2a3fcc1f411c#windows
399+
run: |
400+
(Get-Content metasploit-omnibus\Gemfile.lock).Replace(' 2.2.33', ' 2.5.10') | Set-Content metasploit-omnibus\Gemfile.lock
401+
396402
- name: Setup Ruby
397403
env:
398404
BUNDLE_FORCE_RUBY_PLATFORM: true
@@ -404,7 +410,7 @@ jobs:
404410
working-directory: metasploit-omnibus
405411
# Github actions with Ruby requires Bundler 2.2.18+
406412
# https://github.com/ruby/setup-ruby/tree/d2b39ad0b52eca07d23f3aa14fdf2a3fcc1f411c#windows
407-
bundler: 2.2.33
413+
bundler: 2.5.10
408414

409415
# If you need to build a custom version of pcaprub:
410416
# - name: Checkout pcaprub
@@ -445,41 +451,6 @@ jobs:
445451
rem and the ridk.cmd Ruby installer will forcibly kill the msys2 process before attempting to install ruby
446452
ruby bin/omnibus build metasploit-framework
447453
448-
# Currently hangs on Github actions - but passes locally, potential cause within the debug.log file:
449-
#
450-
# Info 1603.The file C:\Windows\system32\vcruntime140_1.dll is being held in use. Close that application and retry.
451-
#
452-
# - name: Test artifact
453-
# shell: pwsh
454-
# run: |
455-
# Set-PSDebug -Trace 1
456-
# echo "Testing artifact"
457-
458-
# Remove-Item c:\metasploit-framework -Recurse -ErrorAction Ignore
459-
460-
# dir metasploit-omnibus\pkg
461-
462-
# echo '' > debug.log
463-
# $artifact = (Get-ChildItem -Path "metasploit-omnibus/pkg/*.msi")[0].Name
464-
# $install_process = Start-Process msiexec.exe -ArgumentList "/i metasploit-omnibus\pkg\$artifact /quiet /qn /l*v debug.log" -NoNewWindow -PassThru
465-
# $log_process = Start-Process "powershell" "Get-Content -Path debug.log -Wait" -NoNewWindow -PassThru
466-
# $install_process.WaitForExit()
467-
# $log_process.Kill()
468-
# echo "finished install"
469-
470-
# c:\metasploit-framework\bin\msfconsole -qx 'setg variable test; version; exit'
471-
# c:\metasploit-framework\bin\msfvenom -p windows/meterpreter/reverse_tcp -f exe -o test.exe
472-
# c:\metasploit-framework\bin\msfd -h
473-
# c:\metasploit-framework\bin\msfrpc -h
474-
# c:\metasploit-framework\bin\msfrpcd -h
475-
# c:\metasploit-framework\bin\msfdb -h
476-
# c:\metasploit-framework\bin\msfbinscan -h
477-
# c:\metasploit-framework\bin\msfrop -h
478-
# c:\metasploit-framework\bin\msfelfscan -h
479-
# c:\metasploit-framework\bin\msfmachscan -h
480-
# c:\metasploit-framework\bin\msfpescan -h
481-
# c:\metasploit-framework\bin\msfupdate
482-
483454
- name: Upload artifact
484455
uses: actions/upload-artifact@v4
485456
with:
@@ -490,3 +461,91 @@ jobs:
490461
metasploit-omnibus/pkg/*.msi
491462
metasploit-omnibus/pkg/*.deb
492463
retention-days: 1
464+
465+
# Ensure we can install the Windows installer on a fresh environment without any pre-existing dependencies.
466+
# Additionally, running on the previous windows builder is not currently possible, as it currently hangs on
467+
# on Github actions - but passes locally. The potential cause is logged to the debug.log file:
468+
#
469+
# Info 1603.The file C:\Windows\system32\vcruntime140_1.dll is being held in use. Close that application and retry.
470+
#
471+
windows_testing:
472+
needs: windows
473+
runs-on: ${{ matrix.os }}
474+
timeout-minutes: 180
475+
476+
strategy:
477+
fail-fast: false
478+
matrix:
479+
os:
480+
- windows-2022
481+
482+
name: ${{ matrix.os }} testing
483+
steps:
484+
485+
- uses: actions/download-artifact@v4
486+
name: Download Windows arifacts
487+
id: download_windows_artifacts
488+
with:
489+
name: metasploit-windows-installers
490+
path: metasploit-omnibus
491+
492+
- name: Install artifact
493+
shell: pwsh
494+
run: |
495+
Set-PSDebug -Trace 1
496+
echo "Testing artifact"
497+
498+
echo '' > debug.log
499+
$artifact = (Get-ChildItem -Path "metasploit-omnibus/*.msi")[0].Name
500+
$install_process = Start-Process msiexec.exe -ArgumentList "/i metasploit-omnibus\$artifact /quiet /qn /l*v debug.log" -NoNewWindow -PassThru
501+
$install_process_handle = $install_process.Handle # cache proc.Handle - https://stackoverflow.com/questions/10262231/obtaining-exitcode-using-start-process-and-waitforexit-instead-of-wait
502+
$log_process = Start-Process "powershell" "Get-Content -Path debug.log -Wait" -NoNewWindow -PassThru
503+
$install_process.WaitForExit()
504+
$log_process.Kill()
505+
echo "finished install"
506+
Exit $install_process.ExitCode
507+
508+
- shell: pwsh
509+
run: |
510+
d:\metasploit-framework\bin\msfvenom -p windows/meterpreter/reverse_tcp -f exe -o test.exe
511+
Exit $LASTEXITCODE
512+
- shell: pwsh
513+
run: |
514+
d:\metasploit-framework\bin\msfd -h
515+
Exit $LASTEXITCODE
516+
- shell: pwsh
517+
run: |
518+
d:\metasploit-framework\bin\msfrpc -h
519+
Exit $LASTEXITCODE
520+
- shell: pwsh
521+
run: |
522+
d:\metasploit-framework\bin\msfrpcd -h
523+
Exit $LASTEXITCODE
524+
- shell: pwsh
525+
run: |
526+
d:\metasploit-framework\bin\msfdb -h
527+
Exit $LASTEXITCODE
528+
- shell: pwsh
529+
run: |
530+
d:\metasploit-framework\bin\msfbinscan -h
531+
Exit $LASTEXITCODE
532+
- shell: pwsh
533+
run: |
534+
d:\metasploit-framework\bin\msfrop -h
535+
Exit $LASTEXITCODE
536+
- shell: pwsh
537+
run: |
538+
d:\metasploit-framework\bin\msfelfscan -h
539+
Exit $LASTEXITCODE
540+
- shell: pwsh
541+
run: |
542+
d:\metasploit-framework\bin\msfmachscan -h
543+
Exit $LASTEXITCODE
544+
- shell: pwsh
545+
run: |
546+
d:\metasploit-framework\bin\msfpescan -h
547+
Exit $LASTEXITCODE
548+
- shell: pwsh
549+
run: |
550+
d:\metasploit-framework\bin\msfconsole -qx 'setg variable test; version; exit'
551+
Exit $LASTEXITCODE

Diff for: Gemfile.lock

+28-28
Original file line numberDiff line numberDiff line change
@@ -21,66 +21,66 @@ GIT
2121
GEM
2222
remote: https://rubygems.org/
2323
specs:
24-
addressable (2.8.6)
25-
public_suffix (>= 2.0.2, < 6.0)
24+
addressable (2.8.7)
25+
public_suffix (>= 2.0.2, < 7.0)
2626
awesome_print (1.9.2)
2727
aws-eventstream (1.3.0)
28-
aws-partitions (1.916.0)
29-
aws-sdk-core (3.192.1)
28+
aws-partitions (1.1017.0)
29+
aws-sdk-core (3.214.0)
3030
aws-eventstream (~> 1, >= 1.3.0)
31-
aws-partitions (~> 1, >= 1.651.0)
32-
aws-sigv4 (~> 1.8)
31+
aws-partitions (~> 1, >= 1.992.0)
32+
aws-sigv4 (~> 1.9)
3333
jmespath (~> 1, >= 1.6.1)
34-
aws-sdk-kms (1.79.0)
35-
aws-sdk-core (~> 3, >= 3.191.0)
36-
aws-sigv4 (~> 1.1)
34+
aws-sdk-kms (1.96.0)
35+
aws-sdk-core (~> 3, >= 3.210.0)
36+
aws-sigv4 (~> 1.5)
3737
aws-sdk-s3 (1.116.0)
3838
aws-sdk-core (~> 3, >= 3.127.0)
3939
aws-sdk-kms (~> 1)
4040
aws-sigv4 (~> 1.4)
41-
aws-sigv4 (1.8.0)
41+
aws-sigv4 (1.10.1)
4242
aws-eventstream (~> 1, >= 1.0.2)
4343
byebug (11.1.3)
4444
chef-cleanroom (1.0.5)
45-
chef-config (18.4.12)
45+
chef-config (18.5.0)
4646
addressable
47-
chef-utils (= 18.4.12)
47+
chef-utils (= 18.5.0)
4848
fuzzyurl
4949
mixlib-config (>= 2.2.12, < 4.0)
5050
mixlib-shellout (>= 2.0, < 4.0)
5151
tomlrb (~> 1.2)
52-
chef-utils (18.4.12)
52+
chef-utils (18.5.0)
5353
concurrent-ruby
5454
citrus (3.0.2)
5555
coderay (1.1.3)
56-
concurrent-ruby (1.2.3)
56+
concurrent-ruby (1.3.4)
5757
contracts (0.16.1)
58-
ffi (1.16.3)
58+
ffi (1.17.0)
5959
ffi-yajl (2.6.0)
6060
libyajl2 (>= 1.2)
6161
fuzzyurl (0.9.0)
62-
iostruct (0.0.5)
62+
iostruct (0.2.0)
6363
ipaddress (0.8.3)
6464
jmespath (1.6.2)
65-
json (2.7.2)
65+
json (2.9.0)
6666
libyajl2 (2.1.0)
67-
license_scout (1.3.7)
67+
license_scout (1.3.15)
6868
ffi-yajl (~> 2.2)
6969
mixlib-shellout (>= 2.2, < 4.0)
7070
toml-rb (>= 1, < 3)
71-
method_source (1.0.0)
71+
method_source (1.1.0)
7272
mixlib-cli (2.1.8)
7373
mixlib-config (3.0.27)
7474
tomlrb
7575
mixlib-log (3.0.9)
76-
mixlib-shellout (3.2.7)
76+
mixlib-shellout (3.3.4)
7777
chef-utils
7878
mixlib-versioning (1.2.12)
79-
multipart-post (2.4.0)
79+
multipart-post (2.4.1)
8080
net-scp (4.0.0)
8181
net-ssh (>= 2.6.5, < 8.0.0)
82-
net-ssh (7.2.3)
83-
ohai (18.1.3)
82+
net-ssh (7.3.0)
83+
ohai (18.1.18)
8484
chef-config (>= 14.12, < 19)
8585
chef-utils (>= 16.0, < 19)
8686
ffi (~> 1.9)
@@ -93,7 +93,7 @@ GEM
9393
plist (~> 3.1)
9494
train-core
9595
wmi-lite (~> 1.0)
96-
pedump (0.6.7)
96+
pedump (0.6.10)
9797
awesome_print
9898
iostruct (>= 0.0.4)
9999
multipart-post (>= 2.0.0)
@@ -106,23 +106,23 @@ GEM
106106
pry-byebug (3.10.1)
107107
byebug (~> 11.0)
108108
pry (>= 0.13, < 0.15)
109-
public_suffix (5.0.5)
109+
public_suffix (6.0.1)
110110
rainbow (3.1.1)
111111
rexml (3.3.9)
112112
ruby-progressbar (1.13.0)
113-
thor (1.3.1)
113+
thor (1.3.2)
114114
toml-rb (2.2.0)
115115
citrus (~> 3.0, > 3.0)
116116
tomlrb (1.3.0)
117-
train-core (3.12.3)
117+
train-core (3.12.7)
118118
addressable (~> 2.5)
119119
ffi (!= 1.13.0)
120120
json (>= 1.8, < 3.0)
121121
mixlib-shellout (>= 2.0, < 4.0)
122122
net-scp (>= 1.2, < 5.0)
123123
net-ssh (>= 2.9, < 8.0)
124124
wmi-lite (1.0.7)
125-
zhexdump (0.1.0)
125+
zhexdump (0.2.0)
126126

127127
PLATFORMS
128128
ruby

Diff for: config/patches/metasploit-framework/windows.patch

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
diff --git a/Gemfile.lock b/Gemfile.lock
2+
index a05bbfbdc7e..1a3cff9acc7 100644
3+
--- Gemfile.lock 2024-05-17 12:32:16
4+
+++ Gemfile.lock 2024-05-17 12:32:59
5+
@@ -32,8 +32,6 @@ PATH
6+
faraday (= 2.7.11)
7+
faraday-retry
8+
faye-websocket
9+
- ffi (< 1.17.0)
10+
- fiddle
11+
filesize
12+
getoptlong
13+
hrr_rb_ssh-ed25519
14+
@@ -66,7 +64,6 @@ PATH
15+
ostruct
16+
packetfu
17+
patch_finder
18+
- pcaprub
19+
pdf-reader
20+
pg
21+
puma
22+
@@ -262,8 +259,6 @@ GEM
23+
faye-websocket (0.11.3)
24+
eventmachine (>= 0.12.0)
25+
websocket-driver (>= 0.5.1)
26+
- ffi (1.16.3)
27+
- fiddle (1.1.6)
28+
filesize (0.2.0)
29+
fivemat (1.3.7)
30+
forwardable (1.3.3)
31+
@@ -375,14 +370,11 @@ GEM
32+
openssl-cmac (2.0.2)
33+
openvas-omp (0.0.4)
34+
ostruct (0.6.1)
35+
- packetfu (2.0.0)
36+
- pcaprub (~> 0.13.1)
37+
parallel (1.26.3)
38+
parser (3.3.7.1)
39+
ast (~> 2.4.1)
40+
racc
41+
patch_finder (1.0.2)
42+
- pcaprub (0.13.3)
43+
pdf-reader (2.14.1)
44+
Ascii85 (>= 1.0, < 3.0, != 2.0.0)
45+
afm (~> 0.2.1)
46+
diff --git a/metasploit-framework.gemspec b/metasploit-framework.gemspec
47+
index 8c620476dbc..959eb1284f8 100644
48+
--- metasploit-framework.gemspec 2024-05-17 12:32:16
49+
+++ metasploit-framework.gemspec 2024-05-17 12:32:59
50+
@@ -87,9 +87,9 @@ Gem::Specification.new do |spec|
51+
# Needed by for XML parsing
52+
spec.add_runtime_dependency 'nokogiri'
53+
# Needed by db.rb and Msf::Exploit::Capture
54+
- spec.add_runtime_dependency 'packetfu'
55+
+ #spec.add_runtime_dependency 'packetfu'
56+
# For sniffer and raw socket modules
57+
- spec.add_runtime_dependency 'pcaprub'
58+
+ #spec.add_runtime_dependency 'pcaprub'
59+
# Used by the Metasploit data model, etc.
60+
# bound to 0.2x for Activerecord 4.2.8 deprecation warnings:
61+
# https://github.com/ged/ruby-pg/commit/c90ac644e861857ae75638eb6954b1cb49617090
62+
@@ -266,7 +266,6 @@ Gem::Specification.new do |spec|
63+
bigdecimal
64+
csv
65+
drb
66+
- fiddle
67+
getoptlong
68+
mutex_m
69+
ostruct

Diff for: config/software/metasploit-framework.rb

+2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ def has_windows_metasploit_framework_repo?
5151

5252
build do
5353
patch_env = with_standard_compiler_flags(with_embedded_path)
54+
# Remove problematic dependencies for Windows; Fiddle will need to be re-added in a future build for Ruby 3.3 support
55+
patch source: "windows.patch", plevel: 0, env: patch_env if windows?
5456
copy "#{project_dir}", "#{install_dir}/embedded/framework"
5557

5658
major, minor, patch = Omnibus::BuildVersion.semver.split('.')

0 commit comments

Comments
 (0)