anticheat detections

This commit is contained in:
kirillsaint 2024-01-01 15:05:39 +06:00
parent 22daedeca6
commit 163fd92770
6 changed files with 29 additions and 11 deletions

View File

@ -99,6 +99,7 @@ public class Client {
public ServerData lastServerData;
public TextUtils textUtils;
private SkillIssue skillIssue;
private PlayerResponse.BanInfo banInfo;
public static void memoryDebug(String paramString) {
LogManager.getLogger().info("-- Start Memory Debug -- " + paramString);
@ -294,10 +295,11 @@ public class Client {
Minecraft.getMinecraft().displayGuiScreen(new GuiError("Authorization Error. Try restarting the game"));
return;
}
if(Client.getInstance().getAccount().isBanned()) {
if(banInfo != null && banInfo.banned && !banerror) {
logger.info("STARTING > ERROR: " + "Account is banned");
Minecraft.getMinecraft().displayGuiScreen(new GuiError("Your account is banned"));
return;
Minecraft.getMinecraft().displayGuiScreen(new GuiError("Your account is banned. Reason: " + banInfo.reason));
banerror = true;
}
Client.logger.info("STARTING > mod-instances-post-init");
@ -450,8 +452,11 @@ public class Client {
GsonBuilder builder = new GsonBuilder();
Gson gson = builder.create();
PlayerResponse playerResponse = gson.fromJson(content, PlayerResponse.class);
return gson.fromJson(content, PlayerResponse.class);
this.banInfo = playerResponse.banInfo;
return playerResponse;
} catch (Exception e) {
e.printStackTrace();
return null;
@ -469,13 +474,13 @@ public class Client {
}
this.updateUserInformation();
}
if(Client.getInstance().getAccount() != null) {
if(Client.getInstance().getAccount().isBanned() && banerror == false) {
if(banInfo != null) {
if(banInfo.banned && !banerror) {
if(Minecraft.getMinecraft().theWorld != null) {
Minecraft.getMinecraft().theWorld.sendQuittingDisconnectingPacket();
Minecraft.getMinecraft().loadWorld(null);
}
Minecraft.getMinecraft().displayGuiScreen(new GuiError("Your account is banned"));
Minecraft.getMinecraft().displayGuiScreen(new GuiError("Your account is banned. Reason: " + banInfo.reason));
banerror = true;
}
}

View File

@ -60,7 +60,7 @@ public abstract class GuiContainerMixin extends GuiScreen {
@Inject(method = "mouseClicked", at = @At("TAIL"))
private void silent$checkHotbarClicks(int mouseX, int mouseY, int mouseButton, CallbackInfo ci) {
// checkHotbarKeys(mouseButton - 100);
checkHotbarKeys(mouseButton - 100);
}
@Redirect(method = "drawScreen", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/inventory/GuiContainer;drawDefaultBackground()V"))

View File

@ -6,6 +6,8 @@ import net.silentclient.client.event.EventManager;
import net.silentclient.client.event.EventTarget;
import net.silentclient.client.event.impl.ClientTickEvent;
import net.silentclient.client.skillissue.SkillIssue;
import net.silentclient.client.utils.Requests;
import org.json.JSONObject;
public class Detection {
protected Minecraft mc = Minecraft.getMinecraft();
@ -24,6 +26,12 @@ public class Detection {
this.detections += 1;
this.lastDetection = System.currentTimeMillis();
Client.logger.warn(String.format("[SkillIssue]: %s Detection: %s (vl: %s)", name, data, detections));
(new Thread(() -> {
Requests.post("https://api.silentclient.net/anticheat/detect", new JSONObject().put("type", name.toLowerCase()).put("message", data).toString());
if(detections >= 10) {
Client.getInstance().updateUserInformation();
}
})).start();
}
@EventTarget

View File

@ -4,7 +4,6 @@ import net.silentclient.client.event.EventTarget;
import net.silentclient.client.event.impl.EntityAttackEvent;
import net.silentclient.client.mods.hud.ReachDisplayMod;
import net.silentclient.client.skillissue.SkillIssue;
import net.silentclient.client.utils.PlayerUtils;
public class Reach extends Detection {
private long lastHit = 0;
@ -15,7 +14,7 @@ public class Reach extends Detection {
@EventTarget
public void totallyNoReachHax(EntityAttackEvent event) {
if(System.currentTimeMillis() - lastHit < 500 || !PlayerUtils.isSurvival()) {
if(System.currentTimeMillis() - lastHit < 500) {
return;
}
if(mc.objectMouseOver != null && mc.objectMouseOver.hitVec != null) {

View File

@ -147,7 +147,7 @@ public class Players {
public static void unregister() {
try {
String content = Requests.post("https://api.silentclient.net/account/set_online", new JSONObject().put("online", true).toString());
String content = Requests.post("https://api.silentclient.net/account/set_online", new JSONObject().put("online", false).toString());
Client.logger.info("STOPPING > unregistering-player > response: " + content.toString());
} catch (Exception e) {

View File

@ -19,6 +19,7 @@ import java.util.concurrent.TimeUnit;
public class PlayerResponse extends AbstractReply {
public Account account;
public BanInfo banInfo;
public Account getAccount() {
return account;
@ -514,4 +515,9 @@ public class PlayerResponse extends AbstractReply {
public ArrayList<Number> hats = new ArrayList<Number>();
public ArrayList<Number> shields = new ArrayList<Number>();
}
public class BanInfo {
public boolean banned;
public String reason;
}
}