speed up options parsing (only require framework when running)
parent
7cfc4d4523
commit
dd0d68a2b4
|
@ -8,10 +8,6 @@ end
|
|||
$LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(msfbase), '..', '..', 'lib')))
|
||||
$LOAD_PATH.unshift(ENV['MSF_LOCAL_LIB']) if ENV['MSF_LOCAL_LIB']
|
||||
|
||||
require 'msfenv'
|
||||
require 'msf/core'
|
||||
require 'msf/base'
|
||||
require 'rex/text'
|
||||
require 'optparse'
|
||||
|
||||
module PatternCreate
|
||||
|
@ -40,10 +36,15 @@ module PatternCreate
|
|||
|
||||
if options.empty?
|
||||
raise OptionParser::MissingArgument, 'No options set, try -h for usage'
|
||||
elsif options[:length].blank? && options[:sets]
|
||||
elsif options[:length].nil? && options[:sets]
|
||||
raise OptionParser::MissingArgument, '-l <length> is required'
|
||||
end
|
||||
|
||||
require 'msfenv'
|
||||
require 'msf/core'
|
||||
require 'msf/base'
|
||||
require 'rex/text'
|
||||
|
||||
options[:sets] = nil unless options[:sets]
|
||||
|
||||
options
|
||||
|
|
|
@ -8,10 +8,6 @@ end
|
|||
$LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(msfbase), '..', '..', 'lib')))
|
||||
$LOAD_PATH.unshift(ENV['MSF_LOCAL_LIB']) if ENV['MSF_LOCAL_LIB']
|
||||
|
||||
require 'msfenv'
|
||||
require 'msf/core'
|
||||
require 'msf/base'
|
||||
require 'rex/text'
|
||||
require 'optparse'
|
||||
|
||||
module PatternOffset
|
||||
|
@ -19,7 +15,7 @@ module PatternOffset
|
|||
def self.parse(args)
|
||||
options = {}
|
||||
parser = OptionParser.new do |opt|
|
||||
opt.banner = "Usage: #{__FILE__} [options]\nExample: #{__FILE__} -q Aa3A|0x39634138|0xFFFF4138\n[*] Exact match at offset 9"
|
||||
opt.banner = "Usage: #{__FILE__} [options]\nExample: #{__FILE__} -q Aa3A\n[*] Exact match at offset 9"
|
||||
opt.separator ''
|
||||
opt.separator 'Options:'
|
||||
|
||||
|
@ -45,9 +41,9 @@ module PatternOffset
|
|||
|
||||
if options.empty?
|
||||
raise OptionParser::MissingArgument, 'No options set, try -h for usage'
|
||||
elsif options[:query].blank?
|
||||
elsif options[:query].nil?
|
||||
raise OptionParser::MissingArgument, '-q <query> is required'
|
||||
elsif options[:length].blank? && options[:sets]
|
||||
elsif options[:length].nil? && options[:sets]
|
||||
raise OptionParser::MissingArgument, '-l <length> is required'
|
||||
end
|
||||
|
||||
|
@ -69,6 +65,11 @@ module PatternOffset
|
|||
end
|
||||
|
||||
def run
|
||||
require 'msfenv'
|
||||
require 'msf/core'
|
||||
require 'msf/base'
|
||||
require 'rex/text'
|
||||
|
||||
query = (@opts[:query])
|
||||
|
||||
if query.length >= 8 && query.hex > 0
|
||||
|
|
Loading…
Reference in New Issue