heroku tcp information leak demonstration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'ipaddr' | |
def draw(s) | |
ip, port = s.split(':') | |
ip = ip.scan(/(..)/).reverse.join('') | |
ip = ip.to_i(16) | |
ip = IPAddr.new(ip, Socket::AF_INET).to_s | |
port = port.to_i(16) | |
"#{ip}:#{port}" | |
end | |
File.read('/proc/net/tcp').each_line do |l| | |
toks = l.split | |
next if toks[0] == "sl" | |
src = toks[1] | |
dst = toks[2] | |
puts "#{draw(src)} -> #{draw(dst)}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment