aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2024-05-03 15:59:05 +0200
committerlonkaars <loek@pipeframe.xyz>2024-05-03 15:59:05 +0200
commit88ff9221d33bb29a03b44c6dde8b9b8ebd2e5b2b (patch)
tree54a9943f003c2b4956c61de8b8ccf58b309f5663
parent30ae02066e91471a5689e260198f71406159ebfc (diff)
improve dissectors
-rw-r--r--wireshark/nifi.lua12
-rw-r--r--wireshark/pictochat.lua17
2 files changed, 16 insertions, 13 deletions
diff --git a/wireshark/nifi.lua b/wireshark/nifi.lua
index d98324b..345b5e3 100644
--- a/wireshark/nifi.lua
+++ b/wireshark/nifi.lua
@@ -1,6 +1,6 @@
-local nifi = Proto("nifi", "Nintendo DS Ni-Fi")
+local nifi = Proto("nifi", "MelonDS Ni-Fi")
nifi.fields.magic = ProtoField.uint32("nifi.magic", "Magic", base.HEX)
-nifi.fields.senderid = ProtoField.int32("nifi.senderid", "SenderID", base.DEC)
+nifi.fields.src = ProtoField.int32("nifi.src", "Instance ID", base.DEC)
nifi.fields.type = ProtoField.new("Type", "nifi.type", ftypes.UINT32)
nifi.fields.type_enum = ProtoField.uint16("nifi.type.enum", "Numeric message type enum", base.DEC, {
[0] = "Regular",
@@ -12,16 +12,16 @@ nifi.fields.type_aid = ProtoField.uint16("nifi.type.aid", "Message type \"aid\"
nifi.fields.length = ProtoField.uint32("nifi.length", "Length", base.DEC)
nifi.fields.timestamp = ProtoField.uint64("nifi.timestamp", "Timestamp", base.DEC)
-local nifi_senderid_field = Field.new("nifi.senderid")
+local nifi_src_field = Field.new("nifi.src")
local nifi_type_enum_field = Field.new("nifi.type.enum")
function nifi.dissector(buffer, pinfo, tree)
-- check magic ("NIFI")
if buffer(0x00, 4):uint() ~= 0x4e494649 then return end
- local nifi_tree = tree:add(nifi, buffer(0, 0x18), "Ni-Fi Header: 24 bytes")
+ local nifi_tree = tree:add(nifi, buffer(0, 0x18), "MelonDS Ni-Fi Header: 24 bytes")
nifi_tree:add(nifi.fields.magic, buffer(0x00, 4))
- nifi_tree:add_le(nifi.fields.senderid, buffer(0x04, 4))
+ nifi_tree:add_le(nifi.fields.src, buffer(0x04, 4))
local nifi_type_tree = nifi_tree:add_le(nifi.fields.type, buffer(0x08, 4))
nifi_type_tree:add_le(nifi.fields.type_enum, buffer(0x08, 2))
@@ -31,7 +31,7 @@ function nifi.dissector(buffer, pinfo, tree)
nifi_tree:add_le(nifi.fields.timestamp, buffer(0x10, 8))
pinfo.cols.protocol = nifi.name
- pinfo.cols.src = nifi_senderid_field().display
+ pinfo.cols.src = "Instance " .. nifi_src_field().display
pinfo.cols.info = "type:" .. nifi_type_enum_field().display
return 0x18
diff --git a/wireshark/pictochat.lua b/wireshark/pictochat.lua
index 13a2722..ff09783 100644
--- a/wireshark/pictochat.lua
+++ b/wireshark/pictochat.lua
@@ -13,7 +13,8 @@ pc.fields.resend = ProtoField.uint16("pictochat.resend", "Resend", base.DEC, {
pc.fields.length = ProtoField.uint16("pictochat.length", "Message length")
pc.fields.host = ProtoField.ether("pictochat.host", "Room host")
pc.fields.src = ProtoField.ether("pictochat.src", "Source")
-pc.fields.dst = ProtoField.ether("pictochat.dst", "dstination")
+pc.fields.dst = ProtoField.ether("pictochat.dst", "Destination")
+
pc.fields.content_offset = ProtoField.uint16("pictochat.content_offset", "Content offset")
pc.fields.content = ProtoField.bytes("pictochat.content", "Content")
pc.fields.sequence = ProtoField.uint16("pictochat.sequence", "Packet sequence")
@@ -36,9 +37,15 @@ function pc.dissector(buffer, pinfo, tree)
pc_tree:add_le(pc.fields.msg_type, buffer(0x00, 2))
pc_tree:add_le(pc.fields.resend, buffer(0x02, 2))
pc_tree:add_le(pc.fields.length, buffer(0x0a, 2))
- pc_tree:add_le(pc.fields.host, buffer(0x10, 6))
+ pc_tree:add_le(pc.fields.dst, buffer(0x10, 6))
pc_tree:add_le(pc.fields.src, buffer(0x16, 6))
- pc_tree:add_le(pc.fields.dst, buffer(0x1c, 6))
+ pc_tree:add_le(pc.fields.host, buffer(0x1c, 6))
+
+ pinfo.cols.protocol = pc.name
+ pinfo.cols.src = tostring(pc_src_field())
+ pinfo.cols.dst = tostring(pc_dst_field())
+ pinfo.cols.info = pc_msg_type_field().display .. ", " .. pc_resend_field().display
+
pc_tree:add_le(pc.fields.unknown, buffer(0x22, 2))
pc_tree:add_le(pc.fields.unknown, buffer(0x24, 2))
@@ -56,10 +63,6 @@ function pc.dissector(buffer, pinfo, tree)
pc_tree:add(pc.fields.unknown, buffer(0x04, 4))
end
- pinfo.cols.protocol = pc.name
- pinfo.cols.src = tostring(pc_src_field())
- pinfo.cols.dst = tostring(pc_dst_field())
- pinfo.cols.info = pc_msg_type_field().display .. ", " .. pc_resend_field().display
end