Added Argument Error Handling
parent
7e70cb6fe8
commit
e7dc3aa99c
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# $Id$
|
||||
# $Revision$
|
||||
|
||||
#
|
||||
msfbase = __FILE__
|
||||
while File.symlink?(msfbase)
|
||||
msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase))
|
||||
|
@ -41,6 +41,8 @@ module PatternCreate
|
|||
|
||||
if options.empty?
|
||||
raise OptionParser::MissingArgument, 'No options set, try -h for usage'
|
||||
elsif options[:length].blank? && options[:sets]
|
||||
raise OptionParser::MissingArgument, '-l <length> is required'
|
||||
end
|
||||
|
||||
options[:sets] = nil unless options[:sets]
|
||||
|
@ -63,7 +65,6 @@ class Driver
|
|||
pattern = Rex::Text.pattern_create(@opts[:length], @opts[:sets])
|
||||
puts pattern
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -77,4 +78,3 @@ if __FILE__ == $PROGRAM_NAME
|
|||
$stderr.puts "[*] If necessary, please refer to framework.log for more details."
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue