Sha256: 30aa64857dab10d2f673a69a474d76c137b137bcfd69d8d303522e5ba54332c3

Contents?: true

Size: 996 Bytes

Versions: 4

Compression:

Stored size: 996 Bytes

Contents

#!/usr/bin/env ruby

require 'bundler/setup'

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

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

    "#{addrinfo[3]}:#{addrinfo[1]}"
  }
  hex = Hexdump::Dumper.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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ronin-support-1.0.0 examples/tcp_proxy.rb
ronin-support-1.0.0.beta3 examples/tcp_proxy.rb
ronin-support-1.0.0.beta2 examples/tcp_proxy.rb
ronin-support-1.0.0.beta1 examples/tcp_proxy.rb