#!/usr/bin/env tracebox -s

--
-- Tracebox -- A middlebox detection tool
--
--  Copyright 2013-2015 by its authors. 
--  Some rights reserved. See LICENSE, AUTHORS.
--

function cb(ttl, rip, mods)
    pkt = mods:original()
    reply = mods:received()
	if ttl == 1 then
		print("luatracebox to " .. pkt:dest())
	end

	if reply and mods then
		print(ttl, rip, mods)
	elseif reply then
		print(ttl, rip)
	else
		print(ttl, '*')
	end
end

tracebox(IP / TCP, {callback = "cb"})
