rapid7 / metasploit-framework

Metasploit Framework
https://www.metasploit.com/
Other
34.09k stars 13.96k forks source link

Lots of wanings with ruby 2.7 #12809

Closed Jab2870 closed 4 years ago

Jab2870 commented 4 years ago

Steps to reproduce

How'd you do it?

  1. Ensure that you have ruby version 2.7
 ruby --version
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux]
  1. Try and start metasploit
msfconsole
/opt/metasploit/vendor/bundle/ruby/2.7.0/gems/faraday-0.17.0/lib/faraday/options.rb:166: warning: Capturing the given block using Proc.new is deprecated; use `&block` instead
/opt/metasploit/vendor/bundle/ruby/2.7.0/gems/faraday-0.17.0/lib/faraday/options.rb:166: warning: Capturing the given block using Proc.new is deprecated; use `&block` instead
/opt/metasploit/vendor/bundle/ruby/2.7.0/gems/faraday-0.17.0/lib/faraday/options.rb:166: warning: Capturing the given block using Proc.new is deprecated; use `&block` instead
/opt/metasploit/vendor/bundle/ruby/2.7.0/gems/faraday-0.17.0/lib/faraday/options.rb:166: warning: Capturing the given block using Proc.new is deprecated; use `&block` instead
/opt/metasploit/vendor/bundle/ruby/2.7.0/gems/faraday-0.17.0/lib/faraday/options.rb:166: warning: Capturing the given block using Proc.new is deprecated; use `&block` instead
/opt/metasploit/vendor/bundle/ruby/2.7.0/gems/faraday-0.17.0/lib/faraday/rack_builder.rb:55: warning: Capturing the given block using Proc.new is deprecated; use `&block` instead
/opt/metasploit/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.1/lib/active_record/connection_adapters/abstract_adapter.rb:84: warning: deprecated Object#=~ is called on Integer; it always returns nil
/opt/metasploit/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.1/lib/active_record/connection_adapters/abstract_adapter.rb:84: warning: deprecated Object#=~ is called on Integer; it always returns nil
/opt/metasploit/vendor/bundle/ruby/2.7.0/gems/json-2.2.0/lib/json/common.rb:156: warning: Using the last argument as keyword parameters is deprecated

This section should also tell us any relevant information about the environment; for example, if an exploit that used to work is failing, tell us the victim operating system and service versions.

Expected behavior

It should start without warnings

Current behavior

We get warnings

System stuff

Running on up to date Arch Linux

Metasploit version

Framework: 5.0.60-dev
Console  : 5.0.60-dev

I installed Metasploit with:

OS

What OS are you running Metasploit on?

Arch Linux

viliuspovilaika commented 4 years ago

Same issue here. Exact same setup as mentioned.

goddessfreya commented 4 years ago

Same for me.

T1960CT commented 4 years ago

Same as well. Fresh blackarch with system updates/upgrades

wblondel commented 4 years ago

Same here.

ganguin commented 4 years ago

They are all deprecation warnings, I don't enough ruby to refactor the deprecated code, however to silence the warning you can wrap the corresponding code in:

silence_warnings do
  ...deprecated code...
end

patching the 3 files seem to be enough to silence the warnings for msfconsole (I did not check all the commands for other warnings):

/opt/metasploit/vendor/bundle/ruby/2.7.0/gems/faraday-0.17.0/lib/faraday/options.rb:166
/opt/metasploit/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.1/lib/active_record/connection_adapters/abstract_adapter.rb:84
/opt/metasploit/vendor/bundle/ruby/2.7.0/gems/json-2.2.0/lib/json/common.rb:156
funkyfreddy89 commented 4 years ago

No idea if this is related but i have the following errors with 5.0.73-dev

