Module: Msf::PacketFuCompat

Defined in:
lib/msf/core/packet_fu_compat.rb

Overview

PacketFu 2.0.0 derives field names from formatted backtraces, which changed in Ruby 3.4. Use the structured method name until the dependency includes https://github.com/packetfu/packetfu/pull/218, then remove this workaround.

Instance Method Summary collapse

Instance Method Details

#typecast(value) ⇒ Object

Converts a setter's input using the existing PacketFu field object.

Parameters:

  • value (Object) —

    input accepted by the PacketFu field's read method

Returns:

  • (Object) —

    the field returned by PacketFu after conversion



14
15
16
17
# File 'lib/msf/core/packet_fu_compat.rb', line 14

def typecast(value)
  field = caller_locations(1, 1).first.base_label.delete_suffix('=')
  self[field.to_sym].read(value)
end