From 68541b1191259f39e4cd6bc3cbeeae9092b327f5 Mon Sep 17 00:00:00 2001 From: Ruakij Date: Thu, 25 Nov 2021 01:09:25 +0100 Subject: [PATCH] Added check for NoData-Packet --- src/streamHandler/PacketStreamFactory.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/streamHandler/PacketStreamFactory.js b/src/streamHandler/PacketStreamFactory.js index ca98642..8113677 100644 --- a/src/streamHandler/PacketStreamFactory.js +++ b/src/streamHandler/PacketStreamFactory.js @@ -69,7 +69,9 @@ class PacketStreamFactory extends Transform{ packet.signal = Number(data.match(/(?<=^|\s)-[0-9]{2,3}(?=dBm\sSignal($|\s))/i)?.[0]) || null; let packetTypeStr = data.match(new RegExp('(?<=^|\\s)('+ PACKET_TYPES_REGEX +')(?=$|\\s)', 'i'))?.[0]; - packet.packetType = packetTypeStr? PACKET_TYPE_MAP[packetTypeStr]: PacketType.Unknown; + packet.packetType = packetTypeStr? PACKET_TYPE_MAP[packetTypeStr]: + data.match(/(SA|TA|DA|RA|BSSID):.{17}\s*$/i)? PacketType.NoData: + PacketType.Unknown; packet.srcMac = data.match(/(?<=(^|\s)(SA|TA):).{17}(?=$|\s)/i)?.[0] ?? null;