[mpool@dellxps ~]# ruby --version
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux]
msfconsole
/opt/metasploit/vendor/bundle/ruby/2.7.0/gems/faraday-0.17.0/lib/faraday/options.rb:166: warning: Capturing the given block using Proc.new is deprecated; use `&block` instead
/opt/metasploit/vendor/bundle/ruby/2.7.0/gems/faraday-0.17.0/lib/faraday/options.rb:166: warning: Capturing the given block using Proc.new is deprecated; use `&block` instead
/opt/metasploit/vendor/bundle/ruby/2.7.0/gems/faraday-0.17.0/lib/faraday/options.rb:166: warning: Capturing the given block using Proc.new is deprecated; use `&block` instead
/opt/metasploit/vendor/bundle/ruby/2.7.0/gems/faraday-0.17.0/lib/faraday/options.rb:166: warning: Capturing the given block using Proc.new is deprecated; use `&block` instead
/opt/metasploit/vendor/bundle/ruby/2.7.0/gems/faraday-0.17.0/lib/faraday/options.rb:166: warning: Capturing the given block using Proc.new is deprecated; use `&block` instead
/opt/metasploit/vendor/bundle/ruby/2.7.0/gems/faraday-0.17.0/lib/faraday/rack_builder.rb:55: warning: Capturing the given block using Proc.new is deprecated; use `&block` instead
/opt/metasploit/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.1/lib/active_record/connection_adapters/abstract_adapter.rb:84: warning: deprecated Object#=~ is called on Integer; it always returns nil
/opt/metasploit/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.1/lib/active_record/connection_adapters/abstract_adapter.rb:84: warning: deprecated Object#=~ is called on Integer; it always returns nil
/opt/metasploit/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.1/lib/active_record/connection_adapters/abstract_adapter.rb:84: warning: deprecated Object#=~ is called on Integer; it always returns nil
When run/exploit anything i get theses errors.
/opt/metasploit/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.1/lib/active_record/statement_cache.rb:90: warning: Capturing the given block using Proc.new is deprecated; use `&block` instead
/opt/metasploit/vendor/bundle/ruby/2.7.0/gems/activemodel-4.2.11.1/lib/active_model/validations/numericality.rb:68: warning: deprecated Object#=~ is called on Integer; it always returns nil
ghost commented 4 years ago

I am also experiencing this, I am running Arch with the blackarch repos (up to date, and Ruby is ver. 2.7.0). These deprecation warnings don't seem to effect performance, but makes it hard to really do anything I am also facing this issue on a fresh Kali VM

ghost commented 4 years ago

They are all deprecation warnings, I don't enough ruby to refactor the deprecated code, however to silence the warning you can wrap the corresponding code in:

silence_warnings do
  ...deprecated code...
end

patching the 3 files seem to be enough to silence the warnings for msfconsole (I did not check all the commands for other warnings):

/opt/metasploit/vendor/bundle/ruby/2.7.0/gems/faraday-0.17.0/lib/faraday/options.rb:166
/opt/metasploit/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.1/lib/active_record/connection_adapters/abstract_adapter.rb:84
/opt/metasploit/vendor/bundle/ruby/2.7.0/gems/json-2.2.0/lib/json/common.rb:156

This worked for me, thanks!

naiame-neltheri commented 4 years ago

Having same issue on 5.0.73-dev with ruby version ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux]

bcoles commented 4 years ago

For reference, here's the warnings I receive with v5.0.77-dev-011ed3602c and Ruby 2.5.7p206. However, msfconsole works correctly. If msfconsole does not start, then you have a different issue.

