aboutsummaryrefslogtreecommitdiff
path: root/wireshark/pictochat.lua
diff options
context:
space:
mode:
Diffstat (limited to 'wireshark/pictochat.lua')
-rw-r--r--wireshark/pictochat.lua70
1 files changed, 0 insertions, 70 deletions
diff --git a/wireshark/pictochat.lua b/wireshark/pictochat.lua
deleted file mode 100644
index 507e486..0000000
--- a/wireshark/pictochat.lua
+++ /dev/null
@@ -1,70 +0,0 @@
-require "util"
-
-local p = Proto("pictochat", "PictoChat")
-
-local MSG_TYPE = {
- USER_JOIN_A = 0,
- USER_JOIN_B = 1,
- MESSAGE = 2,
-}
-
-local MSG_TYPE_MAP = {
- [MSG_TYPE.USER_JOIN_A] = "User join",
- [MSG_TYPE.USER_JOIN_B] = "User join",
- [MSG_TYPE.MESSAGE] = "Message",
-}
-
-p.fields.unknown = ProtoField.uint16("pictochat.unknown", "Unknown")
-
-local dissect_msg_type = { }
-
-p.fields.user_addr = ProtoField.bytes("pictochat.user.addr", "Address", base.COLON)
-p.fields.user_name = ProtoField.string("pictochat.user.name", "Nickname")
-p.fields.user_msg = ProtoField.string("pictochat.user.msg", "Message")
-p.fields.user_color = ProtoField.uint16("pictochat.user.color", "Color", base.DEC, PROFILE_COLOR_MAP)
-p.fields.user_bday_month = ProtoField.uint8("pictochat.user.bday_month", "Month")
-p.fields.user_bday_day = ProtoField.uint8("pictochat.user.bday_day", "Day")
-dissect_msg_type[MSG_TYPE.USER_JOIN_A] = function (buffer, pinfo, tree)
- local user_name = buffer(0x06, 20):le_ustring()
- add_addr_le(tree, p.fields.user_addr, buffer(0x00, 6))
- register_addr_le(buffer(0x00, 6):raw(), user_name)
- tree:add(p.fields.user_name, buffer(0x06, 20), user_name)
- tree:add(p.fields.user_msg, buffer(0x1a, 52), buffer(0x1a, 52):le_ustring())
- tree:add_le(p.fields.user_color, buffer(0x4e, 2))
- local bday_str = string.format("Birthday: %02d/%02d", buffer(0x50, 1):uint(), buffer(0x51, 1):uint())
- local bday = tree:add(buffer(0x50, 2), bday_str)
- bday:add(p.fields.user_bday_month, buffer(0x50, 1))
- bday:add(p.fields.user_bday_day, buffer(0x51, 1))
-
- pinfo.cols.info = string.format("%s, user join (%s)", pinfo.cols.info, user_name)
-end
-dissect_msg_type[MSG_TYPE.USER_JOIN_B] = dissect_msg_type[MSG_TYPE.USER_JOIN_A]
-
-p.fields.msg_addr = ProtoField.bytes("pictochat.msg.addr", "Address", base.COLON)
-p.fields.msg_data = ProtoField.bytes("pictochat.msg.data", "Drawing data")
-dissect_msg_type[MSG_TYPE.MESSAGE] = function (buffer, pinfo, tree)
- add_addr_le(tree, p.fields.msg_addr, buffer(0x00, 6))
-end
-dissect_msg_type[MSG_TYPE.USER_JOIN_B] = dissect_msg_type[MSG_TYPE.USER_JOIN_A]
-
-p.fields.type = ProtoField.uint8("pictochat.type", "Type", base.DEC, MSG_TYPE_MAP)
-function p.dissector(buffer, pinfo, tree)
- pinfo.cols.protocol = p.name
- local buffer_len = buffer:len()
- local mid = pc_global.pid_mid_map[pinfo.number]
- local type = buffer(0x01, 1):le_uint()
- local type_str = MSG_TYPE_MAP[type] or ""
- local subtree = tree:add(p, buffer(), string.format("%s %s (mid=%08x): %d bytes", p.description, type_str, mid, buffer_len))
-
- subtree:add_le(p.fields.unknown, buffer(0x00, 1))
- subtree:add_le(p.fields.type, buffer(0x01, 1))
- buffer = buffer(2)
-
- local subdissector = dissect_msg_type[type]
- if subdissector ~= nil then
- subdissector(buffer, pinfo, subtree)
- end
-
- return buffer_len
-end
-