Mirror of metasploit
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ropdb.rb 793B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. # -*- coding: binary -*-
  2. require 'rex/exploitation/ropdb'
  3. ##
  4. #
  5. # This mixin provides an interface to selecting a ROP chain, or creating a payload with
  6. # ROP using the Rex::Exploitation::RopDb class.
  7. #
  8. ##
  9. module Msf
  10. module Exploit::RopDb
  11. def initialize(info = {})
  12. @rop_db = Rex::Exploitation::RopDb.new
  13. super
  14. end
  15. def has_rop?(rop)
  16. @rop_db.has_rop?(rop)
  17. end
  18. def select_rop(rop, opts={})
  19. rop = @rop_db.select_rop(rop, opts)
  20. return rop
  21. end
  22. def generate_rop_payload(rop, payload, opts={})
  23. opts['badchars'] ||= payload_badchars
  24. rop_payload = @rop_db.generate_rop_payload(rop, payload, opts)
  25. return rop_payload
  26. end
  27. def rop_junk
  28. rand_text_alpha(4).unpack("V")[0].to_i
  29. end
  30. def rop_nop
  31. make_nops(4).unpack("V")[0].to_i
  32. end
  33. end
  34. end