This commit is contained in:
DavidVentura
2024-01-26 00:40:30 +01:00
parent 149b5634e3
commit ab6c504ac8
2 changed files with 16 additions and 46 deletions
+16 -13
View File
@@ -1,21 +1,24 @@
-- Create a new protocol for your custom packets
my_protocol = Proto("MyProtocol", "My Custom Protocol")
my_protocol = Proto("myprotocol", "My Custom Protocol")
-- Define the fields you want to display in Wireshark
my_protocol.fields = {}
my_protocol.fields.type = ProtoField.string("MyProtocol.type", "Type")
my_protocol.fields.payload = ProtoField.bytes("MyProtocol.payload", "Data")
my_protocol.fields.len = ProtoField.uint16("MyProtocol.len", "Len", base.HEX)
my_protocol.fields.type = ProtoField.string("myprotocol.type", "Type")
my_protocol.fields.payload = ProtoField.bytes("myprotocol.payload", "Data")
my_protocol.fields.len = ProtoField.uint16("myprotocol.len", "Len", base.HEX)
my_protocol.fields.m_type = ProtoField.uint8("MyProtocol.m_type", "Stream Type", base.HEX)
my_protocol.fields.m_stream_id = ProtoField.uint8("MyProtocol.m_stream_id", "Stream ID", base.HEX)
my_protocol.fields.elem_count = ProtoField.uint16("MyProtocol.elem_count", "Elem count", base.DEC)
my_protocol.fields.m_type = ProtoField.uint8("myprotocol.m_type", "Stream Type", base.HEX)
my_protocol.fields.m_stream_id = ProtoField.uint8("myprotocol.m_stream_id", "Stream ID", base.HEX)
my_protocol.fields.elem_count = ProtoField.uint16("myprotocol.elem_count", "Elem count", base.DEC)
my_protocol.fields.cmd_payload_len = ProtoField.uint16("MyProtocol.cmd_payload_len", "CMD Payload Len", base.HEX)
my_protocol.fields.cmd = ProtoField.uint16("MyProtocol.cmd", "CMD", base.HEX)
my_protocol.fields.start = ProtoField.uint16("MyProtocol.start", "Start", base.HEX)
my_protocol.fields.cmd_dest = ProtoField.uint16("MyProtocol.cmd_dest", "Dest", base.HEX)
my_protocol.fields.cmd_payload = ProtoField.bytes("MyProtocol.payload", "Payload", base.DASH)
my_protocol.fields.cmd_payload_len = ProtoField.uint16("myprotocol.cmd_payload_len", "CMD Payload Len", base.HEX)
my_protocol.fields.cmd = ProtoField.uint16("myprotocol.cmd", "CMD", base.HEX)
my_protocol.fields.start = ProtoField.uint16("myprotocol.start", "Start", base.HEX)
my_protocol.fields.cmd_dest = ProtoField.uint16("myprotocol.cmd_dest", "Dest", base.HEX)
my_protocol.fields.cmd_payload = ProtoField.bytes("myprotocol.payload", "Payload", base.DASH)
my_protocol.fields.encrypted = ProtoField.bool("myprotocol.encrypted", "Encrypted")
my_protocol.fields.cmd_type = ProtoField.string("myprotocol.payload", "Cmd Pkt Type")
lut = {
[0xf1f0] = "Close",
@@ -55,7 +58,7 @@ function my_protocol.dissector(buffer, pinfo, tree)
subtree:add(my_protocol.fields.type, packetname)
-- Set the protocol description in the packet list
pinfo.cols.protocol:set("MyProtocol")
pinfo.cols.protocol:set("myprotocol")
if packetname == "DrwAck" then
subtree:add(my_protocol.fields.len, buffer(2, 2))
subtree:add(my_protocol.fields.m_type, buffer(4, 1))
-33
View File
@@ -1,33 +0,0 @@
import socket
import time
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
ip = "192.168.1.255"
ip = "192.168.1.1"
send_port = 32108
recv_port = 49512
s.bind(("", recv_port))
#s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
DISCOVER_PKT = bytes([0xf1, 0x30, 0x00, 0x00])
def send(data):
s.sendto(data, (ip, send_port))
send(DISCOVER_PKT)
data, server = s.recvfrom(4095)
print(data, server)
time.sleep(0.1)
"""
b'\xf1A\x00\x14BATC\x00\x00\x00\x00\x00\tM,HVDCS\x00\x00\x00'
0000 14 ac 60 29 81 bf 84 36 71 17 be 90 08 00 45 00 ..`)...6q.....E.
0010 00 34 00 2f 00 00 ff 11 37 d4 c0 a8 01 01 c0 a8 .4./....7.......
0020 01 64 7d 6c c1 68 00 20 88 79 f1 41 00 14 42 41 .d}l.h. .y.A..BA
0030 54 43 00 00 00 00 00 09 4d 2c 48 56 44 43 53 00 TC......M,HVDCS.
0040 00 00 ..
"""
send(bytes([0xf1, 0xe1, 0x00, 0x00]))
data, server = s.recvfrom(4095)
print(data, server)
time.sleep(0.1)