mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-02-09 12:52:52 +08:00
Remove banned packets
client modifications already perform the job of blocking malicious packets from being executed, no point in having this if self-windy is wanted
This commit is contained in:
parent
5605163607
commit
f6326d6e4b
@ -12,8 +12,6 @@ import java.util.TreeMap;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class PacketOpcodesUtils {
|
||||
public static final Set<Integer> BANNED_PACKETS =
|
||||
Set.of(PacketOpcodes.WindSeedClientNotify, PacketOpcodes.PlayerLuaShellNotify);
|
||||
public static final Set<Integer> LOOP_PACKETS =
|
||||
Set.of(
|
||||
PacketOpcodes.PingReq,
|
||||
|
@ -1,9 +1,5 @@
|
||||
package emu.grasscutter.server.game;
|
||||
|
||||
import static emu.grasscutter.config.Configuration.GAME_INFO;
|
||||
import static emu.grasscutter.config.Configuration.SERVER;
|
||||
import static emu.grasscutter.utils.Language.translate;
|
||||
|
||||
import emu.grasscutter.Grasscutter;
|
||||
import emu.grasscutter.Grasscutter.ServerDebugMode;
|
||||
import emu.grasscutter.game.Account;
|
||||
@ -17,11 +13,16 @@ import emu.grasscutter.utils.FileUtils;
|
||||
import emu.grasscutter.utils.Utils;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.nio.file.Path;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import static emu.grasscutter.config.Configuration.GAME_INFO;
|
||||
import static emu.grasscutter.config.Configuration.SERVER;
|
||||
import static emu.grasscutter.utils.Language.translate;
|
||||
|
||||
public class GameSession implements GameSessionManager.KcpChannel {
|
||||
private final GameServer server;
|
||||
@ -109,13 +110,6 @@ public class GameSession implements GameSessionManager.KcpChannel {
|
||||
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 (PacketOpcodesUtils.BANNED_PACKETS.contains(packet.getOpcode())) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Header
|
||||
if (packet.shouldBuildHeader()) {
|
||||
packet.buildHeader(this.getNextClientSequence());
|
||||
|
@ -3,19 +3,21 @@ package emu.grasscutter.server.packet.send;
|
||||
import com.google.protobuf.ByteString;
|
||||
import emu.grasscutter.net.packet.BasePacket;
|
||||
import emu.grasscutter.net.packet.PacketOpcodes;
|
||||
import emu.grasscutter.net.proto.WindSeedClientNotifyOuterClass.WindSeedClientNotify;
|
||||
import emu.grasscutter.net.proto.WindSeedClientNotifyOuterClass.WindSeedClientNotify.AreaNotify;
|
||||
import emu.grasscutter.net.proto.WindSeedType1NotifyOuterClass.WindSeedType1Notify;
|
||||
|
||||
public final class PacketWindSeedClientNotify extends BasePacket {
|
||||
/**
|
||||
* Constructor for the generic WindSeedClientNotify packet.
|
||||
*
|
||||
* @param compiledLua The compiled Lua to send to the client.
|
||||
*/
|
||||
public PacketWindSeedClientNotify(byte[] compiledLua) {
|
||||
super(PacketOpcodes.WindSeedClientNotify);
|
||||
super(PacketOpcodes.WindSeedType1Notify);
|
||||
|
||||
this.setData(
|
||||
WindSeedClientNotify.newBuilder()
|
||||
.setAreaNotify(
|
||||
AreaNotify.newBuilder()
|
||||
.setAreaId(1)
|
||||
.setAreaType(1)
|
||||
.setAreaCode(ByteString.copyFrom(compiledLua))));
|
||||
var packet = WindSeedType1Notify.newBuilder()
|
||||
.setPayload(ByteString.copyFrom(compiledLua))
|
||||
.build();
|
||||
|
||||
this.setData(packet);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user