mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-01 00:19:33 +00:00
Adds bidirectional flags in host_get_json TCP flows
An excerpt of the json returned is:
{"srv.ip":"a.b.c.d","cli.port":50559,"srv.port":443,
"cli2srv.tcp_flags":{"SYN":1,"RST":0,"PSH":1,"FIN":0,"URG":0,"ACK":1},"cli2srv.throughput_bps":0,"bytes":2869,"srv2cli.throughput_bps":0,"cli2srv.throughput_pps":0,
"srv2cli.tcp_flags":{"SYN":1,"RST":0,"PSH":1,"FIN":0,"URG":0,"ACK":1},"tcp_established":true,"srv2cli.throughput_pps":0,"cli.ip":"192.168.2.130","proto.ndpi_id":126,"proto.ndpi":"SSL.Google"},
This commit is contained in:
parent
0515516952
commit
7a8878a886
4 changed files with 34 additions and 16 deletions
|
|
@ -2135,12 +2135,24 @@ end
|
|||
|
||||
-- print TCP flags
|
||||
function printTCPFlags(flags)
|
||||
if(hasbit(flags,0x01)) then print('<span class="label label-info">FIN</span> ') end
|
||||
if(hasbit(flags,0x02)) then print('<span class="label label-info">SYN</span> ') end
|
||||
if(hasbit(flags,0x04)) then print('<span class="label label-danger">RST</span> ') end
|
||||
if(hasbit(flags,0x08)) then print('<span class="label label-info">PUSH</span> ') end
|
||||
if(hasbit(flags,0x10)) then print('<span class="label label-info">ACK</span> ') end
|
||||
if(hasbit(flags,0x20)) then print('<span class="label label-info">URG</span> ') end
|
||||
if(hasbit(flags,0x01)) then print('<span class="label label-info">FIN</span> ') end
|
||||
if(hasbit(flags,0x02)) then print('<span class="label label-info">SYN</span> ') end
|
||||
if(hasbit(flags,0x04)) then print('<span class="label label-danger">RST</span> ') end
|
||||
if(hasbit(flags,0x08)) then print('<span class="label label-info">PUSH</span> ') end
|
||||
if(hasbit(flags,0x10)) then print('<span class="label label-info">ACK</span> ') end
|
||||
if(hasbit(flags,0x20)) then print('<span class="label label-info">URG</span> ') end
|
||||
end
|
||||
|
||||
-- convert the integer carrying TCP flags in a more conventient lua table
|
||||
function TCPFlags2table(flags)
|
||||
local res = {["FIN"] = 0, ["SYN"] = 0, ["RST"] = 0, ["PSH"] = 0, ["ACK"] = 0, ["URG"] = 0}
|
||||
if(hasbit(flags,0x01)) then res["FIN"] = 1 end
|
||||
if(hasbit(flags,0x02)) then res["SYN"] = 1 end
|
||||
if(hasbit(flags,0x04)) then res["RST"] = 1 end
|
||||
if(hasbit(flags,0x08)) then res["PSH"] = 1 end
|
||||
if(hasbit(flags,0x10)) then res["ACK"] = 1 end
|
||||
if(hasbit(flags,0x20)) then res["URG"] = 1 end
|
||||
return res
|
||||
end
|
||||
|
||||
-- ##########################################
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue