class CTF::Rop::RelocatableELF
Attributes
elf[R]
offset[R]
Public Class Methods
new(filename, offset = 0)
click to toggle source
# File lib/ctf/rop.rb, line 7 def initialize(filename, offset = 0) @offset = offset @elf = ::Metasm::ELF.decode_file(filename) @functions = {} @elf.symbols.find_all do |s| s.name and s.type == 'FUNC' && s.shndx != 'UNDEF' && s.bind == 'GLOBAL' end.each do |s| @functions[s.name] = s.value end end
Public Instance Methods
function(name)
click to toggle source
# File lib/ctf/rop.rb, line 18 def function(name) if @functions.include? name.to_s @functions[name.to_s] + offset else raise RuntimeError.new("No such function #{name}") end end