class Object

Public Instance Methods

one_gadget(arg = nil, **options) click to toggle source

Shorter way to use one gadget. @param [String?] arg

Can be either +build_id+ or path to libc.

@param [Mixed] options

See {OneGadget#gadgets} for ore information.

@return [Array<OneGadget::Gadget::Gadget>, Array<Integer>]

The gadgets found.

@example

one_gadget('./libc.so.6')
one_gadget('cbfa941a8eb7a11e4f90e81b66fcd5a820995d7c')
one_gadget('./libc.so.6', details: true)
# File lib/one_gadget.rb, line 26
def one_gadget(arg = nil, **options)
  unless arg.nil?
    if arg =~ /\A#{OneGadget::Helper::BUILD_ID_FORMAT}\Z/
      options[:build_id] = arg
    else
      options[:file] = arg
    end
  end
  OneGadget.gadgets(**options)
end