Browse Source

Add dissector port note

pull/179/head
emanuele-f 5 years ago
parent
commit
ce1fb356f3
  1. 2
      wireshark/README.md
  2. 12
      wireshark/n2n.lua

2
wireshark/README.md

@ -5,3 +5,5 @@ Quick load:
``` ```
wireshark -X lua_script:n2n.lua wireshark -X lua_script:n2n.lua
``` ```
NOTE: the dissector only decodes traffic on UDP port 50001. In order to decode n2n traffic on another UDP port you can use the "Decode As..." function of wireshark.

12
wireshark/n2n.lua

@ -1,6 +1,6 @@
-- (C) 2019 - ntop.org and contributors -- (C) 2019 - ntop.org and contributors
n2n_protocol = Proto("n2n", "n2n Protocol") n2n = Proto("n2n", "n2n Protocol")
-- ############################################# -- #############################################
@ -107,7 +107,7 @@ register_super_ack_num_sn = ProtoField.uint8("n2n.register_super_ack.num_sn", "N
-- ############################################# -- #############################################
n2n_protocol.fields = { n2n.fields = {
version, ttl, packet_type, version, ttl, packet_type,
flags, from_supernode_flag, socket_flag, options_flag, flags, from_supernode_flag, socket_flag, options_flag,
community, community,
@ -267,14 +267,14 @@ end
-- ############################################# -- #############################################
function n2n_protocol.dissector(buffer, pinfo, tree) function n2n.dissector(buffer, pinfo, tree)
local length = buffer:len() local length = buffer:len()
if length < 20 then return end if length < 20 then return end
pinfo.cols.protocol = n2n_protocol.name pinfo.cols.protocol = n2n.name
local pkt_type = bit.band(buffer(2,2):uint(), packet_type_mask) local pkt_type = bit.band(buffer(2,2):uint(), packet_type_mask)
local subtree = tree:add(n2n_protocol, buffer(), string.format("n2n Protocol, Type: %s", pkt_type_2_str[pkt_type] or "Unknown")) local subtree = tree:add(n2n, buffer(), string.format("n2n Protocol, Type: %s", pkt_type_2_str[pkt_type] or "Unknown"))
-- Common -- Common
subtree:add(version, buffer(0,1)) subtree:add(version, buffer(0,1))
@ -313,4 +313,4 @@ end
-- ############################################# -- #############################################
local udp_port = DissectorTable.get("udp.port") local udp_port = DissectorTable.get("udp.port")
udp_port:add(15015, n2n_protocol) udp_port:add(50001, n2n)

Loading…
Cancel
Save