Module: Pwnlib::Runner
- Included in:
- Pwn
- Defined in:
- lib/pwnlib/runner.rb
Overview
This module collects the methods for executing codes, e.g., assembly code, assembled machine code, etc.
Class Method Summary collapse
-
.run_assembly(assembly) ⇒ Pwnlib::Tubes::Process
Given an assembly listing, assemble and execute it.
-
.run_shellcode(bytes) ⇒ Pwnlib::Tubes::Process
Given assembled machine code bytes, execute them.
Class Method Details
.run_assembly(assembly) ⇒ Pwnlib::Tubes::Process
Given an assembly listing, assemble and execute it.
23 24 25 |
# File 'lib/pwnlib/runner.rb', line 23 def run_assembly(assembly) run_shellcode(::Pwnlib::Asm.asm(assembly)) end |
.run_shellcode(bytes) ⇒ Pwnlib::Tubes::Process
Given assembled machine code bytes, execute them.
47 48 49 50 51 |
# File 'lib/pwnlib/runner.rb', line 47 def run_shellcode(bytes) file = ::Pwnlib::Asm.make_elf(bytes, to_file: true) at_exit { FileUtils.rm_f(file) if File.exist?(file) } ::Pwnlib::Tubes::Process.new(file) end |