Method: Xploit::Libc#initialize

Defined in:
lib/xploit/libc.rb

#initialize(path) ⇒ Libc

Returns a new instance of Libc.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/xploit/libc.rb', line 7

def initialize(path)
  
  @func = {}
  @string = {}
  
  res = `nm -t d -D #{path}`.split("\n")
  res.each do |line|
    offset, name = line.match(/(.+) . (.+)/)[1,2]
    @func[name] = offset.to_i
  end
  
  res = `strings -tx -a -t d #{path}`.split("\n")
  res.each do |line|
    offset, name = line.match(/(.+) (.+)/)[1,2]
    @string[name] = offset.to_i
  end
  
end