Skip to content

Commit 85b00ee

Browse files
committed
Add #present? checks
1 parent ef59d88 commit 85b00ee

File tree

1 file changed

+7
-2
lines changed
  • lib/msf/ui/console/command_dispatcher

1 file changed

+7
-2
lines changed

lib/msf/ui/console/command_dispatcher/db.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,11 @@ def cmd_creds_help
693693
print_line
694694
end
695695

696+
# @param private_type [Symbol] See `Metasploit::Credential::Creation#create_credential`
697+
# @param username [String]
698+
# @param password [String]
699+
# @param realm [String]
700+
# @param realm_type [String] A key in `Metasploit::Model::Realm::Key::SHORT_NAMES`
696701
def creds_add(private_type, username, password=nil, realm=nil, realm_type=nil)
697702
cred_data = {
698703
username: username,
@@ -702,8 +707,8 @@ def creds_add(private_type, username, password=nil, realm=nil, realm_type=nil)
702707
origin_type: :import,
703708
filename: "msfconsole"
704709
}
705-
if realm
706-
if realm_type
710+
if realm.present?
711+
if realm_type.present?
707712
realm_key = Metasploit::Model::Realm::Key::SHORT_NAMES[realm_type]
708713
if realm_key.nil?
709714
valid = Metasploit::Model::Realm::Key::SHORT_NAMES.keys.map{|n|"'#{n}'"}.join(", ")

0 commit comments

Comments
 (0)