/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_AIO_LISTIO_MAX
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_AIO_MAX
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_AIO_PRIO_DELTA_MAX
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_ARG_MAX
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_ATEXIT_MAX
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_BC_BASE_MAX
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_BC_DIM_MAX
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_BC_SCALE_MAX
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_BC_STRING_MAX
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_CHILD_MAX
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_CLK_TCK
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_COLL_WEIGHTS_MAX
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_DELAYTIMER_MAX
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_EXPR_NEST_MAX
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_HOST_NAME_MAX
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_IOV_MAX
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_LINE_MAX
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_LOGIN_NAME_MAX
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_NGROUPS_MAX
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_GETGR_R_SIZE_MAX
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_GETPW_R_SIZE_MAX
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_MQ_OPEN_MAX
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_MQ_PRIO_MAX
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_OPEN_MAX
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_ADVISORY_INFO
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_BARRIERS
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_ASYNCHRONOUS_IO
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_CLOCK_SELECTION
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_CPUTIME
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_FSYNC
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_IPV6
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_JOB_CONTROL
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_MAPPED_FILES
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_MEMLOCK
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_MEMLOCK_RANGE
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_MEMORY_PROTECTION
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_MESSAGE_PASSING
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_MONOTONIC_CLOCK
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_PRIORITIZED_IO
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_PRIORITY_SCHEDULING
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_RAW_SOCKETS
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_READER_WRITER_LOCKS
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_REALTIME_SIGNALS
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_REGEXP
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_SAVED_IDS
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_SEMAPHORES
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_SHARED_MEMORY_OBJECTS
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_SHELL
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_SPAWN
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_SPIN_LOCKS
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_SPORADIC_SERVER
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_SS_REPL_MAX
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_SYNCHRONIZED_IO
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_THREAD_ATTR_STACKADDR
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_THREAD_ATTR_STACKSIZE
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_THREAD_CPUTIME
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_THREAD_PRIO_INHERIT
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_THREAD_PRIO_PROTECT
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_THREAD_PRIORITY_SCHEDULING
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_THREAD_PROCESS_SHARED
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_THREAD_ROBUST_PRIO_INHERIT
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_THREAD_ROBUST_PRIO_PROTECT
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_THREAD_SAFE_FUNCTIONS
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_THREAD_SPORADIC_SERVER
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_THREADS
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_TIMEOUTS
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_TIMERS
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_TRACE
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_TRACE_EVENT_FILTER
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_TRACE_EVENT_NAME_MAX
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_TRACE_INHERIT
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_TRACE_LOG
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_TRACE_NAME_MAX
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_TRACE_SYS_MAX
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_TRACE_USER_EVENT_MAX
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_TYPED_MEMORY_OBJECTS
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_VERSION
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_V7_ILP32_OFF32
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_V7_ILP32_OFFBIG
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_V7_LP64_OFF64
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_V7_LPBIG_OFFBIG
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_V6_ILP32_OFF32
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_V6_ILP32_OFFBIG
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_V6_LP64_OFF64
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_V6_LPBIG_OFFBIG
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_2_C_BIND
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_2_C_DEV
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_2_CHAR_TERM
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_2_FORT_DEV
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_2_FORT_RUN
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_2_LOCALEDEF
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_2_PBS
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_2_PBS_ACCOUNTING
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_2_PBS_CHECKPOINT
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_2_PBS_LOCATE
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_2_PBS_MESSAGE
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_2_PBS_TRACK
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_2_SW_DEV
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_2_UPE
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_2_VERSION
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_PAGE_SIZE
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_PAGESIZE
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_THREAD_DESTRUCTOR_ITERATIONS
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_THREAD_KEYS_MAX
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_THREAD_STACK_MIN
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_THREAD_THREADS_MAX
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_RE_DUP_MAX
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_RTSIG_MAX
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_SEM_NSEMS_MAX
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_SEM_VALUE_MAX
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_SIGQUEUE_MAX
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_STREAM_MAX
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_SYMLOOP_MAX
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_TIMER_MAX
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_TTY_NAME_MAX
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_TZNAME_MAX
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_XOPEN_CRYPT
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_XOPEN_ENH_I18N
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_XOPEN_REALTIME
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_XOPEN_REALTIME_THREADS
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_XOPEN_SHM
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_XOPEN_STREAMS
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_XOPEN_UNIX
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_XOPEN_VERSION
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_PHYS_PAGES
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_AVPHYS_PAGES
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_NPROCESSORS_CONF
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::SC_NPROCESSORS_ONLN
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::CS_PATH
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::CS_POSIX_V7_ILP32_OFF32_CFLAGS
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::CS_POSIX_V7_ILP32_OFF32_LDFLAGS
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::CS_POSIX_V7_ILP32_OFF32_LIBS
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::CS_POSIX_V7_ILP32_OFFBIG_CFLAGS
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::CS_POSIX_V7_ILP32_OFFBIG_LIBS
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::CS_POSIX_V7_LP64_OFF64_CFLAGS
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::CS_POSIX_V7_LP64_OFF64_LDFLAGS
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::CS_POSIX_V7_LP64_OFF64_LIBS
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::CS_POSIX_V7_LPBIG_OFFBIG_LIBS
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::CS_POSIX_V7_WIDTH_RESTRICTED_ENVS
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::CS_V7_ENV
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::CS_POSIX_V6_ILP32_OFF32_CFLAGS
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::CS_POSIX_V6_ILP32_OFF32_LDFLAGS
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::CS_POSIX_V6_ILP32_OFF32_LIBS
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::CS_POSIX_V6_ILP32_OFFBIG_CFLAGS
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::CS_POSIX_V6_ILP32_OFFBIG_LIBS
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::CS_POSIX_V6_LP64_OFF64_CFLAGS
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::CS_POSIX_V6_LP64_OFF64_LDFLAGS
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::CS_POSIX_V6_LP64_OFF64_LIBS
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::CS_POSIX_V6_LPBIG_OFFBIG_LIBS
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::CS_POSIX_V6_WIDTH_RESTRICTED_ENVS
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::CS_V6_ENV
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::CS_GNU_LIBC_VERSION
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::CS_GNU_LIBPTHREAD_VERSION
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::PC_FILESIZEBITS
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::PC_LINK_MAX
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::PC_MAX_CANON
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::PC_MAX_INPUT
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::PC_NAME_MAX
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::PC_PATH_MAX
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::PC_PIPE_BUF
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::PC_2_SYMLINKS
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::PC_ALLOC_SIZE_MIN
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::PC_REC_INCR_XFER_SIZE
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::PC_REC_MAX_XFER_SIZE
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::PC_REC_MIN_XFER_SIZE
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::PC_REC_XFER_ALIGN
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::PC_SYMLINK_MAX
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::PC_CHOWN_RESTRICTED
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::PC_NO_TRUNC
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::PC_VDISABLE
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::PC_ASYNC_IO
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::PC_PRIO_IO
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Etc::PC_SYNC_IO
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Struct::Passwd
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/etc.so: warning: already initialized constant Struct::Group
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/strscan.so: warning: already initialized constant StringScanner::Version
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/strscan.so: warning: already initialized constant StringScanner::Id
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/bigdecimal.so: warning: already initialized constant BigDecimal::VERSION
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/bigdecimal.so: warning: already initialized constant BigDecimal::BASE
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/bigdecimal.so: warning: already initialized constant BigDecimal::EXCEPTION_ALL
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/bigdecimal.so: warning: already initialized constant BigDecimal::EXCEPTION_NaN
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/bigdecimal.so: warning: already initialized constant BigDecimal::EXCEPTION_INFINITY
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/bigdecimal.so: warning: already initialized constant BigDecimal::EXCEPTION_UNDERFLOW
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/bigdecimal.so: warning: already initialized constant BigDecimal::EXCEPTION_OVERFLOW
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/bigdecimal.so: warning: already initialized constant BigDecimal::EXCEPTION_ZERODIVIDE
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/bigdecimal.so: warning: already initialized constant BigDecimal::ROUND_MODE
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/bigdecimal.so: warning: already initialized constant BigDecimal::ROUND_UP
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/bigdecimal.so: warning: already initialized constant BigDecimal::ROUND_DOWN
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/bigdecimal.so: warning: already initialized constant BigDecimal::ROUND_HALF_UP
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/bigdecimal.so: warning: already initialized constant BigDecimal::ROUND_HALF_DOWN
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/bigdecimal.so: warning: already initialized constant BigDecimal::ROUND_CEILING
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/bigdecimal.so: warning: already initialized constant BigDecimal::ROUND_FLOOR
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/bigdecimal.so: warning: already initialized constant BigDecimal::ROUND_HALF_EVEN
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/bigdecimal.so: warning: already initialized constant BigDecimal::SIGN_NaN
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/bigdecimal.so: warning: already initialized constant BigDecimal::SIGN_POSITIVE_ZERO
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/bigdecimal.so: warning: already initialized constant BigDecimal::SIGN_NEGATIVE_ZERO
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/bigdecimal.so: warning: already initialized constant BigDecimal::SIGN_POSITIVE_FINITE
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/bigdecimal.so: warning: already initialized constant BigDecimal::SIGN_NEGATIVE_FINITE
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/bigdecimal.so: warning: already initialized constant BigDecimal::SIGN_POSITIVE_INFINITE
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/bigdecimal.so: warning: already initialized constant BigDecimal::SIGN_NEGATIVE_INFINITE
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/bigdecimal.so: warning: already initialized constant BigDecimal::INFINITY
/usr/lib/x86_64-linux-gnu/ruby/2.5.0/bigdecimal.so: warning: already initialized constant BigDecimal::NAN
cosarara commented 4 years ago

For a workaround, edit /bin/msfconsole and pass -W0 to ruby:

BUNDLE_GEMFILE=/opt/metasploit/Gemfile bundle exec ruby -W0 /opt/metasploit/msfconsole "$@"
sterculius commented 4 years ago

same issue here , manjaro with blackarch repo

adfoster-r7 commented 4 years ago

I took a quick look at this; It seems like the warnings are fixed in faraday 0.17.3 by this PR https://github.com/lostisland/faraday/pull/1083

But it seems Metasploit has pinned its faraday version to <= 0.17.0 in https://github.com/rapid7/metasploit-framework/pull/12658 and https://github.com/rapid7/metasploit-framework/pull/12659. It seems that the version was pinned due to Octokit issues - which coincidentally may have been fixed in 0.17.3 - https://github.com/octokit/octokit.rb/issues/1170#issuecomment-570256197

Hopefully this is something we can fix :+1:

rad1x-dev commented 4 years ago

To fix the error:

/opt/metasploit/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.1/lib/active_record/connection_adapters/abstract_adapter.rb:84: warning: deprecated Object#=~ is called on Integer; it always returns nil

Just open /opt/metasploit/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.1/lib/active_record/connection_adapters/abstract_adapter.rb in a text editor and change line 84 from if config =~ SIMPLE_INT" to if config.to_i.to_s == config

