Module: StructFu

Defined in:
lib/msf/core/exploit/remote/ipv6.rb

Overview

packetfu 2.0.0 (the latest release) ships a StructFu#typecast that recovers the setter it was called from by matching the caller backtrace against the MRI <= 3.3 format (`method='). Ruby 3.4 reformatted backtraces to 'Klass#method=', so the old pattern returns nil and every PacketFu field assignment - including the ones inside PacketFu::IPv6Packet.new itself - raises "undefined method '[]' for nil". Grab the trailing setter name in a way that works on both formats until packetfu is fixed upstream. Safe on 3.2/3.3 as well; the captured name is identical there.

Instance Method Summary collapse

Instance Method Details

#typecast(i) ⇒ Object



13
14
15
16
# File 'lib/msf/core/exploit/remote/ipv6.rb', line 13

def typecast(i)
  name = caller(1..1).first[/([A-Za-z0-9_]+)=['`]/, 1]
  self[name.to_sym].read i
end