Class: OneGadget::Fetcher::Objdump
- Inherits:
-
Object
- Object
- OneGadget::Fetcher::Objdump
- Defined in:
- lib/one_gadget/fetchers/objdump.rb
Overview
Utilities for fetching instructions from libc using objdump.
Instance Method Summary collapse
-
#command(start: nil, stop: nil) ⇒ String
The CLI command to be executed.
-
#extra_options=(options) ⇒ Object
Set the extra options to be passed to objdump.
-
#initialize(file, arch) ⇒ Objdump
constructor
Instantiate an Objdump object.
Constructor Details
#initialize(file, arch) ⇒ Objdump
Instantiate an OneGadget::Fetcher::Objdump object.
16 17 18 19 20 |
# File 'lib/one_gadget/fetchers/objdump.rb', line 16 def initialize(file, arch) @file = file @arch = arch @options = [] end |
Instance Method Details
#command(start: nil, stop: nil) ⇒ String
Returns The CLI command to be executed.
33 34 35 36 37 38 39 40 41 |
# File 'lib/one_gadget/fetchers/objdump.rb', line 33 def command(start: nil, stop: nil) # --dwarf-start=0 is to make sure `suppress_bfd_header` is true to eliminate the file path in the output, see # issue #204 for more details. # Note: We might need to update this when the objdump act differently in the future. cmd = [bin, '--dwarf-start=0', '--no-show-raw-insn', '-w', '-d', *@options, @file] cmd.push('--start-address', start) if start cmd.push('--stop-address', stop) if stop ::Shellwords.join(cmd) end |
#extra_options=(options) ⇒ Object
Set the extra options to be passed to objdump.
26 27 28 |
# File 'lib/one_gadget/fetchers/objdump.rb', line 26 def () @options = end |