Class: Ronin::Support::Network::TLS::Proxy

Inherits:
SSL::Proxy show all
Defined in:
lib/ronin/support/network/tls/proxy.rb

Overview

The TLS Proxy allows for inspecting and manipulating TLS wrapped protocols.

Example

require 'ronin/support/network/tls/proxy'
require 'hexdump'

Ronin::Support::Network::TLS::Proxy.start(port: 1337, server: ['www.wired.com', 443]) do |proxy|
  address = lambda { |socket|
    addrinfo = socket.peeraddr

   "#{addrinfo[3]}:#{addrinfo[1]}"
  }
  hex = Hexdump::Hexdump.new

  proxy.on_client_data do |client,server,data|
    puts "#{address[client]} -> #{proxy}"
    hex.dump(data)
  end

  proxy.on_client_connect do |client|
    puts "#{address[client]} -> #{proxy} [connected]"
  end

  proxy.on_client_disconnect do |client,server|
    puts "#{address[client]} <- #{proxy} [disconnected]"
  end

  proxy.on_server_data do |client,server,data|
    puts "#{address[client]} <- #{proxy}"
    hex.dump(data)
  end

  proxy.on_server_connect do |client,server|
    puts "#{address[client]} <- #{proxy} [connected]"
  end

  proxy.on_server_disconnect do |client,server|
    puts "#{address[client]} <- #{proxy} [disconnected]"
  end
end

Callbacks

In addition to the events supported by the Proxy base class, the TLS Proxy also supports the following callbacks.

client_connect

When a client connects to the proxy:

on_client_connect do |client|
  puts "[connected] #{client.remote_address.ip_address}:#{client.remote_addre
end

client_disconnect

When a client disconnects from the proxy:

on_client_disconnect do |client,server|
  puts "[disconnected] #{client.remote_address.ip_address}:#{client.remote_ad
end

server_connect

When the server accepts a connection from the proxy:

on_server_connect do |client,server|
  puts "[connected] #{proxy}"
end

server_disconnect

When the server closes a connection from the proxy.

on_server_disconnect do |client,server|
  puts "[disconnected] #{proxy}"
end

connect

Alias for Ronin::Support::Network::TCP::Proxy#on_server_connect.

disconnect

Alias for Ronin::Support::Network::TCP::Proxy#on_client_disconnect.

Since:

  • 1.0.0

Constant Summary

Constants inherited from Proxy

Proxy::DEFAULT_BUFFER_SIZE, Proxy::DEFAULT_HOST

Instance Attribute Summary

Attributes inherited from SSL::Proxy

#ca_bundle, #cert, #cert_file, #key, #key_file, #verify, #version

Attributes inherited from Proxy

#buffer_size, #connections, #host, #port, #server_host, #server_port

Instance Method Summary collapse

Methods inherited from SSL::Proxy

#accept_client_connection, #open_server_connection, #recv, #send

Methods inherited from Ronin::Support::Network::TCP::Proxy

#accept_client_connection, #client_connect, #client_disconnect, #close_client_connection, #close_proxy, #close_server_connection, #on_client_connect, #on_client_disconnect, #on_server_connect, #on_server_disconnect, #open, #open_server_connection, #poll, #recv, #send, #server_connect, #server_disconnect

Methods inherited from Proxy

#callback, #client_connection_for, #client_connections, #client_data, #close, #close!, #close_client_connection, #close_connection, #close_connections, #close_proxy, #close_server_connection, #ignore!, #inspect, #listen, #on_client_data, #on_data, #on_server_data, #open, #open_server_connection, #poll, #recv, #reset!, #reset_connection, #send, #server_connection_for, #server_connections, #server_data, start, #start, #stop, #stop!, #to_s

Constructor Details

#initialize(version: 1.2, **kwargs) ⇒ Proxy

Creates a new TLS Proxy.

Parameters:

  • version (1, 1.1, 1.2, String, Symbol, nil) (defaults to: 1.2)

    The TLS version to use.

  • kwargs (Hash{Symbol => Object})

    Additional keyword arguments for SSL::Proxy#initialize.

Since:

  • 1.0.0



127
128
129
# File 'lib/ronin/support/network/tls/proxy.rb', line 127

def initialize(version: 1.2, **kwargs)
  super(version: version, **kwargs)
end