Skip to content

Commit 0ed5a24

Browse files
committed
Compile with Ruby 3.2.5
1 parent 6ea9624 commit 0ed5a24

File tree

7 files changed

+119
-37
lines changed

7 files changed

+119
-37
lines changed

.github/workflows/verify.yml

+9-3
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,7 +368,7 @@ jobs:
368368
os:
369369
- windows-2022
370370
ruby:
371-
- 3.0.6
371+
- 3.2.5
372372

373373
name: ${{ matrix.os }}
374374
steps:
@@ -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

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
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
diff --git a/Gemfile.lock b/Gemfile.lock
2+
index 1c6294012f..cea7007a27 100644
3+
--- a/Gemfile.lock
4+
+++ b/Gemfile.lock
5+
@@ -64,9 +64,7 @@ PATH
6+
openssl-ccm
7+
openvas-omp
8+
ostruct
9+
- packetfu
10+
patch_finder
11+
- pcaprub
12+
pdf-reader
13+
pg
14+
puma
15+
@@ -358,14 +356,11 @@ GEM
16+
openssl-cmac (2.0.2)
17+
openvas-omp (0.0.4)
18+
ostruct (0.6.1)
19+
- packetfu (2.0.0)
20+
- pcaprub (~> 0.13.1)
21+
parallel (1.26.3)
22+
parser (3.3.5.0)
23+
ast (~> 2.4.1)
24+
racc
25+
patch_finder (1.0.2)
26+
- pcaprub (0.13.3)
27+
pdf-reader (2.12.0)
28+
Ascii85 (~> 1.0)
29+
afm (~> 0.2.1)
30+
@@ -383,7 +378,7 @@ GEM
31+
puma (6.4.3)
32+
nio4r (~> 2.0)
33+
racc (1.8.1)
34+
- rack (2.2.10)
35+
+ rack (2.2.12)
36+
rack-protection (3.2.0)
37+
base64 (>= 0.1.0)
38+
rack (~> 2.2, >= 2.2.4)
39+
diff --git a/metasploit-framework.gemspec b/metasploit-framework.gemspec
40+
index a7cd6306a1..b8a31fdd9a 100644
41+
--- a/metasploit-framework.gemspec
42+
+++ b/metasploit-framework.gemspec
43+
@@ -87,9 +87,9 @@ Gem::Specification.new do |spec|
44+
# Needed by for XML parsing
45+
spec.add_runtime_dependency 'nokogiri'
46+
# Needed by db.rb and Msf::Exploit::Capture
47+
- spec.add_runtime_dependency 'packetfu'
48+
+ #spec.add_runtime_dependency 'packetfu'
49+
# For sniffer and raw socket modules
50+
- spec.add_runtime_dependency 'pcaprub'
51+
+ #spec.add_runtime_dependency 'pcaprub'
52+
# Used by the Metasploit data model, etc.
53+
# bound to 0.2x for Activerecord 4.2.8 deprecation warnings:
54+
# https://github.com/ged/ruby-pg/commit/c90ac644e861857ae75638eb6954b1cb49617090

config/software/metasploit-framework.rb

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ def has_windows_metasploit_framework_repo?
5151

5252
build do
5353
patch_env = with_standard_compiler_flags(with_embedded_path)
54+
patch source: "pcaprub.patch", plevel: 0, env: patch_env if windows?
5455
copy "#{project_dir}", "#{install_dir}/embedded/framework"
5556

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

config/software/pcaprub.rb

+19-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#
1616

1717
name "pcaprub"
18-
default_version "0.13.2"
18+
default_version "0.13.3"
1919

2020
if windows?
2121
dependency "ruby-windows"
@@ -30,11 +30,26 @@
3030
dependency "rubygems"
3131

3232
build do
33+
# Skip pcaprub support for now as it causes compilation issues
34+
next if windows?
35+
3336
env = with_standard_compiler_flags(with_embedded_path)
3437
env['SSL_CERT_FILE'] = "#{install_dir}/embedded/ssl/cert.pem"
38+
# Ignore:
39+
# pcaprub.c: In function 'rbpcap_each_data':
40+
# pcaprub.c:987:17: error: implicit declaration of function 'pcap_getevent'; did you mean 'pcap_geterr'? [-Wimplicit-function-declaration]
41+
# 987 | fno = (HANDLE)pcap_getevent(rbp->pd);
42+
# | ^~~~~~~~~~~~~
43+
# | pcap_geterr
44+
# pcaprub.c:987:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
45+
# 987 | fno = (HANDLE)pcap_getevent(rbp->pd);
46+
# | ^
47+
# pcaprub.c: In function 'rbpcap_each_packet':
48+
# pcaprub.c:1029:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
49+
# 1029 | fno = (HANDLE)pcap_getevent(rbp->pd);
50+
cflags = "-Wno-int-to-pointer-cast -Wno-implicit-function-declaration"
3551

36-
# We need to create the pcaprub gem ourselves until 0.13.2 is released (https://github.com/pcaprub/pcaprub/issues/67)
37-
# Use version of pcaprub relative to the current directory
52+
# Use version of pcaprub relative to the current directory if it exists
3853
local_pcaprub_checkout = File.expand_path(File.join(Dir.pwd, "..", "pcaprub"))
3954
command "echo checking for path: #{local_pcaprub_checkout}", env: env
4055
if File.exist?(local_pcaprub_checkout)
@@ -43,6 +58,6 @@
4358
else
4459
command "echo before old pcaprub code", env: env
4560
gem "install pcaprub" \
46-
" --version '#{version}' --no-document", env: env
61+
" --version '#{version}' --no-document -- --with-cflags=\'#{cflags}\'", env: env
4762
end
4863
end

config/software/ruby-windows-msys2.rb

+7-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#
1616

1717
name "ruby-windows-msys2"
18-
default_version "20220603"
18+
default_version "20250221"
1919

2020
license "BSD-3-Clause"
2121
license_file "https://raw.githubusercontent.com/Alexpux/MSYS2-packages/master/LICENSE"
@@ -57,6 +57,12 @@
5757
sha256: "39e476b45b7ca39567afd341146af68ed53b89b09c90d285988367ec5c5ecc11"
5858
relative_path "msys64"
5959
end
60+
version "20250221" do
61+
# file has to be decompressed from local cache using xz before build executes
62+
source url: "https://repo.msys2.org/distrib/x86_64/msys2-base-x86_64-#{version}.tar",
63+
sha256: "cf7bd3ecb4f79eaa58ac794dba3cca15581465b9d92cec59ae4bd99fde74c8a0"
64+
relative_path "msys64"
65+
end
6066
end
6167

6268
build do

0 commit comments

Comments
 (0)