@@ -24,6 +24,7 @@ def initialize
24
24
[
25
25
'et' , #original module
26
26
'Chris John Riley' , #additions
27
+ 'Veit Hailperin <[email protected] >' , # checks for public key size, valid time
27
28
] ,
28
29
'License' => MSF_LICENSE
29
30
)
@@ -47,6 +48,10 @@ def run_host(ip)
47
48
print_status ( "#{ ip } :#{ rport } Subject: #{ cert . subject } " )
48
49
print_status ( "#{ ip } :#{ rport } Issuer: #{ cert . issuer } " )
49
50
print_status ( "#{ ip } :#{ rport } Signature Alg: #{ cert . signature_algorithm } " )
51
+ public_key_size = cert . public_key . n . num_bytes * 8
52
+ print_status ( "#{ ip } :#{ rport } Public Key Size: #{ public_key_size } bits" )
53
+ print_status ( "#{ ip } :#{ rport } Not Valid Before: #{ cert . not_before } " )
54
+ print_status ( "#{ ip } :#{ rport } Not Valid After: #{ cert . not_after } " )
50
55
51
56
# Checks for common properties of self signed certificates
52
57
caissuer = ( /CA Issuers - URI:(.*?),/i ) . match ( cert . extensions . to_s )
@@ -71,6 +76,17 @@ def run_host(ip)
71
76
cert . subject . to_a . each do |n |
72
77
vhostn = n [ 1 ] if n [ 0 ] == 'CN'
73
78
end
79
+ if public_key_size == 1024
80
+ print_status ( "#{ ip } :#{ rport } WARNING: Public Key only 1024 bits" )
81
+ elsif public_key_size < 1024
82
+ print_status ( "#{ ip } :#{ rport } WARNING: Weak Public Key: #{ public_key_size } bits" )
83
+ end
84
+ if cert . not_after < Time . now
85
+ print_status ( "#{ ip } :#{ rport } WARNING: Certificate not valid anymore" )
86
+ end
87
+ if cert . not_before > Time . now
88
+ print_status ( "#{ ip } :#{ rport } WARNING: Certificate not valid yet" )
89
+ end
74
90
75
91
if vhostn
76
92
print_status ( "#{ ip } :#{ rport } has common name #{ vhostn } " )
@@ -93,7 +109,10 @@ def run_host(ip)
93
109
:data => {
94
110
:cn => vhostn ,
95
111
:subject => cert . subject . to_a ,
96
- :algorithm => alg
112
+ :algorithm => alg ,
113
+ :valid_from => cert . not_before ,
114
+ :valid_after => cert . not_after ,
115
+ :key_size => public_key_size
97
116
98
117
}
99
118
)
0 commit comments