Class: Msf::Exploit::Remote::Pkcs12::StoredPkcs12

Inherits:
Object
  • Object
show all
Defined in:
lib/msf/core/exploit/remote/pkcs12/stored_pkcs12.rb

Instance Method Summary collapse

Constructor Details

#initialize(pkcs12) ⇒ StoredPkcs12

Returns a new instance of StoredPkcs12.



4
5
6
# File 'lib/msf/core/exploit/remote/pkcs12/stored_pkcs12.rb', line 4

def initialize(pkcs12)
  @pkcs12 = pkcs12
end

Instance Method Details

#adcs_caObject



16
17
18
# File 'lib/msf/core/exploit/remote/pkcs12/stored_pkcs12.rb', line 16

def adcs_ca
  private_cred.adcs_ca || ''
end

#adcs_templateObject



20
21
22
# File 'lib/msf/core/exploit/remote/pkcs12/stored_pkcs12.rb', line 20

def adcs_template
  private_cred.adcs_template || ''
end

#expired?(now = Time.now) ⇒ TrueClass, FalseClass

Returns True if the certificate is valid within the not_before/not_after, false otherwise.

Returns:

  • (TrueClass, FalseClass)

    True if the certificate is valid within the not_before/not_after, false otherwise



41
42
43
44
# File 'lib/msf/core/exploit/remote/pkcs12/stored_pkcs12.rb', line 41

def expired?(now = Time.now)
  cert = openssl_pkcs12.certificate
  !now.between?(cert.not_before, cert.not_after)
end

#idObject



8
9
10
# File 'lib/msf/core/exploit/remote/pkcs12/stored_pkcs12.rb', line 8

def id
  @pkcs12.id
end

#openssl_pkcs12Object



12
13
14
# File 'lib/msf/core/exploit/remote/pkcs12/stored_pkcs12.rb', line 12

def openssl_pkcs12
  private_cred.openssl_pkcs12
end

#private_credObject



24
25
26
# File 'lib/msf/core/exploit/remote/pkcs12/stored_pkcs12.rb', line 24

def private_cred
  @pkcs12.private
end

#realmObject



32
33
34
# File 'lib/msf/core/exploit/remote/pkcs12/stored_pkcs12.rb', line 32

def realm
  @pkcs12.realm&.value || ''
end

#statusObject



36
37
38
# File 'lib/msf/core/exploit/remote/pkcs12/stored_pkcs12.rb', line 36

def status
  private_cred.status || ''
end

#usernameObject



28
29
30
# File 'lib/msf/core/exploit/remote/pkcs12/stored_pkcs12.rb', line 28

def username
  @pkcs12.public&.username || ''
end