wordlist validators
added custom fielpath vaidator and added validations to the wordlist classbug/bundler_fix
parent
466576d03f
commit
1dd69a5228
|
@ -0,0 +1 @@
|
||||||
|
require 'metasploit/framework/file_path_validator'
|
|
@ -0,0 +1,16 @@
|
||||||
|
module Metasploit
|
||||||
|
module Framework
|
||||||
|
# This is a ActiveModel custom validator that assumes the attribute
|
||||||
|
# is supposed to be the path to a regular file. It checks whether the
|
||||||
|
# file exists and whether or not it is a regular file.
|
||||||
|
class FilePathValidator < ActiveModel::EachValidator
|
||||||
|
|
||||||
|
def validate_each(record, attribute, value)
|
||||||
|
unless ::File.file? value
|
||||||
|
record.errors[attribute] << (options[:message] || "is not a valid path to a regular file")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
require 'metasploit/framework/jtr/invalid_wordlist'
|
||||||
|
|
||||||
module Metasploit
|
module Metasploit
|
||||||
module Framework
|
module Framework
|
||||||
|
@ -48,6 +49,8 @@ module Metasploit
|
||||||
# @return [FalseClass] if you do not want to seed the wordlist with existing hostnames from the database
|
# @return [FalseClass] if you do not want to seed the wordlist with existing hostnames from the database
|
||||||
attr_accessor :use_hostnames
|
attr_accessor :use_hostnames
|
||||||
|
|
||||||
|
validates :custom_wordlist, :'Metasploit::Framework::File_path' => true
|
||||||
|
|
||||||
validates :mutate,
|
validates :mutate,
|
||||||
inclusion: { in: [true, false] }
|
inclusion: { in: [true, false] }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue