public Packet(byte[] HeaderArray) { this._DestinationFlag = HeaderArray[0] == 0 ? PACKET_FLAG.SYSTEM_READ : PACKET_FLAG.USER_READ; byte[] RemoteGuidArray = new byte[GUID_LENGTH]; Buffer.BlockCopy(HeaderArray, 1, RemoteGuidArray, 0, GUID_LENGTH); this._SenderGuid = new Guid(RemoteGuidArray); byte[] MessageLength = new byte[4]; Buffer.BlockCopy(HeaderArray, 1 + GUID_LENGTH, MessageLength, 0, 4); _MessageLength = BitConverter.ToInt32(MessageLength, 0); this._Message = new byte[_MessageLength]; }
private static void DumpSourceChangingFilteredPacket(PACKET_FLAG packetFlag, string sourceIP, string sourcePort, string destinationIP, string destinationPort, int packetSize, bool error = false) { var isSend = packetFlag == PACKET_FLAG.PACKET_FLAG_ON_SEND; if (error) { Console.ForegroundColor = ConsoleColor.Red; } else if (isSend) { Console.ForegroundColor = ConsoleColor.Yellow; } else { Console.ForegroundColor = ConsoleColor.Green; } Console.WriteLine($"{(isSend ? "SENT " : "RECEIVED")} Reddirecting VPN -> NORMAL: Source: {sourceIP}:{sourcePort} Destination: {destinationIP}:{destinationPort} SIZE: {packetSize} ---- Source changed to {localIp}"); Console.ResetColor(); }
public Packet(PACKET_FLAG DestinationFlag, Guid SenderGuid, byte[] Message) { this._DestinationFlag = DestinationFlag; this._SenderGuid = SenderGuid; this._Message = Message; }