private void HackMessage(IMessage message) { var redirectMessage = message as RedirectMessage; if (redirectMessage == null) { return; } while (true) { var keys = (Dictionary <IPEndPoint, ulong>)EncryptionManager.GetType() .GetField("peerKeys", BindingFlags.Instance | BindingFlags.NonPublic) .GetValue(EncryptionManager); var publicKey = keys[((TcpAddress)redirectMessage.Destination).Endpoint]; var privateKey = BluemeshEncryptor.GeneratePublicKey(publicKey); var bytes = redirectMessage.Data.ToArray(); BluemeshEncryptor.EncryptBytes(bytes, MessageContainer.HeaderSize, bytes.Length - MessageContainer.HeaderSize, privateKey); var newMessage = MessageContainer.ReadFromBuffer(bytes, 0, ConnectionManager.Utility).Message; if (newMessage is DataMessage) { Console.WriteLine("FLAG: " + Encoding.UTF8.GetString(((DataMessage)newMessage).Data)); break; } redirectMessage = (RedirectMessage)newMessage; } }