Tracebox, a middlebox detection tool
Basic use of the Lua API
When run, the scripts have preset global variables and functoin, listed in Globals. The most basic script is made of 3 parts:
Probe packet definition, using successive concatenation of packet layers, see Globals.
pkt = ip{dst='185.31.18.133'} / tcp{dst=80}
Callback function definition, which will be called after each probe packet has been echoed back by intermediate routers on the path, see Globals:tracebox_callback.
function cb(ttl, r_ip, probe, rcv, mod) print('At hop ' .. ttl) print('Received: ' .. tostring(rcv)) end
tracebox() function call, see Globals:tracebox, with the created probe packet and callback function, which will run tracebox and call the callback with the detected packet modifications and return the final received packet received from the target, if any.
result = tracebox(pkt, {callback='cb'}) print(tostring(result))
Modules
Globals | Global functions and objects provided by TraceBox |
Classes
__cpp_obj | Abstract type for all custom classes exposed from cpp, exposed to lua with reference couting. |
Base_Object | Abstract type, providing the basic methods supported by most objects, inherits from __cpp_obj. |
DNS | The DNS Layer |
FWFilter | A simple firewall rule on the host machine. |
ICMP | The ICMP Layer, inherits from Base_Object |
IP | The IP Layer, inherits from Base_Object |
IPOption | Options for the IP Layer, inherits from Base_Object |
IPv6 | The IPv6 Layer, inherits from Base_Object |
IPv6SegmentRoutingHeader | The IPv6SegmentRoutingHeader Layer, inherits from Base_Object |
Packet | An object representing a Packet, inherits from Base_Object |
PacketModifications | A set of modifications between packets |
PartialTCP | The PartialTCP Layer, inherits from Base_Object This denotes a embedded TCP layer in an ICMP payload that has been cut. |
Raw | The Raw Layer, inherits from Base_Object |
TbxSniffer | An object that will intercept packets |
TCP | The TCP Layer, inherits from Base_Object |
TCPEDO | The TCP Edo option |
TCPOption | Options for the TCP Layer, inherits from Base_Object |
TCPTFO | The TCP Fast Open option |
TCPTimestamp | The TCP Timestamp option |
UDP | The UDP Layer, inherits from Base_Object |