mirror of
https://github.com/TuxCoding/FastLogin.git
synced 2025-12-23 07:12:39 +01:00
Compare commits
4 Commits
protocolli
...
debug-prot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9249c1ea8c | ||
|
|
fd33523189 | ||
|
|
5af43170da | ||
|
|
eb51f0c83c |
@@ -50,6 +50,7 @@ import java.security.PublicKey;
|
||||
import java.security.SecureRandom;
|
||||
import java.security.SignatureException;
|
||||
import java.time.Instant;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.crypto.BadPaddingException;
|
||||
@@ -58,6 +59,7 @@ import javax.crypto.NoSuchPaddingException;
|
||||
|
||||
import lombok.var;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import static com.comphenix.protocol.PacketType.Login.Client.ENCRYPTION_BEGIN;
|
||||
import static com.comphenix.protocol.PacketType.Login.Client.START;
|
||||
@@ -75,6 +77,9 @@ public class ProtocolLibListener extends PacketAdapter {
|
||||
|
||||
private final boolean verifyClientKeys;
|
||||
|
||||
@Nullable
|
||||
private PacketContainer lastStartPacket;
|
||||
|
||||
public ProtocolLibListener(FastLoginBukkit plugin, AntiBotService antiBotService, boolean verifyClientKeys) {
|
||||
//run async in order to not block the server, because we are making api calls to Mojang
|
||||
super(params()
|
||||
@@ -95,12 +100,25 @@ public class ProtocolLibListener extends PacketAdapter {
|
||||
|
||||
@Override
|
||||
public void onPacketReceiving(PacketEvent packetEvent) {
|
||||
plugin.getLog().info("New packet {} from {}; Cancellation: {}, Auth-Plugin: {}, Initialized: {}, Meta: {}",
|
||||
PacketContainer packet = packetEvent.getPacket();
|
||||
plugin.getLog().info("New packet {} from {}; Cancellation: {}, Meta: {}",
|
||||
packetEvent.getPacketType(), packetEvent.getPlayer(), packetEvent.isCancelled(),
|
||||
plugin.getCore().getAuthPluginHook(), !plugin.isServerFullyStarted(),
|
||||
packetEvent.getPacket().getMeta(SOURCE_META_KEY)
|
||||
packet.getMeta(SOURCE_META_KEY)
|
||||
);
|
||||
|
||||
if (packetEvent.getPacketType() == START) {
|
||||
if (lastStartPacket != null) {
|
||||
plugin.getLog().info("Start-packet equality (Last/New): {}/{}, {}",
|
||||
lastStartPacket.getHandle().hashCode(), packet.getHandle().hashCode(),
|
||||
Objects.equals(lastStartPacket.getHandle(), packet.getHandle())
|
||||
);
|
||||
|
||||
plugin.getLog().info("Content: {}, {}", lastStartPacket.getHandle(), packet.getHandle());
|
||||
}
|
||||
|
||||
lastStartPacket = packet;
|
||||
}
|
||||
|
||||
if (packetEvent.isCancelled()
|
||||
|| plugin.getCore().getAuthPluginHook() == null
|
||||
|| !plugin.isServerFullyStarted()) {
|
||||
@@ -115,7 +133,7 @@ public class ProtocolLibListener extends PacketAdapter {
|
||||
Player sender = packetEvent.getPlayer();
|
||||
PacketType packetType = packetEvent.getPacketType();
|
||||
if (packetType == START) {
|
||||
PacketContainer packet = packetEvent.getPacket();
|
||||
// PacketContainer packet = packet;
|
||||
|
||||
InetSocketAddress address = sender.getAddress();
|
||||
String username = getUsername(packet);
|
||||
|
||||
@@ -196,7 +196,7 @@ public class VerifyResponseTask implements Runnable {
|
||||
}
|
||||
|
||||
//try to get the networkManager from ProtocolLib
|
||||
private Object getNetworkManager() throws IllegalAccessException, ClassNotFoundException {
|
||||
private Object getNetworkManager() throws ClassNotFoundException {
|
||||
Object injectorContainer = TemporaryPlayerFactory.getInjectorFromPlayer(player);
|
||||
|
||||
// ChannelInjector
|
||||
@@ -290,5 +290,6 @@ public class VerifyResponseTask implements Runnable {
|
||||
//we don't want to handle our own packets so ignore filters
|
||||
startPacket.setMeta(ProtocolLibListener.SOURCE_META_KEY, plugin.getName());
|
||||
ProtocolLibrary.getProtocolManager().receiveClientPacket(player, startPacket, true);
|
||||
plugin.getLog().info("Sending new fake login start packet to {}-{}", player, username);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user