Module: Ronin::Support::Network::TLS::Mixin
- Includes:
- SSL::Mixin
- Defined in:
- lib/ronin/support/network/tls/mixin.rb
Overview
Provides helper methods for communicating with TLS-enabled services.
Instance Method Summary collapse
-
#tls_accept(**kwargs) {|client| ... } ⇒ nil
Creates a new SSL socket listening on a given host and port, accepts only one client and then stops listening.
-
#tls_banner(host, port, **kwargs) {|banner| ... } ⇒ String
Reads the banner from the service running on the given host and port.
-
#tls_cert(host, port, **kwargs) ⇒ OpenSSL::X509::Certificate
Connects to the host and port and returns the server's certificate.
-
#tls_connect(host, port, **kwargs) {|tls_socket| ... } ⇒ OpenSSL::SSL::SSLSocket?
Establishes a SSL connection.
-
#tls_connect_and_send(data, host, port, **kwargs) {|tls_socket| ... } ⇒ Object
Creates a new SSL connection and sends the given data.
-
#tls_context(**kwargs) ⇒ OpenSSL::SSL::SSLContext
Creates a new TLS Context.
-
#tls_open?(host, port, **kwargs) ⇒ Boolean?
Tests whether a remote SSLed TCP port is open.
-
#tls_send(data, host, port, **kwargs) ⇒ true
Connects to a specified host and port, sends the given data and then closes the connection.
-
#tls_server(**kwargs) {|server| ... } ⇒ OpenSSL::SSL::SSLServer
Creates a new TLS server listening on a given host and port.
-
#tls_server_loop(**kwargs) {|client| ... } ⇒ nil
Creates a new SSL socket listening on a given host and port, accepting clients in a loop.
-
#tls_server_session(**kwargs) {|server| ... } ⇒ OpenSSL::SSL::SSLServer
Creates a new temporary TLS server listening on a given host and port.
-
#tls_server_socket(socket, **kwargs) ⇒ OpenSSL::SSL::SSLSocket
Accepts an SSL session from an existing TCP socket.
-
#tls_socket(socket, **kwargs) ⇒ OpenSSL::SSL::SSLSocket
Initiates an SSL session with an existing TCP socket.
Methods included from SSL::Mixin
#ssl_accept, #ssl_banner, #ssl_cert, #ssl_connect, #ssl_connect_and_send, #ssl_context, #ssl_open?, #ssl_send, #ssl_server, #ssl_server_loop, #ssl_server_session, #ssl_server_socket, #ssl_socket
Instance Method Details
#tls_accept(**kwargs) {|client| ... } ⇒ nil
Creates a new SSL socket listening on a given host and port, accepts only one client and then stops listening.
489 490 491 |
# File 'lib/ronin/support/network/tls/mixin.rb', line 489 def tls_accept(**kwargs, &block) TLS.accept(**kwargs, &block) end |
#tls_banner(host, port, **kwargs) {|banner| ... } ⇒ String
Reads the banner from the service running on the given host and port.
280 281 282 |
# File 'lib/ronin/support/network/tls/mixin.rb', line 280 def (host,port,**kwargs, &block) TLS.(host,port,**kwargs, &block) end |
#tls_cert(host, port, **kwargs) ⇒ OpenSSL::X509::Certificate
Connects to the host and port and returns the server's certificate.
244 245 246 |
# File 'lib/ronin/support/network/tls/mixin.rb', line 244 def tls_cert(host,port,**kwargs) TLS.get_cert(host,port,**kwargs) end |
#tls_connect(host, port, **kwargs) {|tls_socket| ... } ⇒ OpenSSL::SSL::SSLSocket?
Establishes a SSL connection.
190 191 192 |
# File 'lib/ronin/support/network/tls/mixin.rb', line 190 def tls_connect(host,port,**kwargs, &block) TLS.connect(host,port,**kwargs, &block) end |
#tls_connect_and_send(data, host, port, **kwargs) {|tls_socket| ... } ⇒ Object
Creates a new SSL connection and sends the given data.
221 222 223 |
# File 'lib/ronin/support/network/tls/mixin.rb', line 221 def tls_connect_and_send(data,host,port,**kwargs, &block) TLS.connect_and_send(data,host,port,**kwargs, &block) end |
#tls_context(**kwargs) ⇒ OpenSSL::SSL::SSLContext
Creates a new TLS Context.
81 82 83 |
# File 'lib/ronin/support/network/tls/mixin.rb', line 81 def tls_context(**kwargs) TLS.context(**kwargs) end |
#tls_open?(host, port, **kwargs) ⇒ Boolean?
Tests whether a remote SSLed TCP port is open.
145 146 147 |
# File 'lib/ronin/support/network/tls/mixin.rb', line 145 def tls_open?(host,port,**kwargs) TLS.open?(host,port,**kwargs) end |
#tls_send(data, host, port, **kwargs) ⇒ true
Connects to a specified host and port, sends the given data and then closes the connection.
314 315 316 |
# File 'lib/ronin/support/network/tls/mixin.rb', line 314 def tls_send(data,host,port,**kwargs) TLS.send(data,host,port,**kwargs) end |
#tls_server(**kwargs) {|server| ... } ⇒ OpenSSL::SSL::SSLServer
Creates a new TLS server listening on a given host and port.
386 387 388 |
# File 'lib/ronin/support/network/tls/mixin.rb', line 386 def tls_server(**kwargs, &block) TLS.server(**kwargs, &block) end |
#tls_server_loop(**kwargs) {|client| ... } ⇒ nil
Creates a new SSL socket listening on a given host and port, accepting clients in a loop.
448 449 450 |
# File 'lib/ronin/support/network/tls/mixin.rb', line 448 def tls_server_loop(**kwargs,&block) TLS.server_loop(**kwargs,&block) end |
#tls_server_session(**kwargs) {|server| ... } ⇒ OpenSSL::SSL::SSLServer
Creates a new temporary TLS server listening on a given host and port.
413 414 415 |
# File 'lib/ronin/support/network/tls/mixin.rb', line 413 def tls_server_session(**kwargs, &block) TLS.server_session(**kwargs, &block) end |
#tls_server_socket(socket, **kwargs) ⇒ OpenSSL::SSL::SSLSocket
Accepts an SSL session from an existing TCP socket.
347 348 349 |
# File 'lib/ronin/support/network/tls/mixin.rb', line 347 def tls_server_socket(socket,**kwargs) TLS.server_socket(socket,**kwargs) end |
#tls_socket(socket, **kwargs) ⇒ OpenSSL::SSL::SSLSocket
Initiates an SSL session with an existing TCP socket.
101 102 103 |
# File 'lib/ronin/support/network/tls/mixin.rb', line 101 def tls_socket(socket,**kwargs) TLS.socket(socket,**kwargs) end |