Skip to content

Instantly share code, notes, and snippets.

@postmodern
Created June 12, 2012 20:27
Show Gist options
  • Save postmodern/2919927 to your computer and use it in GitHub Desktop.
Save postmodern/2919927 to your computer and use it in GitHub Desktop.
Example of Ronin::Network::UDP::Proxy
require 'ronin/network/udp/proxy'
require 'hexdump'
Ronin::Network::UDP::Proxy.start(:port => 1337, :server => ['4.2.2.1', 53]) do |proxy|
hex = Hexdump::Dumper.new
proxy.on_client_data do |(client,(host,port)),server,data|
puts "#{host}:#{port} -> #{proxy}"
hex.dump(data)
end
proxy.on_server_data do |(client,(host,port)),server,data|
proxy.close! if data =~ /QUIT/
puts "#{host}:#{port} <- #{proxy}"
hex.dump(data)
end
end
@postmodern
Copy link
Author

$ dig @localhost www.wired.com -p 1337

127.0.0.1:47522 -> 0.0.0.0:1337 <-> 4.2.2.1:53
00000000  c6 b5 01 00 00 01 00 00 00 00 00 00 03 77 77 77  |.............www|
00000010  05 77 69 72 65 64 03 63 6f 6d 00 00 01 00 01     |.wired.com.....|
127.0.0.1:47522 <- 0.0.0.0:1337 <-> 4.2.2.1:53
00000000  c6 b5 81 80 00 01 00 04 00 00 00 00 03 77 77 77  |.............www|
00000010  05 77 69 72 65 64 03 63 6f 6d 00 00 01 00 01 c0  |.wired.com......|
00000020  0c 00 05 00 01 00 00 2c d2 00 1d 03 77 77 77 05  |.......,....www.|
00000030  77 69 72 65 64 03 63 6f 6d 09 65 64 67 65 73 75  |wired.com.edgesu|
00000040  69 74 65 03 6e 65 74 00 c0 2b 00 05 00 01 00 00  |ite.net..+......|
00000050  2b 22 00 10 04 61 38 36 37 01 67 06 61 6b 61 6d  |+"...a867.g.akam|
00000060  61 69 c0 43 c0 54 00 01 00 01 00 00 00 14 00 04  |ai.C.T..........|
00000070  48 f7 da 48 c0 54 00 01 00 01 00 00 00 14 00 04  |H..H.T..........|
00000080  48 f7 da 52                                      |H..R|

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment