Sha256: 9cbe5364f94a05e4cf4820064a82b6e93a5f57828a1d61ecc25b7beca111a475

Contents?: true

Size: 1.01 KB

Versions: 10

Compression:

Stored size: 1.01 KB

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

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 = ->(socket) {
    addrinfo = socket.peeraddr

    "#{addrinfo[3]}:#{addrinfo[1]}"
  }

  hexdump = Hexdump::Dumper.new

  proxy.on_client_data do |client,server,data|
    puts "#{address[client]} -> #{proxy}"
    hexdump.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}"
    hexdump.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

10 entries across 10 versions & 1 rubygems

Version Path
ronin-support-1.1.0 examples/tcp_proxy.rb
ronin-support-1.1.0.rc2 examples/tcp_proxy.rb
ronin-support-1.0.7 examples/tcp_proxy.rb
ronin-support-1.1.0.rc1 examples/tcp_proxy.rb
ronin-support-1.0.6 examples/tcp_proxy.rb
ronin-support-1.0.5 examples/tcp_proxy.rb
ronin-support-1.0.4 examples/tcp_proxy.rb
ronin-support-1.0.3 examples/tcp_proxy.rb
ronin-support-1.0.2 examples/tcp_proxy.rb
ronin-support-1.0.1 examples/tcp_proxy.rb