Skip to content

Commit 91fe78e

Browse files
David MaloneyDavid Maloney
authored andcommitted
refactor pem parser to use the rex-socket gem version
use rex-socket's pem aprser instead of the old one we used to have in rex::parser MS-1715
1 parent 45ab061 commit 91fe78e

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

lib/msf/core/handler/reverse_http.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
require 'rex/sync/ref'
44
require 'rex/payloads/meterpreter/uri_checksum'
55
require 'rex/post/meterpreter'
6-
require 'rex/parser/x509_certificate'
6+
require 'rex/socket/x509_certificate'
77
require 'msf/core/payload/windows/verify_ssl'
88
require 'rex/user_agent'
99

lib/msf/core/payload/windows/verify_ssl.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: binary -*-
22

33
require 'msf/core'
4-
require 'rex/parser/x509_certificate'
4+
require 'rex/socket/x509_certificate'
55

66
module Msf
77

@@ -25,7 +25,7 @@ def get_ssl_cert_hash(verify_cert, handler_cert)
2525
raise ArgumentError, "Verifying SSL cert is enabled but no handler cert is configured"
2626
end
2727

28-
hash = Rex::Parser::X509Certificate.get_cert_file_hash(handler_cert)
28+
hash = Rex::Socket::X509Certificate.get_cert_file_hash(handler_cert)
2929
print_status("Meterpreter will verify SSL Certificate with SHA1 hash #{hash.unpack("H*").first}")
3030
hash
3131
end

lib/rex/payloads/meterpreter/config.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
require 'msf/core/payload/uuid'
33
require 'msf/core/payload/windows'
44
require 'msf/core/reflective_dll_loader'
5-
require 'rex/parser/x509_certificate'
5+
require 'rex/socket/x509_certificate'
66

77
class Rex::Payloads::Meterpreter::Config
88

lib/rex/post/meterpreter/client_core.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
require 'rex/payloads/meterpreter/uri_checksum'
1414

1515
# certificate hash checking
16-
require 'rex/parser/x509_certificate'
16+
require 'rex/socket/x509_certificate'
1717

1818
module Rex
1919
module Post
@@ -686,7 +686,7 @@ def transport_prepare_request(method, opts={})
686686
request.add_tlv(TLV_TYPE_TRANS_UA, opts[:ua])
687687

688688
if transport == METERPRETER_TRANSPORT_HTTPS && opts[:cert]
689-
hash = Rex::Parser::X509Certificate.get_cert_file_hash(opts[:cert])
689+
hash = Rex::Socket::X509Certificate.get_cert_file_hash(opts[:cert])
690690
request.add_tlv(TLV_TYPE_TRANS_CERT_HASH, hash)
691691
end
692692

lib/rex/socket/ssl_tcp_server.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
require 'rex/socket'
33
require 'rex/socket/tcp_server'
44
require 'rex/io/stream_server'
5-
require 'rex/parser/x509_certificate'
5+
require 'rex/socket/x509_certificate'
66

77
###
88
#
@@ -115,7 +115,7 @@ def accept(opts = {})
115115
# @param [String] ssl_cert
116116
# @return [String, String, Array]
117117
def self.ssl_parse_pem(ssl_cert)
118-
Rex::Parser::X509Certificate.parse_pem(ssl_cert)
118+
Rex::Socket::X509Certificate.parse_pem(ssl_cert)
119119
end
120120

121121
#

0 commit comments

Comments
 (0)