Skip to content

Commit 2013111

Browse files
committed
Add verify_ssl file (missed in prev commit)
1 parent 9c9d333 commit 2013111

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# -*- coding: binary -*-
2+
3+
require 'msf/core'
4+
require 'rex/parser/x509_certificate'
5+
6+
module Msf
7+
8+
###
9+
#
10+
# Implements SSL validation check options
11+
#
12+
###
13+
14+
module Payload::Windows::VerifySsl
15+
16+
#
17+
# Get the SSL hash from the certificate, if required.
18+
#
19+
def get_ssl_cert_hash(verify_cert, handler_cert)
20+
unless verify_cert.to_s =~ /^(t|y|1)/i
21+
return nil
22+
end
23+
24+
unless handler_cert
25+
raise ArgumentError, "Verifying SSL cert is enabled but no handler cert is configured"
26+
end
27+
28+
hash = Rex::Parser::X509Certificate.get_cert_file_hash(handler_cert)
29+
print_status("Meterpreter will verify SSL Certificate with SHA1 hash #{hash.unpack("H*").first}")
30+
hash
31+
end
32+
33+
end
34+
35+
end
36+

0 commit comments

Comments
 (0)