Module: Ronin::Exploits::Mixins::NOPS
- Included in:
- SEH, StackOverflow
- Defined in:
- lib/ronin/exploits/mixins/nops.rb
Overview
Generates NOP buffers.
Examples
include Mixins::NOPS
arch :x86_64
def build
buffer = ('A' * 1024) + nops(100) + payload
# ...
end
Constant Summary collapse
- NOPS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Nop instructions for various architectures.
{ x86: "\x90".b, # nop x86_64: "\x90".b, # nop arm: "\x05P\xa0\xe1".b, # mov r5, r5 arm64: "\xe5\x03\x05\xaa".b # mov x5, x5 # TODO: mips # TODO: mips64 # TODO: ppc # TODO: ppc64 }
Instance Method Summary collapse
-
#nop ⇒ String
An individual NOP instruction for the target architecture of the exploit.
-
#nops(size) ⇒ String
Creates a buffer of NOPs.
-
#perform_validate ⇒ Object
Validates that the exploit defined an
arch
method and that all required params are set.
Instance Method Details
#nop ⇒ String
An individual NOP instruction for the target architecture of the exploit.
93 94 95 96 97 |
# File 'lib/ronin/exploits/mixins/nops.rb', line 93 def nop NOPS.fetch(arch) do raise(NotImplementedError,"no NOP string is currently defined for the architecture: #{arch.inspect}") end end |
#nops(size) ⇒ String
Creates a buffer of NOPs.
113 114 115 116 117 |
# File 'lib/ronin/exploits/mixins/nops.rb', line 113 def nops(size) nop = self.nop return nop * (size / nop.bytesize) end |
#perform_validate ⇒ Object
Validates that the exploit defined an arch
method and that all
required params are set.
71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/ronin/exploits/mixins/nops.rb', line 71 def perform_validate unless respond_to?(:arch) raise(ValidationError,"exploit #{self.class} did not include Ronin::Exploits::Metadata::Arch or Ronin::Exploits::Mixins::HasTargets") end unless arch raise(ValidationError,"exploit #{self.class} did not include define an architecture") end super() end |