Module: Ronin::Support::Network::SSL::Mixin
- Included in:
- Mixin, Ronin::Support::Network::SMTP::Mixin, TLS::Mixin
- Defined in:
- lib/ronin/support/network/ssl/mixin.rb
Overview
Provides helper methods for communicating with SSL-enabled services.
Instance Method Summary collapse
-
#ssl_accept(**kwargs) {|client| ... } ⇒ nil
Creates a new SSL socket listening on a given host and port, accepts only one client and then stops listening.
-
#ssl_banner(host, port, **kwargs) {|banner| ... } ⇒ String
Reads the banner from the service running on the given host and port.
-
#ssl_cert(host, port, **kwargs) ⇒ Crypto::Cert
Connects to the host and port and returns the server's certificate.
-
#ssl_connect(host, port, **kwargs) {|ssl_socket| ... } ⇒ OpenSSL::SSL::SSLSocket?
Establishes a SSL connection.
-
#ssl_connect_and_send(data, host, port, **kwargs) {|ssl_socket| ... } ⇒ Object
Creates a new SSL connection and sends the given data.
-
#ssl_context(**kwargs) ⇒ OpenSSL::SSL::SSLContext
Creates a new SSL Context.
-
#ssl_open?(host, port, **kwargs) ⇒ Boolean?
Tests whether a remote SSLed TCP port is open.
-
#ssl_send(data, host, port, **kwargs) ⇒ true
Connects to a specified host and port, sends the given data and then closes the connection.
-
#ssl_server(**kwargs) {|server| ... } ⇒ OpenSSL::SSL::SSLServer
Creates a new SSL server listening on a given host and port.
-
#ssl_server_loop(**kwargs) {|client| ... } ⇒ nil
Creates a new SSL socket listening on a given host and port, accepting clients in a loop.
-
#ssl_server_session(**kwargs) {|server| ... } ⇒ OpenSSL::SSL::SSLServer
Creates a new temporary SSL server listening on a given host and port.
-
#ssl_server_socket(socket, **kwargs) ⇒ OpenSSL::SSL::SSLSocket
Accepts an SSL session from an existing TCP socket.
-
#ssl_socket(socket, **kwargs) ⇒ OpenSSL::SSL::SSLSocket
Initiates an SSL session with an existing TCP socket.
Instance Method Details
#ssl_accept(**kwargs) {|client| ... } ⇒ nil
Creates a new SSL socket listening on a given host and port, accepts only one client and then stops listening.
504 505 506 |
# File 'lib/ronin/support/network/ssl/mixin.rb', line 504 def ssl_accept(**kwargs,&block) SSL.accept(**kwargs,&block) end |
#ssl_banner(host, port, **kwargs) {|banner| ... } ⇒ String
Reads the banner from the service running on the given host and port.
287 288 289 |
# File 'lib/ronin/support/network/ssl/mixin.rb', line 287 def (host,port,**kwargs,&block) SSL.(host,port,**kwargs,&block) end |
#ssl_cert(host, port, **kwargs) ⇒ Crypto::Cert
Connects to the host and port and returns the server's certificate.
249 250 251 |
# File 'lib/ronin/support/network/ssl/mixin.rb', line 249 def ssl_cert(host,port,**kwargs) SSL.get_cert(host,port,**kwargs) end |
#ssl_connect(host, port, **kwargs) {|ssl_socket| ... } ⇒ OpenSSL::SSL::SSLSocket?
Establishes a SSL connection.
193 194 195 |
# File 'lib/ronin/support/network/ssl/mixin.rb', line 193 def ssl_connect(host,port,**kwargs,&block) SSL.connect(host,port,**kwargs,&block) end |
#ssl_connect_and_send(data, host, port, **kwargs) {|ssl_socket| ... } ⇒ Object
Creates a new SSL connection and sends the given data.
226 227 228 |
# File 'lib/ronin/support/network/ssl/mixin.rb', line 226 def ssl_connect_and_send(data,host,port,**kwargs,&block) SSL.connect_and_send(data,host,port,**kwargs,&block) end |
#ssl_context(**kwargs) ⇒ OpenSSL::SSL::SSLContext
Creates a new SSL Context.
76 77 78 |
# File 'lib/ronin/support/network/ssl/mixin.rb', line 76 def ssl_context(**kwargs) SSL.context(**kwargs) end |
#ssl_open?(host, port, **kwargs) ⇒ Boolean?
Tests whether a remote SSLed TCP port is open.
149 150 151 |
# File 'lib/ronin/support/network/ssl/mixin.rb', line 149 def ssl_open?(host,port,**kwargs) SSL.open?(host,port,**kwargs) end |
#ssl_send(data, host, port, **kwargs) ⇒ true
Connects to a specified host and port, sends the given data and then closes the connection.
323 324 325 |
# File 'lib/ronin/support/network/ssl/mixin.rb', line 323 def ssl_send(data,host,port,**kwargs) SSL.send(data,host,port,**kwargs) end |
#ssl_server(**kwargs) {|server| ... } ⇒ OpenSSL::SSL::SSLServer
Creates a new SSL server listening on a given host and port.
397 398 399 |
# File 'lib/ronin/support/network/ssl/mixin.rb', line 397 def ssl_server(**kwargs,&block) SSL.server(**kwargs,&block) end |
#ssl_server_loop(**kwargs) {|client| ... } ⇒ nil
Creates a new SSL socket listening on a given host and port, accepting clients in a loop.
461 462 463 |
# File 'lib/ronin/support/network/ssl/mixin.rb', line 461 def ssl_server_loop(**kwargs,&block) SSL.server_loop(**kwargs,&block) end |
#ssl_server_session(**kwargs) {|server| ... } ⇒ OpenSSL::SSL::SSLServer
Creates a new temporary SSL server listening on a given host and port.
424 425 426 |
# File 'lib/ronin/support/network/ssl/mixin.rb', line 424 def ssl_server_session(**kwargs,&block) SSL.server_session(**kwargs,&block) end |
#ssl_server_socket(socket, **kwargs) ⇒ OpenSSL::SSL::SSLSocket
Accepts an SSL session from an existing TCP socket.
358 359 360 |
# File 'lib/ronin/support/network/ssl/mixin.rb', line 358 def ssl_server_socket(socket,**kwargs) SSL.server_socket(socket,**kwargs) end |