Files
beef/lib/filter/command.rb
wade@bindshell.net 49647ff8b4 filter areas broken up into the their own files
git-svn-id: https://beef.googlecode.com/svn/trunk@534 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9
2010-11-16 12:15:12 +00:00

51 lines
1.5 KiB
Ruby

module BeEF
module Filter
# check if the string is a valid path from a HTTP request
def self.is_valid_path_info?(str)
return false if str.nil?
return false if not str.is_a? String
return false if BeEF::Filter.has_non_printable_char?(str)
true
end
# check if the command id valid
def self.is_valid_commmamd_id?(str)
return false if not BeEF::Filter.is_non_empty_string?(str)
return false if not BeEF::Filter.nums_only?(str)
true
end
# check if the session id valid
def self.is_valid_hook_session_id?(str)
return false if not BeEF::Filter.is_non_empty_string?(str)
return false if not BeEF::Filter.has_valid_key_chars?(str)
true
end
# check if valid command module datastore key
def self.is_valid_commmamd_module_datastore_key?(str)
return false if not BeEF::Filter.is_non_empty_string?(str)
return BeEF::Filter.has_valid_key_chars?(str)
end
# check if valid command module datastore value
def self.is_valid_commmamd_module_datastore_param?(str)
return false if not BeEF::Filter.is_non_empty_string?(str)
return false if BeEF::Filter.has_null?(str)
return false if BeEF::Filter.has_non_printable_char?(str)
true
end
# check for word and some punc chars
def self.has_valid_key_chars?(str)
return false if not BeEF::Filter.is_non_empty_string?(str)
(str =~ /[^\w_-]/).nil?
end
end
end