All it's doing is checking if the variable "config" is a string, and parsing it to an int if true. The new line does the same thing but will return false instead of nil if not true, fixing the problem.

naiame-neltheri commented 4 years ago

Is it fixed in arch linux repository? Or should I must do it manually?

saltasatelites commented 4 years ago

naiame-neltheri. Isn't already fixed. Install metasploit as always and invoke it with: RUBYOPT='-W:no-deprecated -W:no-experimental' msfconsole (or add this line in your msfconsole archive)

naiame-neltheri commented 4 years ago

naiame-neltheri. Isn't already fixed. Install metasploit as always and invoke it with: RUBYOPT='-W:no-deprecated -W:no-experimental' msfconsole

Well I didn't wanted that way but yeah it fixes the problem

gwillcox-r7 commented 4 years ago

As @adamgalway-r7 addressed this issue with PR #13144 and there appears to be a workaround in the meantime, I'm going to close out this issue.

b1nary0mega commented 4 years ago

To fix the error:

/opt/metasploit/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.1/lib/active_record/connection_adapters/abstract_adapter.rb:84: warning: deprecated Object#=~ is called on Integer; it always returns nil

Just open /opt/metasploit/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.1/lib/active_record/connection_adapters/abstract_adapter.rb in a text editor and change line 84 from if config =~ SIMPLE_INT" to if config.to_i.to_s == config

All it's doing is checking if the variable "config" is a string, and parsing it to an int if true. The new line does the same thing but will return false instead of nil if not true, fixing the problem.

This worked for me. Thank you. Kali path is "/usr/share/metasploit-framework/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.1/lib/active_record/connection_adapters/abstract_adapter.rb"

alam1091 commented 4 years ago

To fix the error:

/opt/metasploit/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.1/lib/active_record/connection_adapters/abstract_adapter.rb:84: warning: deprecated Object#=~ is called on Integer; it always returns nil

Just open /opt/metasploit/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.1/lib/active_record/connection_adapters/abstract_adapter.rb in a text editor and change line 84 from if config =~ SIMPLE_INT" to if config.to_i.to_s == config

All it's doing is checking if the variable "config" is a string, and parsing it to an int if true. The new line does the same thing but will return false instead of nil if not true, fixing the problem.

worked perfectly , thanks!

adfoster-r7 commented 4 years ago

This issue is now fixed in version 5.0.87 of Metasploit

defaultraw commented 4 years ago

To fix the error:

/opt/metasploit/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.1/lib/active_record/connection_adapters/abstract_adapter.rb:84: warning: deprecated Object#=~ is called on Integer; it always returns nil

Just open /opt/metasploit/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.1/lib/active_record/connection_adapters/abstract_adapter.rb in a text editor and change line 84 from if config =~ SIMPLE_INT" to if config.to_i.to_s == config

All it's doing is checking if the variable "config" is a string, and parsing it to an int if true. The new line does the same thing but will return false instead of nil if not true, fixing the problem.

Thank you man, error fix!

n4050Kali commented 4 years ago

To fix the error: /opt/metasploit/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.1/lib/active_record/connection_adapters/abstract_adapter.rb:84: warning: deprecated Object#=~ is called on Integer; it always returns nil Just open /opt/metasploit/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.1/lib/active_record/connection_adapters/abstract_adapter.rb in a text editor and change line 84 from if config =~ SIMPLE_INT" to if config.to_i.to_s == config All it's doing is checking if the variable "config" is a string, and parsing it to an int if true. The new line does the same thing but will return false instead of nil if not true, fixing the problem.

Thank you man, error fix!

Thanks Dear, warning resolve :)

djnosyt commented 4 years ago

To fix the error:

/opt/metasploit/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.1/lib/active_record/connection_adapters/abstract_adapter.rb:84: warning: deprecated Object#=~ is called on Integer; it always returns nil

Just open /opt/metasploit/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.1/lib/active_record/connection_adapters/abstract_adapter.rb in a text editor and change line 84 from if config =~ SIMPLE_INT" to if config.to_i.to_s == config

All it's doing is checking if the variable "config" is a string, and parsing it to an int if true. The new line does the same thing but will return false instead of nil if not true, fixing the problem.

Can you assist me with a similar issue? I'm having a hard time understanding what my client.rb script is trying to do on line 96 Screenshot from 2020-05-03 12-00-07

/usr/share/metasploit-framework/lib/rex/proto/http/client.rb:96: warning: deprecated Object#=~ is called on FalseClass; it always returns nil

blackbirddh13 commented 4 years ago

I really have no clue about Ruby ... so ... please use wisely ... don't laugh at me.

I was experimenting with Kali and Metasploit and also got above warnings. I fixed the if config =~ SIMPLE_INT Thx rad1x-dev!

I didn't see the Proc.new issue in "statement_cache.rb" addressed and continued to have the error. silence_warnings did not do anything for me for some reason ...

So I did some research (i have absolutely no clue about ruby ... really!) ... and found this article : https://blog.saeloun.com/2019/09/02/ruby-2-7-proc-without-block-warning.html

Reading from the article by Romil, this seems to be the way to this in Ruby 2-7:

# proc with block in a method
def sample_method(&block)
  proc &block
end
# => :sample_method
# Method called with a block
sample_method { "Hello" }.call
# => "Hello"

so changing the code around line 90 to :

def self.create(connection, &block)
      proc &block
      relation      = block.call Params.new
      bind_map      = BindMap.new relation.bind_values
      query_builder = connection.cacheable_query relation.arel
      new query_builder, bind_map
    end

seems to work and I get no more warnings ...

hope this helps others getting less warnings using metasploit.

gwillcox-r7 commented 4 years ago

This issue has been receiving a lot of questions lately and it is something that has already been addressed with the last few updates. Please update to Metasploit version 5.0.87 as per @adfoster-r7's comment which contains a number of patches for these Ruby related issues. I am going to lock this conversation as this issue has already been closed and resolved and really there should be no need for end users to be modifying Metasploit code itself to get this to work.

Please note that as some distro's tend to be a few weeks behind the latest release, that it may take a few weeks to get the latest updates if you installed Metasploit via apt or a similar package manager. We do not have control over these package managers; please go bug your distro vendor if you feel they are delayed in updating their packages.

If, after updating to Metasploit 5.0.87, you are still experiencing Ruby issues with Ruby 2.7, then please raise an issue on the issue tracker as this is something we would like to get fixed. Any Ruby 2.7 issues with versions prior to Metasploit 5.0.87 will likely result in us asking the user to upgrade to Metasploit 5.0.87 first.

TLDR: Already fixed in Metasploit 5.0.87, go get the updates. Community guidelines state that closed issues should not be commented on, and this issue has already been resolved several times with workarounds and an official fix.