Closed russianbullet closed 5 years ago
Sorry, the packetdotnet was old, i recompiled the new sourcecode and now it's working
I still get this exception with the Nuget version. It only happens on TCPv6 packets. Version 0.13.0
Will you be updating the Nuget package?
at PacketDotNet.TcpPacket.get_DataOffset() at PacketDotNet.TcpPacket..ctor(ByteArraySegment bas) at PacketDotNet.TcpPacket..ctor(ByteArraySegment bas, Packet ParentPacket) at PacketDotNet.IpPacket.ParseEncapsulatedBytes(ByteArraySegment payload, IPProtocolType ProtocolType, Packet ParentPacket) at PacketDotNet.IPv6Packet..ctor(ByteArraySegment bas) at PacketDotNet.EthernetPacket.ParseEncapsulatedBytes(ByteArraySegment Header, EthernetPacketType Type) at PacketDotNet.EthernetPacket..ctor(ByteArraySegment bas) at PacketDotNet.Packet.ParsePacket(LinkLayers LinkLayer, Byte[] PacketData) at TcpMonitor.Repository.Services.PacketCaptureService.onDevicePacketArrival(Object sender, CaptureEventArgs args) in D:\Visual Studio Projects\TcpMonitor\TcpMonitor.Repository\Services\PacketCaptureService.cs:line 47 at SharpPcap.LibPcap.PcapDevice.SendPacketArrivalEvent(RawCapture p) at SharpPcap.WinPcap.WinPcapDevice.SendPacketArrivalEvent(RawCapture p) at SharpPcap.LibPcap.PcapDevice.PacketHandler(IntPtr param, IntPtr header, IntPtr data) at SharpPcap.LibPcap.LibPcapSafeNativeMethods.pcap_dispatch(IntPtr adaptHandle, Int32 count, pcap_handler callback, IntPtr ptr) at SharpPcap.LibPcap.PcapDevice.CaptureThread() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart()
Have you tested this with the latest 0.19 version?
@stricq I think you may be using someone elses package, this is the official package: https://www.nuget.org/packages/PacketDotNet/
@chmorgan I'm quite certain I'm using your nuget package. I just updated to the version you just released (0.19.1) and I'm still getting the exception. Here is my line of code:
if (packet.Extract(typeof(TcpPacket)) is TcpPacket tcpPacket) {
Here is the full project: https://github.com/stricq/TcpMonitor
It is the Extract method where the exception happens.
at PacketDotNet.MiscUtil.Conversion.EndianBitConverter.CheckByteArgument(Byte[] value, Int32 startIndex, Int32 bytesRequired)
at PacketDotNet.TcpPacket.get_DataOffsetAndFlags()
at PacketDotNet.TcpPacket..ctor(ByteArraySegment bas, Packet parentPacket)
at PacketDotNet.IPPacket.ParseEncapsulatedBytes(ByteArraySegment payload, IPProtocolType protocolType, Packet parentPacket)
at System.Lazy`1.CreateValue()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Lazy`1.get_Value()
at PacketDotNet.Packet.ToString(StringOutputType outputFormat)
at PacketDotNet.IPv6Packet.ToString(StringOutputType outputFormat)
at PacketDotNet.EthernetPacket.ToString(StringOutputType outputFormat)
Here is a Json.net dump of the raw packet data that throws the exception:
{ "Data": "LE1U5/8QEHtEFu1cht1gCKW3AAAGQCYCAGF6q/UA+JJUvRDZ9sQmB/iwQA8IAQAAAAAAACAO1nUBu7g/3T7xFB0LUBhQ93HaAAAXAwMXxwAAAAAAAAY0dxTF1nXPELAMFwyH1XcqDdrPiGpZvGaLbWdlL/relMvHYtjgx/dfPCkiHXn8euIu/iCHtXk9lxbMIszDj0PY0HphSvrTXbdrHj2TU3CYkXay251Gxa93Kj521sJuzAODQ2efeIz4QER26gHCbrXM1y8oagh5XnUuL9mFZXp7bKD4dS0fPHdn0T2x+4hZvF1XOAE8rk1vgV1ejbkp7PDcN5HXXoX7cBUy1/sQDgV3iSaa4TDHDetSqPG0nOeb2iDJHhk2NgravDYr01AfP3B0f5zcXTOyhfq092Zyt46GNkBcq/BulU3+u07SeaGRUpZUK5pfyG7qPWT+EViE/jOj8zF4YRncaC32EOz4IGqEfRM5OZ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Rec+W71O46mMh/whuRbRCnJ+6mNK1fWgEwwbP7HZm+AWB/zdntFgC4MRmJQP2WQAWT5xMOUNBb68sHziyQNb2NlkNIW07UE0LP2eiecZdDnFAEJ1IjhSTHOMNWFZwBVWCdAZSUSKg==", "LinkLayerType": 1, "Timeval": { "Seconds": 1534989866, "MicroSeconds": 710068, "Date": "2018-08-23T02:04:26.710068Z" } }
0.19.2 still has the same exception.
Hi @stricq, closing this out. Please retest with the latest version and reopen if there is still an issue.
Hello dear @chmorgan
When I'm parsing the following packet I get this error :
An unhandled exception of type 'System.IndexOutOfRangeException' occurred in PacketDotNet.dll Additional information: Index was outside the bounds of the array.