diff --git a/.github/workflows/style_checks.yml b/.github/workflows/style_checks.yml index 2d02681..d1b8bf5 100644 --- a/.github/workflows/style_checks.yml +++ b/.github/workflows/style_checks.yml @@ -46,8 +46,9 @@ jobs: name: Luacheck runs-on: ubuntu-latest steps: + - uses: actions/checkout@v1 - name: Run luacheck uses: nebularg/actions-luacheck@v1 with: files: 'dissector/baichuan.lua' - args: --globals Dissector,Proto,ProtoField,base,ByteArray,DESEGMENT_ONE_MORE_SEGMENT,DissectorTable + args: --globals Dissector Proto ProtoField base ByteArray DESEGMENT_ONE_MORE_SEGMENT DissectorTable diff --git a/dissector/baichuan.lua b/dissector/baichuan.lua index 06cd55d..819d2e1 100644 --- a/dissector/baichuan.lua +++ b/dissector/baichuan.lua @@ -716,6 +716,7 @@ function bc_protocol.dissector(buffer, pinfo, tree) end --- END UDP CONTENT +local added_udp_ports = {} local function heuristic_checker_udp(buffer, pinfo, tree) -- guard for length local length = buffer:len() @@ -730,6 +731,15 @@ local function heuristic_checker_udp(buffer, pinfo, tree) return false end + if added_udp_ports[pinfo.dst_port] == nil then + table.insert(added_udp_ports, pinfo.dst_port) + DissectorTable.get("udp.port"):add(pinfo.dst_port, bc_protocol) + end + if added_udp_ports[pinfo.src_port] == nil then + table.insert(added_udp_ports, pinfo.src_port) + DissectorTable.get("udp.port"):add(pinfo.src_port, bc_protocol) + end + bc_protocol.dissector(buffer, pinfo, tree) return true end