From da99140d2066392d2b236acde854b38a2e133caa Mon Sep 17 00:00:00 2001 From: 4Benj_ Date: Fri, 6 May 2022 21:48:16 +0800 Subject: [PATCH] Stop WindSeedClientNotify and PlayerLuaShellNotify from being sent (#582) --- src/main/java/emu/grasscutter/net/packet/PacketOpcodes.java | 5 +++++ src/main/java/emu/grasscutter/server/game/GameSession.java | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/src/main/java/emu/grasscutter/net/packet/PacketOpcodes.java b/src/main/java/emu/grasscutter/net/packet/PacketOpcodes.java index 4d9eb57e8..8e77504d6 100644 --- a/src/main/java/emu/grasscutter/net/packet/PacketOpcodes.java +++ b/src/main/java/emu/grasscutter/net/packet/PacketOpcodes.java @@ -1,5 +1,8 @@ package emu.grasscutter.net.packet; +import java.util.Arrays; +import java.util.List; + public class PacketOpcodes { // Empty public static final int NONE = 0; @@ -1566,4 +1569,6 @@ public class PacketOpcodes { public static final int UNKNOWN_43 = 8877; public static final int UNKNOWN_44 = 8983; public static final int UNKNOWN_45 = 943; + + public static final List BANNED_PACKETS = Arrays.asList(PacketOpcodes.WindSeedClientNotify, PacketOpcodes.PlayerLuaShellNotify); } diff --git a/src/main/java/emu/grasscutter/server/game/GameSession.java b/src/main/java/emu/grasscutter/server/game/GameSession.java index ff024b03b..b984baa0e 100644 --- a/src/main/java/emu/grasscutter/server/game/GameSession.java +++ b/src/main/java/emu/grasscutter/server/game/GameSession.java @@ -157,6 +157,12 @@ public class GameSession extends KcpChannel { Grasscutter.getLogger().warn("Tried to send packet with missing cmd id!"); return; } + + // DO NOT REMOVE (unless we find a way to validate code before sending to client which I don't think we can) + // Stop WindSeedClientNotify from being sent for security purposes. + if(PacketOpcodes.BANNED_PACKETS.contains(packet.getOpcode())) { + return; + } // Header if (packet.shouldBuildHeader()) {