Class: Pwnlib::MemLeak
- Inherits:
-
Object
- Object
- Pwnlib::MemLeak
- Defined in:
- lib/pwnlib/memleak.rb
Overview
A class caching and heuristic tool for exploiting memory leaks.
Instance Method Summary collapse
-
#b(addr) ⇒ Integer
Leak a byte at *((uint8_t*) addr).
-
#d(addr) ⇒ Integer
Leak a dword at *((uint32_t*) addr).
-
#initialize {|leak_addr| ... } ⇒ MemLeak
constructor
Instantiate a MemLeak object.
-
#n(addr, numb) ⇒ String
Leak
numb
bytes ataddr
. -
#q(addr) ⇒ Integer
Leak a qword at *((uint64_t*) addr).
-
#w(addr) ⇒ Integer
Leak a word at *((uint16_t*) addr).
Constructor Details
#initialize {|leak_addr| ... } ⇒ MemLeak
Instantiate a Pwnlib::MemLeak object.
16 17 18 19 |
# File 'lib/pwnlib/memleak.rb', line 16 def initialize(&block) @leak = block @cache = {} end |
Instance Method Details
#b(addr) ⇒ Integer
Leak a byte at *((uint8_t*) addr).
42 43 44 |
# File 'lib/pwnlib/memleak.rb', line 42 def b(addr) Util::Packing.u8(n(addr, 1)) end |
#d(addr) ⇒ Integer
Leak a dword at *((uint32_t*) addr).
64 65 66 |
# File 'lib/pwnlib/memleak.rb', line 64 def d(addr) Util::Packing.u32(n(addr, 4)) end |
#n(addr, numb) ⇒ String
Leak numb
bytes at addr
. Returns a string with the leaked bytes.
31 32 33 |
# File 'lib/pwnlib/memleak.rb', line 31 def n(addr, numb) (0...numb).map { |i| do_leak(addr + i) }.pack('C*') end |