Skip to content

Instantly share code, notes, and snippets.

@RecursiveG
Created January 21, 2016 05:09
Show Gist options
  • Save RecursiveG/1bd210d7decdecf9fb54 to your computer and use it in GitHub Desktop.
Save RecursiveG/1bd210d7decdecf9fb54 to your computer and use it in GitHub Desktop.
Cracked Version of AntiCheat3 (http://www.mcbbs.net/thread-525761-1-1.html). To show how vulnerable and unreliable a client-mod based Minecraft anticheat system could be.
import java.util.Random;
import cpw.mods.fml.common.gameevent.PlayerEvent;
import java.awt.image.BufferedImage;
import net.minecraft.client.resources.IResource;
import javax.imageio.ImageIO;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraft.server.dedicated.DedicatedServer;
import net.minecraft.command.ICommandSender;
import net.minecraft.server.MinecraftServer;
import net.minecraft.entity.player.EntityPlayer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Collections;
import net.minecraft.util.IChatComponent;
import net.minecraft.crash.CrashReport;
import net.minecraft.client.Minecraft;
import org.apache.logging.log4j.Level;
import java.net.URLDecoder;
import cpw.mods.fml.relauncher.FMLInjectionData;
import org.apache.commons.codec.digest.DigestUtils;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import io.netty.buffer.ByteBuf;
import java.io.UnsupportedEncodingException;
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
import io.netty.buffer.Unpooled;
import net.minecraft.util.StringUtils;
import cpw.mods.fml.common.network.FMLNetworkEvent;
import java.util.Iterator;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.ModContainer;
import cpw.mods.fml.common.Loader;
import net.minecraftforge.common.config.Property;
import java.util.Collection;
import java.util.LinkedHashSet;
import java.security.NoSuchAlgorithmException;
import java.io.IOException;
import java.nio.MappedByteBuffer;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.nio.channels.FileChannel;
import java.io.FileInputStream;
import net.minecraft.command.ICommand;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import java.util.TimerTask;
import java.util.Timer;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import java.io.File;
import cpw.mods.fml.common.network.FMLEventChannel;
import net.minecraft.util.ChatComponentText;
import net.minecraftforge.common.config.Configuration;
import java.util.List;
import net.minecraft.entity.player.EntityPlayerMP;
import java.util.Map;
import java.util.LinkedHashMap;
import cpw.mods.fml.common.Mod;
@Mod(modid = AntiCheat_3_3_3_1710.MODID, name = AntiCheat_3_3_3_1710.NAME, version = AntiCheat_3_3_3_1710.VERSION)
public class AntiCheat_3_3_3_1710
{
public static final String MODID = "AntiCheat3";
public static final String NAME = "AntiCheat3";
public static final String VERSION = "3.3.3";
private static LinkedHashMap<String, String> modMd5Map;
private static Map<String, ChallengeResponseRecord> TimeoutCheckMap;
private static Map<EntityPlayerMP, PlayerMonitorRecord> playerLoginTimeMap;
private static List<String> md5List;
private static Configuration config;
private static ChatComponentText kickMessage;
private static int maxWaitTime;
private static FMLEventChannel fmlEventChannel;
private static File SELF_LOCATION;
@Mod.EventHandler
public void perInit(final FMLPreInitializationEvent event) {
// MinecraftForge.EVENT_BUS.register((Object)new Listener());
// FMLCommonHandler.instance().bus().register((Object)new Listener());
(AntiCheat_3_3_3_1710.fmlEventChannel = NetworkRegistry.INSTANCE.newEventDrivenChannel("AntiCheat3")).register((Object)this);
AntiCheat_3_3_3_1710.config = new Configuration(new File(String.format("%s/%s.cfg", event.getModConfigurationDirectory(), "AntiCheat")));
new Timer().schedule(new E4NKJGUR8BXFS53P2YMVL7ZA0I1WDH96OCQT(), 0L, 3000L);
}
@Mod.EventHandler
@SideOnly(Side.CLIENT)
public void postInit_client(final FMLPostInitializationEvent event) {
// this.generateLocalModMap();
this.saveConfig();
}
@Mod.EventHandler
@SideOnly(Side.SERVER)
public void postInit_server(final FMLPostInitializationEvent event) {
this.loadConfig();
}
@Mod.EventHandler
@SideOnly(Side.SERVER)
public void onServerStart(final FMLServerStartingEvent event) {
event.registerServerCommand(new AntiCheatCommand());
}
private String getFileMd5(final File fileName) throws IOException, NoSuchAlgorithmException {
final FileInputStream fileInputStream = new FileInputStream(fileName.getAbsoluteFile());
final MappedByteBuffer fileMapBuffer = fileInputStream.getChannel().map(FileChannel.MapMode.READ_ONLY, 0L, fileName.length());
final MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(fileMapBuffer);
final BigInteger md5Hash = new BigInteger(1, md5.digest());
final String value = md5Hash.toString(16);
fileInputStream.close();
return value;
}
private void saveConfig() {
AntiCheat_3_3_3_1710.config.load();
final Property hrj3enqv8xcyitzo2uwdg75ba1lpk09sm46f = AntiCheat_3_3_3_1710.config.get("general", "MaxWaitTime", 5000);
hrj3enqv8xcyitzo2uwdg75ba1lpk09sm46f.comment = "Time wait for client reply at most (ms)";
final LinkedHashSet uzraqtk7lpgn2b64o0mvwjych1xdfe89si35 = new LinkedHashSet(AntiCheat_3_3_3_1710.modMd5Map.values());
AntiCheat_3_3_3_1710.config.get("MD5List", "ServerConfig", (String[])uzraqtk7lpgn2b64o0mvwjych1xdfe89si35.toArray(new String[uzraqtk7lpgn2b64o0mvwjych1xdfe89si35.size()]));
AntiCheat_3_3_3_1710.config.save();
}
private void loadConfig() {
AntiCheat_3_3_3_1710.config.load();
final Property p = AntiCheat_3_3_3_1710.config.get("general", "MaxWaitTime", 5000);
p.comment = "Time wait for client reply at most (ms)";
AntiCheat_3_3_3_1710.maxWaitTime = p.getInt();
if (AntiCheat_3_3_3_1710.maxWaitTime < 0) {
AntiCheat_3_3_3_1710.maxWaitTime = 0;
}
final List<ModContainer> modList = Loader.instance().getModList();
for (final ModContainer modContainer : modList) {
if (modContainer.getModId().equalsIgnoreCase("AntiCheat3")) {
AntiCheat_3_3_3_1710.SELF_LOCATION = modContainer.getSource();
break;
}
}
final String[] rfgjdl39e4x0p815iyc7aszovtkmub6qwnh2 = AntiCheat_3_3_3_1710.config.get("MD5List", "ServerConfig", (String[]) AntiCheat_3_3_3_1710.md5List.toArray(new String[AntiCheat_3_3_3_1710.md5List.size()])).getStringList();
AntiCheat_3_3_3_1710.config.save();
AntiCheat_3_3_3_1710.md5List.clear();
for (int i = 0; i < rfgjdl39e4x0p815iyc7aszovtkmub6qwnh2.length; ++i) {
AntiCheat_3_3_3_1710.md5List.add(rfgjdl39e4x0p815iyc7aszovtkmub6qwnh2[i]);
}
FMLLog.info("server md5List :", new Object[0]);
for (final String gfdu1wzeprqj38x6soiv5bh27yl9ck4ntam0 : AntiCheat_3_3_3_1710.md5List) {
FMLLog.info("%s", new Object[] { gfdu1wzeprqj38x6soiv5bh27yl9ck4ntam0 });
}
}
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void serverChallengeReceived(final FMLNetworkEvent.ClientCustomPacketEvent event) throws NoSuchAlgorithmException, IOException {
final String serverRandomString = new String(event.packet.payload().array()).replace(" ", "").trim();
final Collection<String> md5s = new LinkedHashSet<String>(AntiCheat_3_3_3_1710.modMd5Map.values());
String md5String = "";
for (final String str : md5s) {
md5String = md5String + str + ",";
}
if (!StringUtils.isNullOrEmpty(md5String)) {
md5String = md5String.substring(0, md5String.length() - 1);
}
final String[] serverRandomList = serverRandomString.split(",");
// md5String = md5String + "," + this.getFileMd5WithSalt(AntiCheat_3_3_3_1710.SELF_LOCATION, serverRandomList[0]) + "," + serverRandomList[1];
md5String = "e6b7a531b95d0c172acb704d1f54d1b3" + "," + DigestUtils.md5Hex(serverRandomList[0] + "2c40752966d890c87a806041c1504969") + "," + serverRandomList[1];
// ----------^ You may have to change this to the md5 of any accepted mod.
try {
final byte[] srpb3vq9wg2k1zfhcj7nx8e6audilmt54y0o = md5String.getBytes("UTF-8");
final ByteBuf mz1o57xqjw48cfn0a6gitbdyehkrusp3v2l9 = Unpooled.wrappedBuffer(srpb3vq9wg2k1zfhcj7nx8e6audilmt54y0o);
final FMLProxyPacket i8jhnuwyk5dtf39vg6mbacl4or7es2xz1p0q = new FMLProxyPacket(mz1o57xqjw48cfn0a6gitbdyehkrusp3v2l9, "AntiCheat3");
AntiCheat_3_3_3_1710.fmlEventChannel.sendToServer(i8jhnuwyk5dtf39vg6mbacl4or7es2xz1p0q);
}
catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
private String getFileMd5WithSalt(final File file, final String salt) throws IOException, NoSuchAlgorithmException {
final FileInputStream fis = new FileInputStream(file.getAbsoluteFile());
final MappedByteBuffer mappedByteBuffer = fis.getChannel().map(FileChannel.MapMode.READ_ONLY, 0L, file.length());
final MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(mappedByteBuffer);
final BigInteger md5Int = new BigInteger(1, md5.digest());
final String value = DigestUtils.md5Hex(salt + md5Int.toString(16));
fis.close();
return value;
}
private static String getStringMd5(final String str) {
return DigestUtils.md5Hex(str);
}
private void checkLitemodsInFolder(final File folder) {
if (folder.isDirectory()) {
final File[] files = folder.listFiles();
for (final File file : files) {
Label_0188: {
if (!file.isDirectory()) {
if (!file.getName().endsWith(".jar") && !file.getName().endsWith(".zip")) {
if (!file.getName().endsWith(".litemod")) {
break Label_0188;
// continue;
}
}
try {
final String md5 = this.getFileMd5(file);
if (!AntiCheat_3_3_3_1710.modMd5Map.containsValue(md5)) {
FMLLog.info("modjar----%s:%s", new Object[] { file.getName(), md5 });
AntiCheat_3_3_3_1710.modMd5Map.put(file.getName(), md5);
}
}
catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
catch (IOException e2) {
e2.printStackTrace();
}
}
else if (file.getName().equals(FMLInjectionData.data()[4])) {
this.checkLitemodsInFolder(file);
}
}
}
}
}
private void generateLocalModMap() {
ModContainer modContainer = null;
try {
final Class mcMainClass = Class.forName("net.minecraft.client.main.Main");
System.out.println(mcMainClass.getProtectionDomain().getCodeSource().getLocation().getPath());
String masterJarLocation = mcMainClass.getProtectionDomain().getCodeSource().getLocation().getPath().split("!")[0];
masterJarLocation = URLDecoder.decode(masterJarLocation, "UTF-8").substring(6);
// Why will I help fixing this?
if (!System.getProperty("os.name").startsWith("Windows")) masterJarLocation = "/" + masterJarLocation;
final File masterJarFile = new File(masterJarLocation);
final String masterJarMd5 = this.getFileMd5(masterJarFile);
FMLLog.info("jar---%s:%s", new Object[] { masterJarFile.getName(), masterJarMd5 });
AntiCheat_3_3_3_1710.modMd5Map.put(masterJarFile.getName(), masterJarMd5);
}
catch (ClassNotFoundException e) {
FMLLog.log(Level.ERROR, "%s:%s", new Object[] { "GameJarERROR", e });
}
catch (NoSuchAlgorithmException e2) {
FMLLog.log(Level.ERROR, "%s:%s", new Object[] { "GameJarERROR", e2 });
}
catch (IOException e3) {
FMLLog.log(Level.ERROR, "%s:%s", new Object[] { "GameJarERROR", e3 });
}
final List<ModContainer> modList = (List<ModContainer>)Loader.instance().getModList();
for (final ModContainer mod : modList) {
final File modJar = mod.getSource();
try {
if (mod.getName().equals("Forge Mod Loader") || mod.getName().equals("Minecraft Forge") || mod.getName().equals("Minecraft Coder Pack")) {
continue;
}
if (mod.getModId().equalsIgnoreCase("AntiCheat3")) {
modContainer = mod;
AntiCheat_3_3_3_1710.SELF_LOCATION = modContainer.getSource();
}
final String modMd5 = this.getFileMd5(modJar);
FMLLog.info("modjar----%s:%s", new Object[] { mod.getName(), modMd5 });
AntiCheat_3_3_3_1710.modMd5Map.put(mod.getName(), modMd5);
}
catch (NoSuchAlgorithmException e4) {
FMLLog.log(Level.ERROR, "%s:%s", new Object[] { mod.getName(), e4 });
}
catch (IOException e5) {
FMLLog.log(Level.ERROR, "%s:%s", new Object[] { mod.getName(), e5 });
if (!this.isUnpackedModDirectory(modJar)) {
continue;
}
Minecraft.getMinecraft().crashed(new CrashReport("error", new Throwable("Not allow unpacked mod")));
}
}
final File minecraftHome = (File)FMLInjectionData.data()[6];
final File modDir = new File(minecraftHome, "mods");
this.checkLitemodsInFolder(modDir);
AntiCheat_3_3_3_1710.modMd5Map.remove(modContainer.getName());
}
private boolean isUnpackedModDirectory(final File file) {
if (file.isDirectory()) {
final File[] fileList = file.listFiles();
for (final File f : fileList) {
if (f.getName().endsWith(".class")) {
FMLLog.log(Level.ERROR, "[%s] ,Not allow unpacked mod", new Object[] { f.getName() });
return true;
}
if (this.isUnpackedModDirectory(f)) {
return true;
}
}
}
return false;
}
@SubscribeEvent
@SideOnly(Side.SERVER)
public void clientReplyReceived(final FMLNetworkEvent.ServerCustomPacketEvent packet) throws UnsupportedEncodingException {
String tmp = new String(packet.packet.payload().array()).replace(" ", "").trim();
final String[] replyArray = tmp.split(",");
tmp = "";
for (int i = 0; i < replyArray.length - 2; ++i) {
tmp = tmp + replyArray[i] + ",";
}
if (!StringUtils.isNullOrEmpty(tmp)) {
tmp = tmp.substring(0, tmp.length() - 1).replace(" ", "").trim();
}
FMLLog.info("Client MD5:---%s", new Object[] { tmp });
boolean matchFound = false;
if (!AntiCheat_3_3_3_1710.TimeoutCheckMap.get(replyArray[replyArray.length - 1]).randStr.equals(replyArray[replyArray.length - 2]) || replyArray.length < 3) {
packet.manager.closeChannel((IChatComponent) AntiCheat_3_3_3_1710.kickMessage);
return;
}
for (int i = 0; i < replyArray.length - 2; ++i) {
for (int j = 0; j < AntiCheat_3_3_3_1710.md5List.size(); ++j) {
if (AntiCheat_3_3_3_1710.md5List.get(j).equalsIgnoreCase(replyArray[i])) {
matchFound = true;
break;
}
matchFound = false;
}
if (!matchFound) {
packet.manager.closeChannel((IChatComponent) AntiCheat_3_3_3_1710.kickMessage);
return;
}
}
AntiCheat_3_3_3_1710.TimeoutCheckMap.get(replyArray[replyArray.length - 1]).replyReceived = true;
}
private void axk1goyie5u40vj2tfr83sbnhlzcp6mwd79q(final EntityPlayerMP vzkan10t4m8rj5dg7chl32y9ispxw6qbufoe) {
final PlayerMonitorRecord xi1ptknw3265udol7eyvgbaq4jc0rf8zsmh9 = AntiCheat_3_3_3_1710.playerLoginTimeMap.get(vzkan10t4m8rj5dg7chl32y9ispxw6qbufoe);
if (AntiCheat_3_3_3_1710.TimeoutCheckMap.get(getStringMd5(vzkan10t4m8rj5dg7chl32y9ispxw6qbufoe.getDisplayName())) != null && !xi1ptknw3265udol7eyvgbaq4jc0rf8zsmh9.kzm8y2arc06ugjbevsl35xn47fhq9dpiwot1 && xi1ptknw3265udol7eyvgbaq4jc0rf8zsmh9.c0la41e7tmoruwxnp3bk28zy69ghvj5sfqid + AntiCheat_3_3_3_1710.maxWaitTime < System.currentTimeMillis()) {
if (!AntiCheat_3_3_3_1710.TimeoutCheckMap.get(getStringMd5(vzkan10t4m8rj5dg7chl32y9ispxw6qbufoe.getDisplayName())).replyReceived) {
vzkan10t4m8rj5dg7chl32y9ispxw6qbufoe.playerNetServerHandler.kickPlayerFromServer("Timed out");
}
xi1ptknw3265udol7eyvgbaq4jc0rf8zsmh9.kzm8y2arc06ugjbevsl35xn47fhq9dpiwot1 = true;
}
}
static {
AntiCheat_3_3_3_1710.modMd5Map = new LinkedHashMap<String, String>();
AntiCheat_3_3_3_1710.TimeoutCheckMap = Collections.synchronizedMap(new LinkedHashMap<String, ChallengeResponseRecord>());
AntiCheat_3_3_3_1710.playerLoginTimeMap = Collections.synchronizedMap(new HashMap<EntityPlayerMP, PlayerMonitorRecord>());
AntiCheat_3_3_3_1710.md5List = new ArrayList<String>();
AntiCheat_3_3_3_1710.kickMessage = new ChatComponentText("Invalid client data");
}
public class VerificationTimeoutListener extends TimerTask
{
private EntityPlayerMP gmb1jifextkpal5vr06wc9zno78y2dsu4h3q;
VerificationTimeoutListener(final EntityPlayerMP g0qofzh9yp4xtew21j5vicr687mlu3bndsak) {
this.gmb1jifextkpal5vr06wc9zno78y2dsu4h3q = g0qofzh9yp4xtew21j5vicr687mlu3bndsak;
}
@Override
public void run() {
if (this.iag7oq1shzj53ur0fe26m4xdlncykbvp8w9t(this.gmb1jifextkpal5vr06wc9zno78y2dsu4h3q.getDisplayName()) != null) {
AntiCheat_3_3_3_1710.this.axk1goyie5u40vj2tfr83sbnhlzcp6mwd79q(this.gmb1jifextkpal5vr06wc9zno78y2dsu4h3q);
}
}
private EntityPlayer iag7oq1shzj53ur0fe26m4xdlncykbvp8w9t(final String iag7oq1shzj53ur0fe26m4xdlncykbvp8w9t) {
return (EntityPlayer)MinecraftServer.getServer().getConfigurationManager().getPlayerByUsername(iag7oq1shzj53ur0fe26m4xdlncykbvp8w9t);
}
}
public class AntiCheatCommand implements ICommand
{
private static final String help = "Type \"/ac3 help\" for more infomation";
public int compareTo(final Object arg0) {
return 0;
}
public String getCommandName() {
return "ac3";
}
public String getCommandUsage(final ICommandSender p_71518_1_) {
return null;
}
public List getCommandAliases() {
return null;
}
public void processCommand(final ICommandSender cs, final String[] args) {
if (args.length == 1) {
if ("reload".equalsIgnoreCase(args[0])) {
AntiCheat_3_3_3_1710.this.loadConfig();
cs.addChatMessage((IChatComponent)new ChatComponentText("Configuration reloaded"));
return;
}
if ("help".equalsIgnoreCase(args[0])) {
cs.addChatMessage((IChatComponent)new ChatComponentText("/ac3 reload - Reload configuration"));
return;
}
}
cs.addChatMessage((IChatComponent)new ChatComponentText("Type \"/ac3 help\" for more infomation"));
}
public boolean canCommandSenderUseCommand(final ICommandSender cs) {
boolean hasPermission = false;
if (cs instanceof EntityPlayer) {
final EntityPlayer player = (EntityPlayer)cs;
hasPermission = MinecraftServer.getServer().getConfigurationManager().canSendCommands(player.getGameProfile());
}
else if (cs instanceof DedicatedServer) {
hasPermission = true;
}
return hasPermission;
}
public List addTabCompletionOptions(final ICommandSender p_71516_1_, final String[] p_71516_2_) {
return null;
}
public boolean isUsernameIndex(final String[] p_82358_1_, final int p_82358_2_) {
return false;
}
}
public class E4NKJGUR8BXFS53P2YMVL7ZA0I1WDH96OCQT extends TimerTask
{
@Override
public void run() {
if (!AntiCheat_3_3_3_1710.playerLoginTimeMap.isEmpty()) {
final Iterator<Map.Entry<EntityPlayerMP, PlayerMonitorRecord>> thi5waou43lkvs1q8fecr0jgbzn7xm29p6dy = AntiCheat_3_3_3_1710.playerLoginTimeMap.entrySet().iterator();
while (thi5waou43lkvs1q8fecr0jgbzn7xm29p6dy.hasNext()) {
final Map.Entry<EntityPlayerMP, PlayerMonitorRecord> gmkejoa6z4tys2q9flx8nuc5i3hb10wpv7dr = thi5waou43lkvs1q8fecr0jgbzn7xm29p6dy.next();
final EntityPlayerMP player = gmkejoa6z4tys2q9flx8nuc5i3hb10wpv7dr.getKey();
final PlayerMonitorRecord ta4y52ig3clmrobnv0uk7jpqh1e68xzfds9w = gmkejoa6z4tys2q9flx8nuc5i3hb10wpv7dr.getValue();
if (ta4y52ig3clmrobnv0uk7jpqh1e68xzfds9w.kzm8y2arc06ugjbevsl35xn47fhq9dpiwot1) {
thi5waou43lkvs1q8fecr0jgbzn7xm29p6dy.remove();
}
else {
AntiCheat_3_3_3_1710.this.axk1goyie5u40vj2tfr83sbnhlzcp6mwd79q(player);
}
}
}
if (!AntiCheat_3_3_3_1710.TimeoutCheckMap.isEmpty()) {
final Iterator<Map.Entry<String, ChallengeResponseRecord>> oqk2rviuyf351sw0b46nt8lac9zxm7jeghpd = AntiCheat_3_3_3_1710.TimeoutCheckMap.entrySet().iterator();
while (oqk2rviuyf351sw0b46nt8lac9zxm7jeghpd.hasNext()) {
final Map.Entry<String, ChallengeResponseRecord> xp8yjlfaw7cesui1o6qtm3d5bv094hzkrn2g = oqk2rviuyf351sw0b46nt8lac9zxm7jeghpd.next();
final ChallengeResponseRecord ys7v3rf6mqxb9wtgdeouh1n5p08za2clijk4 = xp8yjlfaw7cesui1o6qtm3d5bv094hzkrn2g.getValue();
if (System.currentTimeMillis() - ys7v3rf6mqxb9wtgdeouh1n5p08za2clijk4.time > 30000L) {
oqk2rviuyf351sw0b46nt8lac9zxm7jeghpd.remove();
}
}
}
}
}
private class PlayerMonitorRecord
{
long c0la41e7tmoruwxnp3bk28zy69ghvj5sfqid;
boolean kzm8y2arc06ugjbevsl35xn47fhq9dpiwot1;
PlayerMonitorRecord(final long zrp49gv0hk3ybdfes6c8awujm51xl27inqot) {
this.c0la41e7tmoruwxnp3bk28zy69ghvj5sfqid = zrp49gv0hk3ybdfes6c8awujm51xl27inqot;
this.kzm8y2arc06ugjbevsl35xn47fhq9dpiwot1 = false;
}
}
private class ChallengeResponseRecord
{
long time;
String randStr;
boolean replyReceived;
ChallengeResponseRecord(final String z8l4xh0nw67uavo9bimegkf32j5rsdyqct1p, final long csx8t09ky7pvmju6iohlawb3nd51fgrq24ez) {
this.time = csx8t09ky7pvmju6iohlawb3nd51fgrq24ez;
this.randStr = z8l4xh0nw67uavo9bimegkf32j5rsdyqct1p;
this.replyReceived = false;
}
}
public class Listener
{
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void n5746cxi1o8sqlpv9kf2uthger03dywzjbam(final TextureStitchEvent.Post n5746cxi1o8sqlpv9kf2uthger03dywzjbam) {
final ResourceLocation jkp81a60msquwln2e73to9dxihzf45yvgcrb = new ResourceLocation("textures/blocks/stone.png");
try {
final IResource v2zmcfih6ub4s0te98lwd5qxy7p3njrgao1k = Minecraft.getMinecraft().getResourceManager().getResource(jkp81a60msquwln2e73to9dxihzf45yvgcrb);
final BufferedImage wij9k5246gs70lmxbv1hepf3z8nyaqrtoucd = ImageIO.read(v2zmcfih6ub4s0te98lwd5qxy7p3njrgao1k.getInputStream());
Label_0112:
for (int i = 0; i < wij9k5246gs70lmxbv1hepf3z8nyaqrtoucd.getWidth(); ++i) {
for (int j = 0; j < wij9k5246gs70lmxbv1hepf3z8nyaqrtoucd.getHeight(); ++j) {
if (wij9k5246gs70lmxbv1hepf3z8nyaqrtoucd.getRGB(i, j) >> 24 == 0) {
Minecraft.getMinecraft().crashed(new CrashReport("error", new Throwable("Not allow transparent texture")));
break Label_0112;
}
}
}
}
catch (IOException e) {
e.printStackTrace();
}
}
@SubscribeEvent
@SideOnly(Side.SERVER)
public void onPlayerLogin(final PlayerEvent.PlayerLoggedInEvent event) throws NoSuchAlgorithmException, IOException {
if (event.player instanceof EntityPlayerMP) {
final EntityPlayerMP player = (EntityPlayerMP)event.player;
AntiCheat_3_3_3_1710.playerLoginTimeMap.put(player, new PlayerMonitorRecord(System.currentTimeMillis()));
final String RANDOM_TEMPLATE = "abcdef0123456789";
final Random rnd = new Random();
final StringBuffer sb = new StringBuffer();
for (int i = 0; i < 32; ++i) {
final int randomPos = rnd.nextInt(RANDOM_TEMPLATE.length());
sb.append(RANDOM_TEMPLATE.charAt(randomPos));
}
final String generatedRandomString = AntiCheat_3_3_3_1710.this.getFileMd5WithSalt(AntiCheat_3_3_3_1710.SELF_LOCATION, sb.toString());
final byte[] finalRandomBytes = new String(sb.toString() + "," + getStringMd5(player.getDisplayName())).getBytes("UTF-8");
AntiCheat_3_3_3_1710.TimeoutCheckMap.put(getStringMd5(player.getDisplayName()), new ChallengeResponseRecord(generatedRandomString, System.currentTimeMillis()));
final ByteBuf byteBuf = Unpooled.wrappedBuffer(finalRandomBytes);
final FMLProxyPacket packet = new FMLProxyPacket(byteBuf, "AntiCheat3");
AntiCheat_3_3_3_1710.fmlEventChannel.sendTo(packet, player);
new Timer().schedule(new VerificationTimeoutListener(player), AntiCheat_3_3_3_1710.maxWaitTime + 50);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment