2005-07-09 21:18:49 +00:00
|
|
|
require 'msf/core'
|
2005-05-21 17:57:00 +00:00
|
|
|
|
|
|
|
module Msf
|
|
|
|
|
|
|
|
###
|
|
|
|
#
|
|
|
|
# This class acts as the base class for all nop generators.
|
|
|
|
#
|
|
|
|
###
|
|
|
|
class Nop < Msf::Module
|
|
|
|
|
2005-10-19 03:20:20 +00:00
|
|
|
#
|
|
|
|
# Returns MODULE_NOP to indicate that this is a NOP module.
|
|
|
|
#
|
2005-07-14 20:05:41 +00:00
|
|
|
def self.type
|
|
|
|
return MODULE_NOP
|
|
|
|
end
|
|
|
|
|
2005-10-19 03:20:20 +00:00
|
|
|
#
|
|
|
|
# Returns MODULE_NOP to indicate that this is a NOP module.
|
|
|
|
#
|
2005-07-10 00:49:12 +00:00
|
|
|
def type
|
|
|
|
return MODULE_NOP
|
|
|
|
end
|
|
|
|
|
2005-11-24 20:41:56 +00:00
|
|
|
#
|
|
|
|
# Initializes the NOP generator, defaulting it to being usable on all
|
|
|
|
# platforms.
|
|
|
|
#
|
|
|
|
def initialize(info = {})
|
|
|
|
super({
|
|
|
|
'Platform' => '' # All platforms by default
|
|
|
|
}.update(info))
|
|
|
|
end
|
|
|
|
|
2005-05-21 17:57:00 +00:00
|
|
|
#
|
|
|
|
# Stub method for generating a sled with the provided arguments. Derived
|
|
|
|
# Nop implementations must supply a length and can supply one or more of
|
|
|
|
# the following options:
|
|
|
|
#
|
|
|
|
# - Random (true/false)
|
|
|
|
# Indicates that the caller desires random NOPs (if supported).
|
|
|
|
# - SaveRegisters (array)
|
|
|
|
# The list of registers that should not be clobbered by the NOP
|
|
|
|
# generator.
|
2005-07-14 06:34:58 +00:00
|
|
|
# - BadChars (string)
|
2005-05-21 17:57:00 +00:00
|
|
|
# The list of characters that should be avoided by the NOP
|
|
|
|
# generator.
|
|
|
|
#
|
|
|
|
def generate_sled(length, opts)
|
|
|
|
return nil
|
|
|
|
end
|
|
|
|
|
2005-07-12 22:33:46 +00:00
|
|
|
#
|
2005-11-28 12:40:13 +00:00
|
|
|
# Default repetition threshold when finding nop characters.
|
2005-07-12 22:33:46 +00:00
|
|
|
#
|
2005-05-21 17:57:00 +00:00
|
|
|
def nop_repeat_threshold
|
|
|
|
return 10000
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|