mirror of
https://github.com/RayzsYT/ProAntiTab.git
synced 2026-11-15 21:35:54 -05:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
60516283e2 | ||
|
|
b3e622d652 | ||
|
|
1ee5623a80 | ||
|
|
419d1ae508 | ||
|
|
a9eaa531e7 | ||
|
|
ff7e3cd444 | ||
|
|
abb4c5404f | ||
|
|
c804ec51bd | ||
|
|
cc025c52b1 | ||
|
|
c29bab0e84 | ||
|
|
ab74e04a53 | ||
|
|
8713aafc27 | ||
|
|
60e3188990 | ||
|
|
97abf3834b |
No files matched your search
@@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>de.rayzs.pat</groupId>
|
||||
<artifactId>ProAntiTab</artifactId>
|
||||
<version>1.8.0</version>
|
||||
<version>1.8.2</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
|
||||
@@ -7,6 +7,10 @@ import de.rayzs.pat.plugin.logger.Logger;
|
||||
import de.rayzs.pat.api.storage.Storage;
|
||||
import de.rayzs.pat.plugin.BukkitLoader;
|
||||
import de.rayzs.pat.api.netty.bukkit.*;
|
||||
import de.rayzs.pat.utils.message.MessageTranslator;
|
||||
import de.rayzs.pat.utils.scheduler.PATScheduler;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import de.rayzs.pat.utils.*;
|
||||
import java.lang.reflect.*;
|
||||
@@ -26,6 +30,12 @@ public class ModernPacketHandler implements BukkitPacketHandler {
|
||||
}
|
||||
|
||||
String text = (String) stringField.get(packetObj);
|
||||
if(Storage.ConfigSections.Settings.PATCH_EXPLOITS.isMalicious(text)) {
|
||||
MessageTranslator.send(Bukkit.getConsoleSender(), Storage.ConfigSections.Settings.PATCH_EXPLOITS.ALERT_MESSAGE.get().replace("%player%", player.getName()));
|
||||
PATScheduler.createScheduler(() -> player.kickPlayer(ChatColor.translateAlternateColorCodes('&', Storage.ConfigSections.Settings.PATCH_EXPLOITS.KICK_MESSAGE.get())));
|
||||
return false;
|
||||
}
|
||||
|
||||
BukkitPacketAnalyzer.insertPlayerInput(player, text);
|
||||
return true;
|
||||
}
|
||||
@@ -33,13 +43,15 @@ public class ModernPacketHandler implements BukkitPacketHandler {
|
||||
@Override
|
||||
public boolean handleOutgoingPacket(Player player, Object packetObj) throws Exception {
|
||||
Object suggestionObj;
|
||||
|
||||
String rawInput = BukkitPacketAnalyzer.getPlayerInput(player), input = rawInput;
|
||||
if(input == null) return false;
|
||||
|
||||
boolean cancelsBeforeHand = false;
|
||||
|
||||
boolean is121Packet = packetObj.getClass().getSimpleName().equals("ClientboundCommandSuggestionsPacket"),
|
||||
cancelsBeforeHand = false;
|
||||
|
||||
int spaces = 0;
|
||||
if(input.startsWith("/")) {
|
||||
if(input.startsWith("/") || is121Packet) {
|
||||
input = input.replace("/", "");
|
||||
if(input.contains(" ")) {
|
||||
String[] split = input.split(" ");
|
||||
@@ -51,7 +63,7 @@ public class ModernPacketHandler implements BukkitPacketHandler {
|
||||
if(!cancelsBeforeHand) cancelsBeforeHand = Storage.ConfigSections.Settings.CUSTOM_VERSION.isCommand(input);
|
||||
}
|
||||
|
||||
if(packetObj.getClass().getSimpleName().equals("ClientboundCommandSuggestionsPacket")) {
|
||||
if(is121Packet) {
|
||||
try {
|
||||
Field suggestionsField = Reflection.getFieldsByTypeNormal(packetObj.getClass(), "List", Reflection.SearchOption.ENDS).get(0);
|
||||
List<?> suggestionsTmp = (List<?>) suggestionsField.get(packetObj),
|
||||
@@ -71,6 +83,10 @@ public class ModernPacketHandler implements BukkitPacketHandler {
|
||||
}
|
||||
|
||||
if (spaces == 0) {
|
||||
for (Object suggestion : suggestions) {
|
||||
System.out.println(suggestion);
|
||||
}
|
||||
|
||||
suggestions.removeIf(suggestion -> {
|
||||
String command = getSuggestionFromEntry(suggestion);
|
||||
return Storage.Blacklist.isBlocked(player, command);
|
||||
@@ -101,7 +117,6 @@ public class ModernPacketHandler implements BukkitPacketHandler {
|
||||
.newInstance(id, start, length, suggestions);
|
||||
|
||||
BukkitPacketAnalyzer.sendPacket(player.getUniqueId(), clientboundCommandSuggestionsPacketObj);
|
||||
|
||||
return false;
|
||||
|
||||
} catch (Throwable throwable) { throwable.printStackTrace(); }
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.velocitypowered.api.command.CommandSource;
|
||||
import com.velocitypowered.proxy.protocol.MinecraftPacket;
|
||||
import de.rayzs.pat.api.brand.CustomServerBrand;
|
||||
import de.rayzs.pat.plugin.logger.Logger;
|
||||
import de.rayzs.pat.utils.message.MessageTranslator;
|
||||
import de.rayzs.pat.utils.permission.PermissionUtil;
|
||||
import com.velocitypowered.proxy.protocol.packet.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@@ -12,7 +13,10 @@ import com.velocitypowered.api.proxy.Player;
|
||||
import de.rayzs.pat.plugin.VelocityLoader;
|
||||
import de.rayzs.pat.api.storage.Storage;
|
||||
import de.rayzs.pat.utils.*;
|
||||
import de.rayzs.pat.utils.scheduler.PATScheduler;
|
||||
import io.netty.channel.*;
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class VelocityPacketAnalyzer {
|
||||
@@ -115,8 +119,14 @@ public class VelocityPacketAnalyzer {
|
||||
if(packet instanceof TabCompleteRequestPacket) {
|
||||
TabCompleteRequestPacket request = (TabCompleteRequestPacket) msg;
|
||||
if(request.getCommand() != null) {
|
||||
insertPlayerInput(player, request.getCommand());
|
||||
super.channelRead(ctx, msg);
|
||||
|
||||
if(Storage.ConfigSections.Settings.PATCH_EXPLOITS.isMalicious(request.getCommand())) {
|
||||
MessageTranslator.send(VelocityLoader.getServer().getConsoleCommandSource(), Storage.ConfigSections.Settings.PATCH_EXPLOITS.ALERT_MESSAGE.get().replace("%player%", player.getUsername()));
|
||||
player.disconnect(LegacyComponentSerializer.legacyAmpersand().deserialize(Storage.ConfigSections.Settings.PATCH_EXPLOITS.KICK_MESSAGE.get()));
|
||||
} else {
|
||||
insertPlayerInput(player, request.getCommand());
|
||||
super.channelRead(ctx, msg);
|
||||
}
|
||||
}
|
||||
} else super.channelRead(ctx, msg);
|
||||
}
|
||||
|
||||
@@ -108,6 +108,7 @@ public class Storage {
|
||||
|
||||
public static BlockNamespaceCommandsSection BLOCK_NAMESPACE_COMMANDS = new BlockNamespaceCommandsSection();
|
||||
public static HandleThroughProxySection HANDLE_THROUGH_PROXY = new HandleThroughProxySection();
|
||||
public static PatchExploitSection PATCH_EXPLOITS = new PatchExploitSection();
|
||||
public static CustomBrandSection CUSTOM_BRAND = new CustomBrandSection();
|
||||
public static CancelCommandSection CANCEL_COMMAND = new CancelCommandSection();
|
||||
public static CustomPluginsSection CUSTOM_PLUGIN = new CustomPluginsSection();
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package de.rayzs.pat.api.storage.config.settings;
|
||||
|
||||
import de.rayzs.pat.api.storage.storages.ConfigStorage;
|
||||
import de.rayzs.pat.utils.configuration.helper.*;
|
||||
import de.rayzs.pat.utils.StringUtils;
|
||||
import java.util.Collections;
|
||||
|
||||
public class PatchExploitSection extends ConfigStorage {
|
||||
|
||||
public boolean ENABLED;
|
||||
public ConfigSectionHelper<String> ALERT_MESSAGE, KICK_MESSAGE;
|
||||
|
||||
public PatchExploitSection() {
|
||||
super("patch-exploits");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
super.load();
|
||||
ENABLED = new ConfigSectionHelper<Boolean>(this, "enabled", true).getOrSet();
|
||||
ALERT_MESSAGE = new ConfigSectionHelper<>(this, "alert-message", "%prefix% &4%player% &ctried to crash/lag the server.");
|
||||
KICK_MESSAGE = new ConfigSectionHelper(this, "kick-message", "&cFailed to read packet! Please reconnect.");
|
||||
}
|
||||
|
||||
public boolean isMalicious(String text) {
|
||||
if(!ENABLED) return false;
|
||||
|
||||
return text.length() > 256
|
||||
|| text.contains("nbt")
|
||||
&& (StringUtils.countMatches('[', text) > 15 || StringUtils.countMatches('{', text) > 25);
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,7 @@ import java.util.*;
|
||||
|
||||
@Plugin(name = "ProAntiTab",
|
||||
id = "proantitab",
|
||||
version = "1.8.1",
|
||||
version = "1.8.2",
|
||||
authors = "Rayzs_YT",
|
||||
description = "Hide more than just your plugins. Hide almost everything!",
|
||||
dependencies = {
|
||||
|
||||
@@ -17,6 +17,15 @@ public class StringUtils {
|
||||
return input;
|
||||
}
|
||||
|
||||
public static int countMatches(Character character, String string) {
|
||||
int count = 0;
|
||||
for (char c : string.toCharArray()) {
|
||||
if(character == c) count++;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
public static String replaceTriggers(String input, String replacement, String... triggers) {
|
||||
for (String trigger : triggers) {
|
||||
if(!input.contains(trigger)) continue;
|
||||
|
||||
@@ -17,6 +17,12 @@ public class PATScheduler {
|
||||
: new BukkitScheduler().getInstance(false, runnable, time);
|
||||
}
|
||||
|
||||
public static PATSchedulerTask createScheduler(Runnable runnable) {
|
||||
return Reflection.isFoliaServer()
|
||||
? new FoliaScheduler().getInstance(false, runnable)
|
||||
: new BukkitScheduler().getInstance(false, runnable);
|
||||
}
|
||||
|
||||
public static PATSchedulerTask createAsyncScheduler(Runnable runnable, long time, long period) {
|
||||
return Reflection.isFoliaServer()
|
||||
? new FoliaScheduler().getInstance(true, runnable, time, period)
|
||||
@@ -28,4 +34,10 @@ public class PATScheduler {
|
||||
? new FoliaScheduler().getInstance(true, runnable, time)
|
||||
: new BukkitScheduler().getInstance(true, runnable, time);
|
||||
}
|
||||
|
||||
public static PATSchedulerTask createAsyncScheduler(Runnable runnable) {
|
||||
return Reflection.isFoliaServer()
|
||||
? new FoliaScheduler().getInstance(true, runnable)
|
||||
: new BukkitScheduler().getInstance(true, runnable);
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ public interface PATSchedulerTask {
|
||||
|
||||
PATSchedulerTask getInstance(boolean async, Runnable runnable, long time, long period);
|
||||
PATSchedulerTask getInstance(boolean async, Runnable runnable, long time);
|
||||
PATSchedulerTask getInstance(boolean async, Runnable runnable);
|
||||
|
||||
boolean isActive();
|
||||
void setTaskId(int taskId);
|
||||
|
||||
@@ -24,6 +24,14 @@ public class BukkitScheduler implements PATSchedulerTask {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PATSchedulerTask getInstance(boolean async, Runnable runnable) {
|
||||
this.taskId = async
|
||||
? Bukkit.getScheduler().scheduleAsyncDelayedTask(BukkitLoader.getPlugin(), runnable)
|
||||
: Bukkit.getScheduler().scheduleSyncDelayedTask(BukkitLoader.getPlugin(), runnable);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return this.taskId != 1;
|
||||
|
||||
@@ -23,6 +23,12 @@ public class FoliaScheduler implements PATSchedulerTask {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PATSchedulerTask getInstance(boolean async, Runnable runnable) {
|
||||
this.task = SCHEDULER.run(BukkitLoader.getPlugin(), __ -> runnable.run());
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return !this.task.isCancelled();
|
||||
|
||||
@@ -2,7 +2,7 @@ name: ProAntiTab
|
||||
description: Hide more than just your plugins. Hide almost everything!
|
||||
|
||||
author: Rayzs_YT
|
||||
version: 1.8.1
|
||||
version: 1.8.2
|
||||
main: de.rayzs.pat.plugin.BungeeLoader
|
||||
|
||||
softDepends:
|
||||
|
||||
@@ -118,6 +118,14 @@ custom-version:
|
||||
block-namespace-commands:
|
||||
enabled: false
|
||||
|
||||
# Patches a small exploit which causes the server to lag.
|
||||
# Due to the fact that PAT interact with Tab-Completion and their packets directly,
|
||||
# it would be a shame to not use it then to also block some exploits, while being at it. ^^
|
||||
patch-exploits:
|
||||
enabled: true
|
||||
alert-message: '%prefix% &4%player% &ctried to crash/lag the server.'
|
||||
kick-message: '&cFailed to read packet! Please reconnect.'
|
||||
|
||||
#>> HTP (Overwritten)
|
||||
# This feature allows you to customize your server brand you see when you press F3.
|
||||
# Normally there is something like 'Purpur', or 'Spigot'.
|
||||
|
||||
@@ -98,6 +98,14 @@ custom-version:
|
||||
block-namespace-commands:
|
||||
enabled: false
|
||||
|
||||
# Patches a small exploit which causes the server to lag.
|
||||
# Due to the fact that PAT interact with Tab-Completion and their packets directly,
|
||||
# it would be a shame to not use it then to also block some exploits, while being at it. ^^
|
||||
patch-exploits:
|
||||
enabled: true
|
||||
alert-message: '%prefix% &4%player% &ctried to crash/lag the server.'
|
||||
kick-message: '&cFailed to read packet! Please reconnect.'
|
||||
|
||||
# This feature allows you to customize your server brand you see when you press F3.
|
||||
# Normally there is something like 'Purpur', or 'Spigot'.
|
||||
# With this feature, you are able to change and even animate it.
|
||||
|
||||
@@ -2,7 +2,7 @@ name: ProAntiTab
|
||||
description: Hide more than just your plugins. Hide almost everything!
|
||||
|
||||
author: Rayzs_YT
|
||||
version: 1.8.1
|
||||
version: 1.8.2
|
||||
api-version: 1.13
|
||||
main: de.rayzs.pat.plugin.BukkitLoader
|
||||
|
||||
|
||||
Reference in new issue
Block a user