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

Compile with Ruby 3.2.5 #219

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
@@ -295,7 +295,7 @@ jobs:
os:
- macos-13
ruby:
- 3.0.6
- 3.2.5

name: ${{ matrix.os }}
steps:
@@ -368,7 +368,7 @@ jobs:
os:
- windows-2022
ruby:
- 3.0.6
- 3.2.5

name: ${{ matrix.os }}
steps:
@@ -393,6 +393,12 @@ jobs:
submodules: true
path: metasploit-omnibus

- name: Update bundler version
# Github actions with Ruby requires Bundler 2.2.18+
# https://github.com/ruby/setup-ruby/tree/d2b39ad0b52eca07d23f3aa14fdf2a3fcc1f411c#windows
run: |
(Get-Content metasploit-omnibus\Gemfile.lock).Replace(' 2.2.33', ' 2.5.10') | Set-Content metasploit-omnibus\Gemfile.lock

- name: Setup Ruby
env:
BUNDLE_FORCE_RUBY_PLATFORM: true
@@ -404,7 +410,7 @@ jobs:
working-directory: metasploit-omnibus
# Github actions with Ruby requires Bundler 2.2.18+
# https://github.com/ruby/setup-ruby/tree/d2b39ad0b52eca07d23f3aa14fdf2a3fcc1f411c#windows
bundler: 2.2.33
bundler: 2.5.10

# If you need to build a custom version of pcaprub:
# - name: Checkout pcaprub
56 changes: 28 additions & 28 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -21,66 +21,66 @@ GIT
GEM
remote: https://rubygems.org/
specs:
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
awesome_print (1.9.2)
aws-eventstream (1.3.0)
aws-partitions (1.916.0)
aws-sdk-core (3.192.1)
aws-partitions (1.1017.0)
aws-sdk-core (3.214.0)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.8)
aws-partitions (~> 1, >= 1.992.0)
aws-sigv4 (~> 1.9)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.79.0)
aws-sdk-core (~> 3, >= 3.191.0)
aws-sigv4 (~> 1.1)
aws-sdk-kms (1.96.0)
aws-sdk-core (~> 3, >= 3.210.0)
aws-sigv4 (~> 1.5)
aws-sdk-s3 (1.116.0)
aws-sdk-core (~> 3, >= 3.127.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.4)
aws-sigv4 (1.8.0)
aws-sigv4 (1.10.1)
aws-eventstream (~> 1, >= 1.0.2)
byebug (11.1.3)
chef-cleanroom (1.0.5)
chef-config (18.4.12)
chef-config (18.5.0)
addressable
chef-utils (= 18.4.12)
chef-utils (= 18.5.0)
fuzzyurl
mixlib-config (>= 2.2.12, < 4.0)
mixlib-shellout (>= 2.0, < 4.0)
tomlrb (~> 1.2)
chef-utils (18.4.12)
chef-utils (18.5.0)
concurrent-ruby
citrus (3.0.2)
coderay (1.1.3)
concurrent-ruby (1.2.3)
concurrent-ruby (1.3.4)
contracts (0.16.1)
ffi (1.16.3)
ffi (1.17.0)
ffi-yajl (2.6.0)
libyajl2 (>= 1.2)
fuzzyurl (0.9.0)
iostruct (0.0.5)
iostruct (0.2.0)
ipaddress (0.8.3)
jmespath (1.6.2)
json (2.7.2)
json (2.9.0)
libyajl2 (2.1.0)
license_scout (1.3.7)
license_scout (1.3.15)
ffi-yajl (~> 2.2)
mixlib-shellout (>= 2.2, < 4.0)
toml-rb (>= 1, < 3)
method_source (1.0.0)
method_source (1.1.0)
mixlib-cli (2.1.8)
mixlib-config (3.0.27)
tomlrb
mixlib-log (3.0.9)
mixlib-shellout (3.2.7)
mixlib-shellout (3.3.4)
chef-utils
mixlib-versioning (1.2.12)
multipart-post (2.4.0)
multipart-post (2.4.1)
net-scp (4.0.0)
net-ssh (>= 2.6.5, < 8.0.0)
net-ssh (7.2.3)
ohai (18.1.3)
net-ssh (7.3.0)
ohai (18.1.18)
chef-config (>= 14.12, < 19)
chef-utils (>= 16.0, < 19)
ffi (~> 1.9)
@@ -93,7 +93,7 @@ GEM
plist (~> 3.1)
train-core
wmi-lite (~> 1.0)
pedump (0.6.7)
pedump (0.6.10)
awesome_print
iostruct (>= 0.0.4)
multipart-post (>= 2.0.0)
@@ -106,23 +106,23 @@ GEM
pry-byebug (3.10.1)
byebug (~> 11.0)
pry (>= 0.13, < 0.15)
public_suffix (5.0.5)
public_suffix (6.0.1)
rainbow (3.1.1)
rexml (3.3.9)
ruby-progressbar (1.13.0)
thor (1.3.1)
thor (1.3.2)
toml-rb (2.2.0)
citrus (~> 3.0, > 3.0)
tomlrb (1.3.0)
train-core (3.12.3)
train-core (3.12.7)
addressable (~> 2.5)
ffi (!= 1.13.0)
json (>= 1.8, < 3.0)
mixlib-shellout (>= 2.0, < 4.0)
net-scp (>= 1.2, < 5.0)
net-ssh (>= 2.9, < 8.0)
wmi-lite (1.0.7)
zhexdump (0.1.0)
zhexdump (0.2.0)

