Revert "Merge pull request #101 from chao-mu/master"
Reverting the OptRegexp commit from chao-mu. Before committing to master, this option type needs to be tested on the various mainstream UI's (Metasploit Pro, msfgui, and Armitage) to see if they behave as reasonably as msfconsole. Each UI tends to handle option setting, passing, and display in their own special way. This should make it back in by Wednesday, assuming all goes well. [See #101] This reverts commitunstable84db5a21fc
, reversing changes made to24aaf85a1b
.
parent
2e8122dc88
commit
c5ce575543
|
@ -312,9 +312,9 @@ class ReadableText
|
||||||
next if (opt.advanced?)
|
next if (opt.advanced?)
|
||||||
next if (opt.evasion?)
|
next if (opt.evasion?)
|
||||||
|
|
||||||
val_display = opt.display_value(mod.datastore[name] || opt.default)
|
val = mod.datastore[name] || opt.default.to_s
|
||||||
|
|
||||||
tbl << [ name, val_display, opt.required? ? "yes" : "no", opt.desc ]
|
tbl << [ name, val.to_s, opt.required? ? "yes" : "no", opt.desc ]
|
||||||
}
|
}
|
||||||
|
|
||||||
return tbl.to_s
|
return tbl.to_s
|
||||||
|
|
|
@ -81,13 +81,6 @@ class OptBase
|
||||||
value
|
value
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
|
||||||
# Returns a string representing a user-friendly display of the chosen value
|
|
||||||
#
|
|
||||||
def display_value(value)
|
|
||||||
value.to_s
|
|
||||||
end
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# The name of the option.
|
# The name of the option.
|
||||||
#
|
#
|
||||||
|
@ -144,7 +137,6 @@ end
|
||||||
# OptEnum - Select from a set of valid values
|
# OptEnum - Select from a set of valid values
|
||||||
# OptAddressRange - A subnet or range of addresses
|
# OptAddressRange - A subnet or range of addresses
|
||||||
# OptSession - A session identifier
|
# OptSession - A session identifier
|
||||||
# OptRegexp - Valid Ruby regular expression
|
|
||||||
#
|
#
|
||||||
###
|
###
|
||||||
|
|
||||||
|
@ -448,44 +440,6 @@ class OptInt < OptBase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
###
|
|
||||||
#
|
|
||||||
# Regexp option
|
|
||||||
#
|
|
||||||
###
|
|
||||||
class OptRegexp < OptBase
|
|
||||||
def type
|
|
||||||
return 'regexp'
|
|
||||||
end
|
|
||||||
|
|
||||||
def valid?(value)
|
|
||||||
unless super
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
begin
|
|
||||||
Regexp.compile(value)
|
|
||||||
|
|
||||||
return true
|
|
||||||
rescue RegexpError => e
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def normalize(value)
|
|
||||||
return Regexp.compile(value)
|
|
||||||
end
|
|
||||||
|
|
||||||
def display_value(value)
|
|
||||||
if value.kind_of?(Regexp)
|
|
||||||
return value.source
|
|
||||||
elsif value.kind_of?(String)
|
|
||||||
return display_value(normalize(value))
|
|
||||||
end
|
|
||||||
|
|
||||||
return super
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
###
|
###
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
|
||||||
##
|
##
|
||||||
# $Id$
|
# $Id$
|
||||||
##
|
##
|
||||||
|
@ -11,12 +12,9 @@
|
||||||
|
|
||||||
require 'msf/core'
|
require 'msf/core'
|
||||||
require 'rex'
|
require 'rex'
|
||||||
require 'msf/core/post/windows/railgun'
|
|
||||||
|
|
||||||
class Metasploit3 < Msf::Post
|
class Metasploit3 < Msf::Post
|
||||||
|
|
||||||
include Msf::Post::Windows::Railgun
|
|
||||||
|
|
||||||
def initialize(info={})
|
def initialize(info={})
|
||||||
super( update_info( info,
|
super( update_info( info,
|
||||||
'Name' => 'railgun_testing',
|
'Name' => 'railgun_testing',
|
||||||
|
@ -30,25 +28,26 @@ class Metasploit3 < Msf::Post
|
||||||
[
|
[
|
||||||
OptInt.new("ERR_CODE" , [true, "Error code to reverse lookup", 0x420]),
|
OptInt.new("ERR_CODE" , [true, "Error code to reverse lookup", 0x420]),
|
||||||
OptInt.new("WIN_CONST", [true, "Windows constant to reverse lookup", 4]),
|
OptInt.new("WIN_CONST", [true, "Windows constant to reverse lookup", 4]),
|
||||||
OptRegexp.new("WCREGEX", [false,"Regexp to apply to constant rev lookup", '^SERVICE']),
|
OptString.new("WCREGEX", [false,"Regexp to apply to constant rev lookup", "^SERVICE"]),
|
||||||
OptRegexp.new("ECREGEX", [false,"Regexp to apply to error code lookup", '^ERROR_SERVICE_']),
|
OptString.new("ECREGEX", [false,"Regexp to apply to error code lookup", "^ERROR_SERVICE_"]),
|
||||||
], self.class)
|
], self.class)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def run
|
def run
|
||||||
print_debug datastore['ECREGEX']
|
|
||||||
print_status("Running against session #{datastore["SESSION"]}")
|
print_status("Running against session #{datastore["SESSION"]}")
|
||||||
print_status("Session type is #{session.type}")
|
print_status("Session type is #{session.type}")
|
||||||
|
|
||||||
|
@rg = session.railgun
|
||||||
|
|
||||||
print_status()
|
print_status()
|
||||||
print_status("TESTING: select_const_names on #{datastore['WIN_CONST']} filtering by #{datastore['WCREGEX'].to_s}")
|
print_status("TESTING: const_reverse_lookup on #{datastore['WIN_CONST']} filtering by #{datastore['WCREGEX'].to_s}")
|
||||||
results = select_const_names(datastore['WIN_CONST'],datastore['WCREGEX'])
|
results = @rg.const_reverse_lookup(datastore['WIN_CONST'],datastore['WCREGEX'])
|
||||||
print_status("RESULTS: #{results.class} #{results.pretty_inspect}")
|
print_status("RESULTS: #{results.class} #{results.pretty_inspect}")
|
||||||
|
|
||||||
print_status()
|
print_status()
|
||||||
print_status("TESTING: error_lookup on #{datastore['ERR_CODE']} filtering by #{datastore['ECREGEX'].to_s}")
|
print_status("TESTING: error_lookup on #{datastore['ERR_CODE']} filtering by #{datastore['ECREGEX'].to_s}")
|
||||||
results = lookup_error(datastore['ERR_CODE'],datastore['ECREGEX'])
|
results = @rg.error_lookup(datastore['ERR_CODE'],datastore['ECREGEX'])
|
||||||
print_status("RESULTS: #{results.class} #{results.inspect}")
|
print_status("RESULTS: #{results.class} #{results.inspect}")
|
||||||
|
|
||||||
print_status()
|
print_status()
|
||||||
|
|
Loading…
Reference in New Issue