@@ -100,18 +100,19 @@ def cmd_creds_help
100100 print_line "Usage - Adding credentials:"
101101 print_line " creds add uses the following named parameters."
102102 {
103- user : 'Public, usually a username' ,
104- password : 'Private, private_type Password.' ,
105- ntlm : 'Private, private_type NTLM Hash.' ,
106- postgres : 'Private, private_type postgres MD5' ,
107- pkcs12 : 'Private, private_type pkcs12 archive file, must be a file path.' ,
108- 'ssh-key' => 'Private, private_type SSH key, must be a file path.' ,
109- hash : 'Private, private_type Nonreplayable hash' ,
110- jtr : 'Private, private_type John the Ripper hash type.' ,
111- realm : 'Realm, ' ,
112- 'realm-type' => "Realm, realm_type (#{ Metasploit ::Model ::Realm ::Key ::SHORT_NAMES . keys . join ( ' ' ) } ), defaults to domain." ,
113- ca : 'CA, Certificate Authority that issued the pkcs12 certificate' ,
114- 'adcs-template' => 'ADCS Template, template used to issue the pkcs12 certificate'
103+ user : 'Public, usually a username' ,
104+ password : 'Private, private_type Password.' ,
105+ ntlm : 'Private, private_type NTLM Hash.' ,
106+ postgres : 'Private, private_type postgres MD5' ,
107+ pkcs12 : 'Private, private_type pkcs12 archive file, must be a file path.' ,
108+ 'ssh-key' => 'Private, private_type SSH key, must be a file path.' ,
109+ hash : 'Private, private_type Nonreplayable hash' ,
110+ jtr : 'Private, private_type John the Ripper hash type.' ,
111+ realm : 'Realm, ' ,
112+ 'realm-type' => "Realm, realm_type (#{ Metasploit ::Model ::Realm ::Key ::SHORT_NAMES . keys . join ( ' ' ) } ), defaults to domain." ,
113+ 'adcs-ca' => 'CA, Certificate Authority that issued the pkcs12 certificate' ,
114+ 'adcs-template' => 'ADCS Template, template used to issue the pkcs12 certificate' ,
115+ 'pkcs12-password' => 'The password to decrypt the Pkcs12, defaults to an empty password'
115116 } . each_pair do |keyword , description |
116117 print_line " #{ keyword . to_s . ljust 10 } : #{ description } "
117118 end
@@ -208,7 +209,7 @@ def creds_add(*args)
208209 end
209210
210211 begin
211- params . assert_valid_keys ( 'user' , 'password' , 'realm' , 'realm-type' , 'ntlm' , 'ssh-key' , 'hash' , 'address' , 'port' , 'protocol' , 'service-name' , 'jtr' , 'pkcs12' , 'postgres' , 'ca' , 'adcs-template' )
212+ params . assert_valid_keys ( 'user' , 'password' , 'realm' , 'realm-type' , 'ntlm' , 'ssh-key' , 'hash' , 'address' , 'port' , 'protocol' , 'service-name' , 'jtr' , 'pkcs12' , 'postgres' , 'adcs- ca' , 'adcs-template' , 'pkcs12-password ')
212213 rescue ArgumentError => e
213214 print_error ( e . message )
214215 end
@@ -277,11 +278,11 @@ def creds_add(*args)
277278 print_error ( "Failed to add pkcs12 archive: #{ e } " )
278279 end
279280 data [ :private_type ] = :pkcs12
280- data [ :private_data ] = Metasploit :: Credential :: Pkcs12 . build_data (
281- pkcs12 : pkcs12_data ,
282- ca : params [ 'ca' ] ,
283- adcs_template : params [ 'adcs-template' ]
284- )
281+ data [ :private_data ] = pkcs12_data
282+ data [ :private_metadata ] = { }
283+ data [ :private_metadata ] [ :adcs_ca ] = params [ 'adcs-ca' ] if params [ 'adcs- ca' ]
284+ data [ :private_metadata ] [ :adcs_template ] = params [ 'adcs-template' ] if params [ 'adcs-template' ]
285+ data [ :private_metadata ] [ :pkcs12_password ] = params [ 'pkcs12-password' ] if params [ 'pkcs12-password' ]
285286 end
286287
287288 if params . key? 'hash'
@@ -311,7 +312,7 @@ def creds_add(*args)
311312 framework . db . create_credential ( data )
312313 end
313314 rescue ActiveRecord ::RecordInvalid => e
314- print_error ( "Failed to add #{ data [ ' private_type' ] } : #{ e } " )
315+ print_error ( "Failed to add #{ data [ : private_type] } : #{ e } " )
315316 end
316317 end
317318
0 commit comments