Class: BetterCap::Proxy::HTTP::SSL::Fetcher
- Inherits:
-
Net::HTTP
- Object
- Net::HTTP
- BetterCap::Proxy::HTTP::SSL::Fetcher
- Defined in:
- lib/bettercap/proxy/http/ssl/authority.rb
Overview
Simple wrapper class used to fetch a server HTTPS certificate.
Instance Attribute Summary collapse
-
#certificate ⇒ Object
The server HTTPS certificate.
Class Method Summary collapse
-
.fetch(hostname, port) ⇒ Object
Fetch the HTTPS certificate of
hostname
:port
.
Instance Method Summary collapse
-
#on_connect ⇒ Object
Overridden from Net::HTTP in order to save the peer certificate before the connection is closed.
Instance Attribute Details
#certificate ⇒ Object
The server HTTPS certificate.
22 23 24 |
# File 'lib/bettercap/proxy/http/ssl/authority.rb', line 22 def certificate @certificate end |
Class Method Details
.fetch(hostname, port) ⇒ Object
Fetch the HTTPS certificate of hostname
:port
.
29 30 31 32 33 34 35 36 |
# File 'lib/bettercap/proxy/http/ssl/authority.rb', line 29 def self.fetch( hostname, port ) http = self.new( hostname, port ) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE http.head("/") http.certificate end |
Instance Method Details
#on_connect ⇒ Object
Overridden from Net::HTTP in order to save the peer certificate before the connection is closed.
25 26 27 |
# File 'lib/bettercap/proxy/http/ssl/authority.rb', line 25 def on_connect @certificate = peer_cert end |