PLATFORMS
ruby
54 changes: 54 additions & 0 deletions config/patches/metasploit-framework/pcaprub.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
diff --git a/Gemfile.lock b/Gemfile.lock
index 1c6294012f..cea7007a27 100644
--- Gemfile.lock 2024-05-17 12:32:16
+++ Gemfile.lock 2024-05-17 12:32:59
@@ -64,9 +64,7 @@ PATH
openssl-ccm
openvas-omp
ostruct
- packetfu
patch_finder
- pcaprub
pdf-reader
pg
puma
@@ -358,14 +356,11 @@ GEM
openssl-cmac (2.0.2)
openvas-omp (0.0.4)
ostruct (0.6.1)
- packetfu (2.0.0)
- pcaprub (~> 0.13.1)
parallel (1.26.3)
parser (3.3.5.0)
ast (~> 2.4.1)
racc
patch_finder (1.0.2)
- pcaprub (0.13.3)
pdf-reader (2.12.0)
Ascii85 (~> 1.0)
afm (~> 0.2.1)
@@ -383,7 +378,7 @@ GEM
puma (6.4.3)
nio4r (~> 2.0)
racc (1.8.1)
- rack (2.2.10)
+ rack (2.2.12)
rack-protection (3.2.0)
base64 (>= 0.1.0)
rack (~> 2.2, >= 2.2.4)
diff --git a/metasploit-framework.gemspec b/metasploit-framework.gemspec
index a7cd6306a1..b8a31fdd9a 100644
--- metasploit-framework.gemspec 2024-05-17 12:32:16
+++ metasploit-framework.gemspec 2024-05-17 12:32:59
@@ -87,9 +87,9 @@ Gem::Specification.new do |spec|
# Needed by for XML parsing
spec.add_runtime_dependency 'nokogiri'
# Needed by db.rb and Msf::Exploit::Capture
- spec.add_runtime_dependency 'packetfu'
+ #spec.add_runtime_dependency 'packetfu'
# For sniffer and raw socket modules
- spec.add_runtime_dependency 'pcaprub'
+ #spec.add_runtime_dependency 'pcaprub'
# Used by the Metasploit data model, etc.
# bound to 0.2x for Activerecord 4.2.8 deprecation warnings:
# https://github.com/ged/ruby-pg/commit/c90ac644e861857ae75638eb6954b1cb49617090
1 change: 1 addition & 0 deletions config/software/metasploit-framework.rb
Original file line number Diff line number Diff line change
@@ -51,6 +51,7 @@ def has_windows_metasploit_framework_repo?

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

major, minor, patch = Omnibus::BuildVersion.semver.split('.')
23 changes: 19 additions & 4 deletions config/software/pcaprub.rb
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@
#

name "pcaprub"
default_version "0.13.2"
default_version "0.13.3"

if windows?
dependency "ruby-windows"
@@ -30,11 +30,26 @@
dependency "rubygems"

build do
# Skip pcaprub support for now as it causes compilation issues
next if windows?

env = with_standard_compiler_flags(with_embedded_path)
env['SSL_CERT_FILE'] = "#{install_dir}/embedded/ssl/cert.pem"
# Ignore:
# pcaprub.c: In function 'rbpcap_each_data':
# pcaprub.c:987:17: error: implicit declaration of function 'pcap_getevent'; did you mean 'pcap_geterr'? [-Wimplicit-function-declaration]
# 987 | fno = (HANDLE)pcap_getevent(rbp->pd);
# | ^~~~~~~~~~~~~
# | pcap_geterr
# pcaprub.c:987:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
# 987 | fno = (HANDLE)pcap_getevent(rbp->pd);
# | ^
# pcaprub.c: In function 'rbpcap_each_packet':
# pcaprub.c:1029:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
# 1029 | fno = (HANDLE)pcap_getevent(rbp->pd);
cflags = "-Wno-int-to-pointer-cast -Wno-implicit-function-declaration"

# We need to create the pcaprub gem ourselves until 0.13.2 is released (https://github.com/pcaprub/pcaprub/issues/67)
# Use version of pcaprub relative to the current directory
# Use version of pcaprub relative to the current directory if it exists
local_pcaprub_checkout = File.expand_path(File.join(Dir.pwd, "..", "pcaprub"))
command "echo checking for path: #{local_pcaprub_checkout}", env: env
if File.exist?(local_pcaprub_checkout)
@@ -43,6 +58,6 @@
else
command "echo before old pcaprub code", env: env
gem "install pcaprub" \
" --version '#{version}' --no-document", env: env
" --version '#{version}' --no-document -- --with-cflags=\'#{cflags}\'", env: env
end
end
8 changes: 7 additions & 1 deletion config/software/ruby-windows-msys2.rb
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@
#

name "ruby-windows-msys2"
default_version "20220603"
default_version "20250221"

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

build do
2 changes: 1 addition & 1 deletion local/cache