Aux mode updates

git-svn-id: file:///home/svn/incoming/trunk@3564 4d416f70-5f16-0410-b530-b9f4589650da
unstable
HD Moore 2006-03-09 17:28:37 +00:00
parent 1f9b1d3806
commit 5411701d3f
6 changed files with 82 additions and 2 deletions

View File

@ -14,11 +14,16 @@ module Auxiliary
# Wraps the execution process in a simple wrapper.
#
def self.run_simple(mod, opts = {})
if (not mod.action)
raise MissingActionError, "You must specify a valid Action", caller
end
# Initialize user interaction
mod.init_ui(
opts['LocalInput'],
opts['LocalOutput'])
mod.run()
# Reset the user interface

View File

@ -13,6 +13,11 @@ module Msf
class Auxiliary < Msf::Module
#
# Auxiliary mixins
#
require 'msf/core/auxiliary/tcp'
#
# Returns MODULE_AUX to indicate that this is an auxiliary module.
#
@ -48,6 +53,24 @@ class Auxiliary < Msf::Module
print_status("Running the default Auxiliary handler")
end
def auxiliary_commands
return { }
end
def action
sa = datastore['ACTION']
return find_action(default_action) if not sa
return find_action(sa)
end
def find_action(name)
return nil if not name
actions.each do |a|
return a if a.name == name
end
return nil
end
#
# Allow access to the hash table of actions and the string containing
# the default action

View File

@ -142,6 +142,19 @@ module ExploitError
end
end
###
#
# This exception is raised to indicate a general auxiliary error.
#
###
module AuxiliaryError
include Exception
def to_s
"An auxiliary error occurred."
end
end
###
#
# This exception is raised if a target was not specified when attempting to
@ -170,6 +183,20 @@ class MissingPayloadError < ArgumentError
end
end
###
#
# This exception is raised if a valid action was not specified when attempting to
# run an auxiliary module.
#
###
class MissingActionError < ArgumentError
include AuxiliaryError
def to_s
"A valid action has not been selected."
end
end
###
#
# This exception is raised if an incompatible payload was specified when

View File

@ -1113,7 +1113,7 @@ class Core
def option_values_actions
res = []
if (active_module.actions)
active_module.actions.each { |i| res << i[0] }
active_module.actions.each { |i| res << i.name }
end
return res
end

View File

@ -46,5 +46,22 @@ module Arch
end
end
#
# This routine reports the endianess of a given architecture
#
def self.endianr(arch, addr)
case arch
when ARCH_X86
return ENDIAN_LITTLE
when ARCH_MIPS # ambiguous
return ENDIAN_BIG
when ARCH_PPC # ambiguous
return ENDIAN_BIG
when ARCH_SPARC
return ENDIAN_BIG
end
return ENDIAN_LITTLE
end
end
end

View File

@ -79,3 +79,11 @@ ARCH_TYPES =
]
ARCH_ALL = ARCH_TYPES
#
# Endian constants
#
ENDIAN_LITTLE = 0
ENDIAN_BIG = 1