Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: head-src/Hwid/+Hwid.java
- ===================================================================
- /*
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later
- * version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see <http://www.gnu.org/licenses/>.
- */
- package Hwid;
- import Hwid.crypt.Manager;
- import Hwid.hwidmanager.HWIDBan;
- import Hwid.hwidmanager.HWIDManager;
- import Hwid.utils.Util;
- import java.io.IOException;
- import java.nio.ByteBuffer;
- import java.util.concurrent.ConcurrentHashMap;
- import java.util.logging.Logger;
- import com.l2jfrozen.crypt.BlowfishEngine;
- import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
- import com.l2jfrozen.gameserver.network.L2GameClient;
- import com.l2jfrozen.gameserver.network.serverpackets.ServerClose;
- public class Hwid
- {
- protected static Logger _log = Logger.getLogger(Hwid.class.getName());
- private static byte[] _key = new byte[16];
- static byte version = 11;
- protected static ConcurrentHashMap<String, Manager.InfoSet> _objects = new ConcurrentHashMap<>();
- public static void Init()
- {
- HwidConfig.load();
- if (isProtectionOn())
- {
- HWIDBan.getInstance();
- HWIDManager.getInstance();
- Manager.getInstance();
- }
- }
- public static boolean isProtectionOn()
- {
- if (HwidConfig.ALLOW_GUARD_SYSTEM)
- return true;
- return false;
- }
- public static byte[] getKey(byte[] key)
- {
- // byte[] bfkey = FirstKey.SKBOX;
- byte[] bfkey =
- {
- 110,
- 36,
- 2,
- 15,
- -5,
- 17,
- 24,
- 23,
- 18,
- 45,
- 1,
- 21,
- 122,
- 16,
- -5,
- 12
- };
- try
- {
- BlowfishEngine bf = new BlowfishEngine();
- bf.init(true, bfkey);
- bf.processBlock(key, 0, _key, 0);
- bf.processBlock(key, 8, _key, 8);
- }
- catch (IOException e)
- {
- _log.info("Bad key!!!");
- }
- return _key;
- }
- public static void addPlayer(L2GameClient client)
- {
- if (isProtectionOn() && client != null)
- Manager.getInstance().addPlayer(client);
- }
- public static void removePlayer(L2GameClient client)
- {
- if (isProtectionOn() && client != null)
- Manager.removePlayer(client.getPlayerName());
- }
- public static boolean checkVerfiFlag(L2GameClient client, int flag)
- {
- boolean result = true;
- int fl = Integer.reverseBytes(flag);
- if (fl == -1)
- // Log.add("Error Verify Flag|" client.toString(), _logFile);
- return false;
- else if (fl == 1342177280)
- // Log.add("Error get net data client|" client.toString() "|DEBUG INFO:" fl, _logFile);
- return false;
- else
- {
- if ((fl & 1) != 0)
- // Log.add("Sniffer detect |" client.toString() "|DEBUG INFO:" fl, _logFile);
- result = false;
- // Console CMD
- if ((fl & 16) != 0)
- // Log.add("Sniffer detect2 |" client.toString() "|DEBUG INFO:" fl, _logFile);
- result = false;
- if ((fl & 268435456) != 0)
- // Log.add("L2ext detect |" client.toString() "|DEBUG INFO:" fl, _logFile);
- result = false;
- return result;
- }
- }
- public static int dumpData(int _id, int position, L2GameClient pi)
- {
- int value = 0;
- position = position > 4 ? 5 : position;
- boolean isIdZero = false;
- if (_id == 0)
- isIdZero = true;
- // Log.add("Cannot read DumpId|Target:" _positionName[position] "|" pi.toString() "|DEBUG INFO:" _id, _logFile);
- switch (position)
- {
- case 0:
- // IG
- if (_id != 1435233386)
- {
- if (!isIdZero)
- {
- // Log.add(_positionName[position] " was found|" pi.toString() "|DEBUG INFO:" _id, _logFile);
- }
- value = 1/* HwidConfig.PROTECT_PENALTY_IG */;
- }
- break;
- case 1:
- // Console CMD
- if (_id != 16)
- {
- if (!isIdZero)
- {
- // Log.add(_positionName[position] " was found|" pi.toString() "|DEBUG INFO:" _id, _logFile);
- }
- value = 2/* HwidConfig.PROTECT_PENALTY_CONSOLE_CMD */;
- }
- break;
- case 2:
- case 3:
- case 4:
- // check debuger (0xСС) or hook (0xE9)
- int code = _id & 0xFF000000;
- if (code == 0xCC)
- {
- // Log.add("Attempts!!! Debuger was found|" pi.toString() "|DEBUG INFO:" _id, _logFile);
- }
- // L2phx (connect, send, recv)
- if (code == 0xE9)
- // Log.add(_positionName[position] " was found|" pi.toString() "|DEBUG INFO:" _id, _logFile);
- value = 3/* HwidConfig.PROTECT_PENALTY_L2PHX */;
- break;
- default:
- value = 0;
- break;
- }
- return value;
- }
- public static int calcPenalty(byte[] data, L2GameClient pi)
- {
- int sum = -1;
- if (Util.verifyChecksum(data, 0, data.length))
- {
- ByteBuffer buf = ByteBuffer.wrap(data, 0, data.length - 4);
- sum = 0;
- int lenPenalty = (data.length - 4) / 4;
- for (int i = 0; i < lenPenalty; i++)
- sum = Hwid.dumpData(buf.getInt(), i, pi);
- }
- return sum;
- }
- public static boolean CheckHWIDs(L2GameClient client, int LastError1, int LastError2)
- {
- boolean resultHWID = false;
- boolean resultLastError = false;
- String HWID = client.getHWID();
- if (HWID.equalsIgnoreCase("fab800b1cc9de379c8046519fa841e6"))
- // Log.add("HWID:" HWID "|is empty, account:" client.getLoginName() "|IP: " client.toString(), _logFile);
- if (HwidConfig.PROTECT_KICK_WITH_EMPTY_HWID)
- {
- resultHWID = true;
- }
- if (LastError1 != 0)
- {
- // Log.add("LastError(HWID):" LastError1 "|" Util.LastErrorConvertion(Integer.valueOf(LastError1)) "|isn\'t empty, " client.toString(), _logFile);
- if (HwidConfig.PROTECT_KICK_WITH_LASTERROR_HWID)
- {
- resultLastError = true;
- }
- }
- return resultHWID || resultLastError;
- }
- public static String fillHex(int data, int digits)
- {
- String number = Integer.toHexString(data);
- for (int i = number.length(); i < digits; i++)
- number = "0" +number;
- return number;
- }
- public static String ExtractHWID(byte[] _data)
- {
- if (!Util.verifyChecksum(_data, 0, _data.length))
- return null;
- StringBuilder resultHWID = new StringBuilder();
- for (int i = 0; i < _data.length - 8; i++)
- resultHWID.append(fillHex(_data[i] & 255, 2));
- return resultHWID.toString();
- }
- public static boolean doAuthLogin(L2GameClient client, byte[] data, String loginName)
- {
- if (!isProtectionOn())
- return true;
- client.setLoginName(loginName);
- String fullHWID = ExtractHWID(data);
- if (fullHWID == null)
- {
- _log.info("AuthLogin CRC Check Fail! May be BOT or unprotected client! Client IP: " + client.toString());
- client.close(ServerClose.STATIC_PACKET);
- return false;
- }
- int LastError1 = ByteBuffer.wrap(data, 16, 4).getInt();
- if (CheckHWIDs(client, LastError1, 0))
- {
- _log.info("HWID error, look protection_logs.txt file, from IP: " + client.toString());
- client.close(ServerClose.STATIC_PACKET);
- return false;
- }
- if (HWIDBan.getInstance().checkFullHWIDBanned(client))
- {
- _log.info("Client " + client + " is banned. Kicked! |HWID: " + client.getHWID() + " IP: " + client.toString());
- client.close(ServerClose.STATIC_PACKET);
- }
- int VerfiFlag = ByteBuffer.wrap(data, 40, 4).getInt();
- if (!checkVerfiFlag(client, VerfiFlag))
- return false;
- return true;
- }
- public static void doDisconection(L2GameClient client)
- {
- removePlayer(client);
- }
- public static boolean checkPlayerWithHWID(L2GameClient client, int playerID, String playerName)
- {
- if (!isProtectionOn())
- return true;
- client.setPlayerName(playerName);
- client.setPlayerId(playerID);
- if (HwidConfig.PROTECT_WINDOWS_COUNT != 0)
- {
- final int count = Manager.getCountByHWID(client.getHWID());
- if (count > HwidConfig.PROTECT_WINDOWS_COUNT && count > HWIDManager.getAllowedWindowsCount(client))
- {
- _log.info("Multi windows: " + client.toString());
- client.close(ServerClose.STATIC_PACKET);
- return false;
- }
- }
- addPlayer(client);
- return true;
- }
- public static void nopath(L2GameClient client)
- {
- _log.info("Client " + client + " is no have path kick: " + client.getHWID() + " IP: " + client.toString());
- client.close(ServerClose.STATIC_PACKET);
- }
- public static void enterlog(L2PcInstance player, L2GameClient client)
- {
- if (HwidConfig.ALLOW_GUARD_SYSTEM && HwidConfig.ENABLE_CONSOLE_LOG)
- _log.info("HWID : [" + client.getHWID() + "], character: [" + player.getName() + "] PlayerId: [" + player.getObjectId() + " ]");
- }
- public static void waitSecs(int i)
- {
- try
- {
- Thread.sleep(i * 1000);
- }
- catch (InterruptedException ie)
- {
- ie.printStackTrace();
- }
- }
- }
- Index: head-src/Hwid/+HwidConfig.java
- ===================================================================
- /*
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later
- * version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see <http://www.gnu.org/licenses/>.
- */
- package Hwid;
- import Hwid.crypt.FirstKey;
- import java.io.File;
- import java.io.FileInputStream;
- import java.io.InputStream;
- import java.util.Properties;
- import java.util.logging.Logger;
- public class HwidConfig
- {
- protected static Logger _log = Logger.getLogger(HwidConfig.class.getName());
- public static final String D_GUARD_FILE = "./config/Hwid.properties";
- public static final boolean PROTECT_DEBUG = false;
- public static final boolean PROTECT_ENABLE_HWID_LOCK = false;
- public static byte[] GUARD_CLIENT_CRYPT_KEY;
- public static byte[] GUARD_CLIENT_CRYPT;
- public static byte[] GUARD_SERVER_CRYPT_KEY;
- public static byte[] GUARD_SERVER_CRYPT;
- public static byte FST_KEY;
- public static byte SCN_KEY;
- public static byte ANP_KEY;
- public static byte ULT_KEY;
- public static int NPROTECT_KEY = -1;
- public static String NPROTECT_USERNAME;
- public static int SITE_01;
- public static final boolean ALLOW_DUALBOX1 = true;
- public static boolean ALLOW_GUARD_SYSTEM;
- public static int PROTECT_WINDOWS_COUNT;
- public static int GET_CLIENT_HWID;
- public static boolean ALLOW_SEND_GG_REPLY;
- public static boolean ENABLE_CONSOLE_LOG;
- public static long TIME_SEND_GG_REPLY;
- public static boolean PROTECT_KICK_WITH_EMPTY_HWID;
- public static boolean PROTECT_KICK_WITH_LASTERROR_HWID;
- public static String MESSAGE_GOOD;
- public static String MESSAGE_ERROR;
- public static final void load()
- {
- File fp = new File(D_GUARD_FILE);
- ALLOW_GUARD_SYSTEM = fp.exists();
- if (ALLOW_GUARD_SYSTEM)
- try
- {
- Properties guardSettings = new Properties();
- InputStream is = new FileInputStream(fp);
- guardSettings.load(is);
- is.close();
- _log.info("- Loading Protection Configs");
- ALLOW_GUARD_SYSTEM = getBooleanProperty(guardSettings, "AllowGuardSystem", true);
- PROTECT_WINDOWS_COUNT = getIntProperty(guardSettings, "AllowedWindowsCount", 1);
- NPROTECT_USERNAME = guardSettings.getProperty("UserName", "");
- SITE_01 = getIntProperty(guardSettings, "Prtctn", 1);
- FST_KEY = getByteProperty(guardSettings, "FstKey", 110);
- SCN_KEY = getByteProperty(guardSettings, "ScnKey", 36);
- ANP_KEY = getByteProperty(guardSettings, "AnpKey", -5);
- ULT_KEY = getByteProperty(guardSettings, "UltKey", 12);
- GET_CLIENT_HWID = getIntProperty(guardSettings, "UseClientHWID", 2);
- ENABLE_CONSOLE_LOG = getBooleanProperty(guardSettings, "EnableConsoleLog", false);
- PROTECT_KICK_WITH_EMPTY_HWID = getBooleanProperty(guardSettings, "KickWithEmptyHWID", false);
- PROTECT_KICK_WITH_LASTERROR_HWID = getBooleanProperty(guardSettings, "KickWithLastErrorHWID", false);
- MESSAGE_GOOD = guardSettings.getProperty("ServerKey", "");
- MESSAGE_ERROR = guardSettings.getProperty("ClientKey", "");
- String key_client = "GOGX2_RB(]Slnjt15~EgyqTv%[$YR]!1E~ayK?$9[R%%m4{zoMF$D?f:zvS2q&>~";
- String key_server = "b*qR43<9J1pD>Q4Uns6FsKao~VbU0H]y`A0ytTveiWn)SuSYsM?m*eblL!pwza!t";
- byte[] keyS = key_server.getBytes();
- byte[] tmpS = new byte[32];
- byte[] keyC = key_client.getBytes();
- byte[] tmpC = new byte[32];
- System.arraycopy(keyC, 0, tmpC, 0, 32);
- GUARD_CLIENT_CRYPT_KEY = FirstKey.expandKey(tmpC, 32);
- System.arraycopy(keyC, 32, tmpC, 0, 32);
- GUARD_CLIENT_CRYPT = FirstKey.expandKey(tmpC, 32);
- System.arraycopy(keyS, 0, tmpS, 0, 32);
- GUARD_SERVER_CRYPT_KEY = FirstKey.expandKey(tmpS, 32);
- System.arraycopy(keyS, 32, tmpS, 0, 32);
- GUARD_SERVER_CRYPT = FirstKey.expandKey(tmpS, 32);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
- protected static Properties getSettings(String CONFIGURATION_FILE) throws Exception
- {
- Properties serverSettings = new Properties();
- InputStream is = new FileInputStream(new File(CONFIGURATION_FILE));
- serverSettings.load(is);
- is.close();
- return serverSettings;
- }
- protected static String getProperty(Properties prop, String name)
- {
- return prop.getProperty(name.trim(), null);
- }
- protected static String getProperty(Properties prop, String name, String _default)
- {
- String s = getProperty(prop, name);
- return s == null ? _default : s;
- }
- protected static int getIntProperty(Properties prop, String name, int _default)
- {
- String s = getProperty(prop, name);
- return s == null ? _default : Integer.parseInt(s.trim());
- }
- protected static int getIntHexProperty(Properties prop, String name, int _default)
- {
- return (int) getLongHexProperty(prop, name, _default);
- }
- protected static long getLongProperty(Properties prop, String name, long _default)
- {
- String s = getProperty(prop, name);
- return s == null ? _default : Long.parseLong(s.trim());
- }
- protected static long getLongHexProperty(Properties prop, String name, long _default)
- {
- String s = getProperty(prop, name);
- if (s == null)
- return _default;
- s = s.trim();
- if (!s.startsWith("0x"))
- s = "0x" + s;
- return Long.decode(s).longValue();
- }
- protected static byte getByteProperty(Properties prop, String name, byte _default)
- {
- String s = getProperty(prop, name);
- return s == null ? _default : Byte.parseByte(s.trim());
- }
- protected static byte getByteProperty(Properties prop, String name, int _default)
- {
- return getByteProperty(prop, name, (byte) _default);
- }
- protected static boolean getBooleanProperty(Properties prop, String name, boolean _default)
- {
- String s = getProperty(prop, name);
- return s == null ? _default : Boolean.parseBoolean(s.trim());
- }
- protected static float getFloatProperty(Properties prop, String name, float _default)
- {
- String s = getProperty(prop, name);
- return s == null ? _default : Float.parseFloat(s.trim());
- }
- protected static float getFloatProperty(Properties prop, String name, double _default)
- {
- return getFloatProperty(prop, name, (float) _default);
- }
- protected static double getDoubleProperty(Properties prop, String name, double _default)
- {
- String s = getProperty(prop, name);
- return s == null ? _default : Double.parseDouble(s.trim());
- }
- protected static int[] getIntArray(Properties prop, String name, int[] _default)
- {
- String s = getProperty(prop, name);
- return s == null ? _default : parseCommaSeparatedIntegerArray(s.trim());
- }
- protected static float[] getFloatArray(Properties prop, String name, float[] _default)
- {
- String s = getProperty(prop, name);
- return s == null ? _default : parseCommaSeparatedFloatArray(s.trim());
- }
- protected static String[] getStringArray(Properties prop, String name, String[] _default, String delimiter)
- {
- String s = getProperty(prop, name);
- return s == null ? _default : s.split(delimiter);
- }
- protected static String[] getStringArray(Properties prop, String name, String[] _default)
- {
- return getStringArray(prop, name, _default, ",");
- }
- protected static float[] parseCommaSeparatedFloatArray(String s)
- {
- if (s.isEmpty())
- return new float[0];
- String[] tmp = s.replaceAll(",", ";").split(";");
- float[] ret = new float[tmp.length];
- for (int i = 0; i < tmp.length; i++)
- ret[i] = Float.parseFloat(tmp[i]);
- return ret;
- }
- protected static int[] parseCommaSeparatedIntegerArray(String s)
- {
- if (s.isEmpty())
- return new int[0];
- String[] tmp = s.replaceAll(",", ";").split(";");
- int[] ret = new int[tmp.length];
- for (int i = 0; i < tmp.length; i++)
- ret[i] = Integer.parseInt(tmp[i]);
- return ret;
- }
- }
- Index: Head-src/Hwid/crypt/+BlowfishEngine.java
- ===================================================================
- /*
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later
- * version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see <http://www.gnu.org/licenses/>.
- */
- package Hwid;
- import java.io.IOException;
- public class BlowfishEngine
- {
- private final static int[] KP =
- {
- 0x243F6A88,
- 0x85A308D3,
- 0x13198A2E,
- 0x03707344,
- 0xA4093822,
- 0x299F31D0,
- 0x082EFA98,
- 0xEC4E6C89,
- 0x452821E6,
- 0x38D01377,
- 0xBE5466CF,
- 0x34E90C6C,
- 0xC0AC29B7,
- 0xC97C50DD,
- 0x3F84D5B5,
- 0xB5470917,
- 0x9216D5D9,
- 0x8979FB1B
- }, KS0 =
- {
- 0xD1310BA6,
- 0x98DFB5AC,
- 0x2FFD72DB,
- 0xD01ADFB7,
- 0xB8E1AFED,
- 0x6A267E96,
- 0xBA7C9045,
- 0xF12C7F99,
- 0x24A19947,
- 0xB3916CF7,
- 0x0801F2E2,
- 0x858EFC16,
- 0x636920D8,
- 0x71574E69,
- 0xA458FEA3,
- 0xF4933D7E,
- 0x0D95748F,
- 0x728EB658,
- 0x718BCD58,
- 0x82154AEE,
- 0x7B54A41D,
- 0xC25A59B5,
- 0x9C30D539,
- 0x2AF26013,
- 0xC5D1B023,
- 0x286085F0,
- 0xCA417918,
- 0xB8DB38EF,
- 0x8E79DCB0,
- 0x603A180E,
- 0x6C9E0E8B,
- 0xB01E8A3E,
- 0xD71577C1,
- 0xBD314B27,
- 0x78AF2FDA,
- 0x55605C60,
- 0xE65525F3,
- 0xAA55AB94,
- 0x57489862,
- 0x63E81440,
- 0x55CA396A,
- 0x2AAB10B6,
- 0xB4CC5C34,
- 0x1141E8CE,
- 0xA15486AF,
- 0x7C72E993,
- 0xB3EE1411,
- 0x636FBC2A,
- 0x2BA9C55D,
- 0x741831F6,
- 0xCE5C3E16,
- 0x9B87931E,
- 0xAFD6BA33,
- 0x6C24CF5C,
- 0x7A325381,
- 0x28958677,
- 0x3B8F4898,
- 0x6B4BB9AF,
- 0xC4BFE81B,
- 0x66282193,
- 0x61D809CC,
- 0xFB21A991,
- 0x487CAC60,
- 0x5DEC8032,
- 0xEF845D5D,
- 0xE98575B1,
- 0xDC262302,
- 0xEB651B88,
- 0x23893E81,
- 0xD396ACC5,
- 0x0F6D6FF3,
- 0x83F44239,
- 0x2E0B4482,
- 0xA4842004,
- 0x69C8F04A,
- 0x9E1F9B5E,
- 0x21C66842,
- 0xF6E96C9A,
- 0x670C9C61,
- 0xABD388F0,
- 0x6A51A0D2,
- 0xD8542F68,
- 0x960FA728,
- 0xAB5133A3,
- 0x6EEF0B6C,
- 0x137A3BE4,
- 0xBA3BF050,
- 0x7EFB2A98,
- 0xA1F1651D,
- 0x39AF0176,
- 0x66CA593E,
- 0x82430E88,
- 0x8CEE8619,
- 0x456F9FB4,
- 0x7D84A5C3,
- 0x3B8B5EBE,
- 0xE06F75D8,
- 0x85C12073,
- 0x401A449F,
- 0x56C16AA6,
- 0x4ED3AA62,
- 0x363F7706,
- 0x1BFEDF72,
- 0x429B023D,
- 0x37D0D724,
- 0xD00A1248,
- 0xDB0FEAD3,
- 0x49F1C09B,
- 0x075372C9,
- 0x80991B7B,
- 0x25D479D8,
- 0xF6E8DEF7,
- 0xE3FE501A,
- 0xB6794C3B,
- 0x976CE0BD,
- 0x04C006BA,
- 0xC1A94FB6,
- 0x409F60C4,
- 0x5E5C9EC2,
- 0x196A2463,
- 0x68FB6FAF,
- 0x3E6C53B5,
- 0x1339B2EB,
- 0x3B52EC6F,
- 0x6DFC511F,
- 0x9B30952C,
- 0xCC814544,
- 0xAF5EBD09,
- 0xBEE3D004,
- 0xDE334AFD,
- 0x660F2807,
- 0x192E4BB3,
- 0xC0CBA857,
- 0x45C8740F,
- 0xD20B5F39,
- 0xB9D3FBDB,
- 0x5579C0BD,
- 0x1A60320A,
- 0xD6A100C6,
- 0x402C7279,
- 0x679F25FE,
- 0xFB1FA3CC,
- 0x8EA5E9F8,
- 0xDB3222F8,
- 0x3C7516DF,
- 0xFD616B15,
- 0x2F501EC8,
- 0xAD0552AB,
- 0x323DB5FA,
- 0xFD238760,
- 0x53317B48,
- 0x3E00DF82,
- 0x9E5C57BB,
- 0xCA6F8CA0,
- 0x1A87562E,
- 0xDF1769DB,
- 0xD542A8F6,
- 0x287EFFC3,
- 0xAC6732C6,
- 0x8C4F5573,
- 0x695B27B0,
- 0xBBCA58C8,
- 0xE1FFA35D,
- 0xB8F011A0,
- 0x10FA3D98,
- 0xFD2183B8,
- 0x4AFCB56C,
- 0x2DD1D35B,
- 0x9A53E479,
- 0xB6F84565,
- 0xD28E49BC,
- 0x4BFB9790,
- 0xE1DDF2DA,
- 0xA4CB7E33,
- 0x62FB1341,
- 0xCEE4C6E8,
- 0xEF20CADA,
- 0x36774C01,
- 0xD07E9EFE,
- 0x2BF11FB4,
- 0x95DBDA4D,
- 0xAE909198,
- 0xEAAD8E71,
- 0x6B93D5A0,
- 0xD08ED1D0,
- 0xAFC725E0,
- 0x8E3C5B2F,
- 0x8E7594B7,
- 0x8FF6E2FB,
- 0xF2122B64,
- 0x8888B812,
- 0x900DF01C,
- 0x4FAD5EA0,
- 0x688FC31C,
- 0xD1CFF191,
- 0xB3A8C1AD,
- 0x2F2F2218,
- 0xBE0E1777,
- 0xEA752DFE,
- 0x8B021FA1,
- 0xE5A0CC0F,
- 0xB56F74E8,
- 0x18ACF3D6,
- 0xCE89E299,
- 0xB4A84FE0,
- 0xFD13E0B7,
- 0x7CC43B81,
- 0xD2ADA8D9,
- 0x165FA266,
- 0x80957705,
- 0x93CC7314,
- 0x211A1477,
- 0xE6AD2065,
- 0x77B5FA86,
- 0xC75442F5,
- 0xFB9D35CF,
- 0xEBCDAF0C,
- 0x7B3E89A0,
- 0xD6411BD3,
- 0xAE1E7E49,
- 0x00250E2D,
- 0x2071B35E,
- 0x226800BB,
- 0x57B8E0AF,
- 0x2464369B,
- 0xF009B91E,
- 0x5563911D,
- 0x59DFA6AA,
- 0x78C14389,
- 0xD95A537F,
- 0x207D5BA2,
- 0x02E5B9C5,
- 0x83260376,
- 0x6295CFA9,
- 0x11C81968,
- 0x4E734A41,
- 0xB3472DCA,
- 0x7B14A94A,
- 0x1B510052,
- 0x9A532915,
- 0xD60F573F,
- 0xBC9BC6E4,
- 0x2B60A476,
- 0x81E67400,
- 0x08BA6FB5,
- 0x571BE91F,
- 0xF296EC6B,
- 0x2A0DD915,
- 0xB6636521,
- 0xE7B9F9B6,
- 0xFF34052E,
- 0xC5855664,
- 0x53B02D5D,
- 0xA99F8FA1,
- 0x08BA4799,
- 0x6E85076A
- }, KS1 =
- {
- 0x4B7A70E9,
- 0xB5B32944,
- 0xDB75092E,
- 0xC4192623,
- 0xAD6EA6B0,
- 0x49A7DF7D,
- 0x9CEE60B8,
- 0x8FEDB266,
- 0xECAA8C71,
- 0x699A17FF,
- 0x5664526C,
- 0xC2B19EE1,
- 0x193602A5,
- 0x75094C29,
- 0xA0591340,
- 0xE4183A3E,
- 0x3F54989A,
- 0x5B429D65,
- 0x6B8FE4D6,
- 0x99F73FD6,
- 0xA1D29C07,
- 0xEFE830F5,
- 0x4D2D38E6,
- 0xF0255DC1,
- 0x4CDD2086,
- 0x8470EB26,
- 0x6382E9C6,
- 0x021ECC5E,
- 0x09686B3F,
- 0x3EBAEFC9,
- 0x3C971814,
- 0x6B6A70A1,
- 0x687F3584,
- 0x52A0E286,
- 0xB79C5305,
- 0xAA500737,
- 0x3E07841C,
- 0x7FDEAE5C,
- 0x8E7D44EC,
- 0x5716F2B8,
- 0xB03ADA37,
- 0xF0500C0D,
- 0xF01C1F04,
- 0x0200B3FF,
- 0xAE0CF51A,
- 0x3CB574B2,
- 0x25837A58,
- 0xDC0921BD,
- 0xD19113F9,
- 0x7CA92FF6,
- 0x94324773,
- 0x22F54701,
- 0x3AE5E581,
- 0x37C2DADC,
- 0xC8B57634,
- 0x9AF3DDA7,
- 0xA9446146,
- 0x0FD0030E,
- 0xECC8C73E,
- 0xA4751E41,
- 0xE238CD99,
- 0x3BEA0E2F,
- 0x3280BBA1,
- 0x183EB331,
- 0x4E548B38,
- 0x4F6DB908,
- 0x6F420D03,
- 0xF60A04BF,
- 0x2CB81290,
- 0x24977C79,
- 0x5679B072,
- 0xBCAF89AF,
- 0xDE9A771F,
- 0xD9930810,
- 0xB38BAE12,
- 0xDCCF3F2E,
- 0x5512721F,
- 0x2E6B7124,
- 0x501ADDE6,
- 0x9F84CD87,
- 0x7A584718,
- 0x7408DA17,
- 0xBC9F9ABC,
- 0xE94B7D8C,
- 0xEC7AEC3A,
- 0xDB851DFA,
- 0x63094366,
- 0xC464C3D2,
- 0xEF1C1847,
- 0x3215D908,
- 0xDD433B37,
- 0x24C2BA16,
- 0x12A14D43,
- 0x2A65C451,
- 0x50940002,
- 0x133AE4DD,
- 0x71DFF89E,
- 0x10314E55,
- 0x81AC77D6,
- 0x5F11199B,
- 0x043556F1,
- 0xD7A3C76B,
- 0x3C11183B,
- 0x5924A509,
- 0xF28FE6ED,
- 0x97F1FBFA,
- 0x9EBABF2C,
- 0x1E153C6E,
- 0x86E34570,
- 0xEAE96FB1,
- 0x860E5E0A,
- 0x5A3E2AB3,
- 0x771FE71C,
- 0x4E3D06FA,
- 0x2965DCB9,
- 0x99E71D0F,
- 0x803E89D6,
- 0x5266C825,
- 0x2E4CC978,
- 0x9C10B36A,
- 0xC6150EBA,
- 0x94E2EA78,
- 0xA5FC3C53,
- 0x1E0A2DF4,
- 0xF2F74EA7,
- 0x361D2B3D,
- 0x1939260F,
- 0x19C27960,
- 0x5223A708,
- 0xF71312B6,
- 0xEBADFE6E,
- 0xEAC31F66,
- 0xE3BC4595,
- 0xA67BC883,
- 0xB17F37D1,
- 0x018CFF28,
- 0xC332DDEF,
- 0xBE6C5AA5,
- 0x65582185,
- 0x68AB9802,
- 0xEECEA50F,
- 0xDB2F953B,
- 0x2AEF7DAD,
- 0x5B6E2F84,
- 0x1521B628,
- 0x29076170,
- 0xECDD4775,
- 0x619F1510,
- 0x13CCA830,
- 0xEB61BD96,
- 0x0334FE1E,
- 0xAA0363CF,
- 0xB5735C90,
- 0x4C70A239,
- 0xD59E9E0B,
- 0xCBAADE14,
- 0xEECC86BC,
- 0x60622CA7,
- 0x9CAB5CAB,
- 0xB2F3846E,
- 0x648B1EAF,
- 0x19BDF0CA,
- 0xA02369B9,
- 0x655ABB50,
- 0x40685A32,
- 0x3C2AB4B3,
- 0x319EE9D5,
- 0xC021B8F7,
- 0x9B540B19,
- 0x875FA099,
- 0x95F7997E,
- 0x623D7DA8,
- 0xF837889A,
- 0x97E32D77,
- 0x11ED935F,
- 0x16681281,
- 0x0E358829,
- 0xC7E61FD6,
- 0x96DEDFA1,
- 0x7858BA99,
- 0x57F584A5,
- 0x1B227263,
- 0x9B83C3FF,
- 0x1AC24696,
- 0xCDB30AEB,
- 0x532E3054,
- 0x8FD948E4,
- 0x6DBC3128,
- 0x58EBF2EF,
- 0x34C6FFEA,
- 0xFE28ED61,
- 0xEE7C3C73,
- 0x5D4A14D9,
- 0xE864B7E3,
- 0x42105D14,
- 0x203E13E0,
- 0x45EEE2B6,
- 0xA3AAABEA,
- 0xDB6C4F15,
- 0xFACB4FD0,
- 0xC742F442,
- 0xEF6ABBB5,
- 0x654F3B1D,
- 0x41CD2105,
- 0xD81E799E,
- 0x86854DC7,
- 0xE44B476A,
- 0x3D816250,
- 0xCF62A1F2,
- 0x5B8D2646,
- 0xFC8883A0,
- 0xC1C7B6A3,
- 0x7F1524C3,
- 0x69CB7492,
- 0x47848A0B,
- 0x5692B285,
- 0x095BBF00,
- 0xAD19489D,
- 0x1462B174,
- 0x23820E00,
- 0x58428D2A,
- 0x0C55F5EA,
- 0x1DADF43E,
- 0x233F7061,
- 0x3372F092,
- 0x8D937E41,
- 0xD65FECF1,
- 0x6C223BDB,
- 0x7CDE3759,
- 0xCBEE7460,
- 0x4085F2A7,
- 0xCE77326E,
- 0xA6078084,
- 0x19F8509E,
- 0xE8EFD855,
- 0x61D99735,
- 0xA969A7AA,
- 0xC50C06C2,
- 0x5A04ABFC,
- 0x800BCADC,
- 0x9E447A2E,
- 0xC3453484,
- 0xFDD56705,
- 0x0E1E9EC9,
- 0xDB73DBD3,
- 0x105588CD,
- 0x675FDA79,
- 0xE3674340,
- 0xC5C43465,
- 0x713E38D8,
- 0x3D28F89E,
- 0xF16DFF20,
- 0x153E21E7,
- 0x8FB03D4A,
- 0xE6E39F2B,
- 0xDB83ADF7
- }, KS2 =
- {
- 0xE93D5A68,
- 0x948140F7,
- 0xF64C261C,
- 0x94692934,
- 0x411520F7,
- 0x7602D4F7,
- 0xBCF46B2E,
- 0xD4A20068,
- 0xD4082471,
- 0x3320F46A,
- 0x43B7D4B7,
- 0x500061AF,
- 0x1E39F62E,
- 0x97244546,
- 0x14214F74,
- 0xBF8B8840,
- 0x4D95FC1D,
- 0x96B591AF,
- 0x70F4DDD3,
- 0x66A02F45,
- 0xBFBC09EC,
- 0x03BD9785,
- 0x7FAC6DD0,
- 0x31CB8504,
- 0x96EB27B3,
- 0x55FD3941,
- 0xDA2547E6,
- 0xABCA0A9A,
- 0x28507825,
- 0x530429F4,
- 0x0A2C86DA,
- 0xE9B66DFB,
- 0x68DC1462,
- 0xD7486900,
- 0x680EC0A4,
- 0x27A18DEE,
- 0x4F3FFEA2,
- 0xE887AD8C,
- 0xB58CE006,
- 0x7AF4D6B6,
- 0xAACE1E7C,
- 0xD3375FEC,
- 0xCE78A399,
- 0x406B2A42,
- 0x20FE9E35,
- 0xD9F385B9,
- 0xEE39D7AB,
- 0x3B124E8B,
- 0x1DC9FAF7,
- 0x4B6D1856,
- 0x26A36631,
- 0xEAE397B2,
- 0x3A6EFA74,
- 0xDD5B4332,
- 0x6841E7F7,
- 0xCA7820FB,
- 0xFB0AF54E,
- 0xD8FEB397,
- 0x454056AC,
- 0xBA489527,
- 0x55533A3A,
- 0x20838D87,
- 0xFE6BA9B7,
- 0xD096954B,
- 0x55A867BC,
- 0xA1159A58,
- 0xCCA92963,
- 0x99E1DB33,
- 0xA62A4A56,
- 0x3F3125F9,
- 0x5EF47E1C,
- 0x9029317C,
- 0xFDF8E802,
- 0x04272F70,
- 0x80BB155C,
- 0x05282CE3,
- 0x95C11548,
- 0xE4C66D22,
- 0x48C1133F,
- 0xC70F86DC,
- 0x07F9C9EE,
- 0x41041F0F,
- 0x404779A4,
- 0x5D886E17,
- 0x325F51EB,
- 0xD59BC0D1,
- 0xF2BCC18F,
- 0x41113564,
- 0x257B7834,
- 0x602A9C60,
- 0xDFF8E8A3,
- 0x1F636C1B,
- 0x0E12B4C2,
- 0x02E1329E,
- 0xAF664FD1,
- 0xCAD18115,
- 0x6B2395E0,
- 0x333E92E1,
- 0x3B240B62,
- 0xEEBEB922,
- 0x85B2A20E,
- 0xE6BA0D99,
- 0xDE720C8C,
- 0x2DA2F728,
- 0xD0127845,
- 0x95B794FD,
- 0x647D0862,
- 0xE7CCF5F0,
- 0x5449A36F,
- 0x877D48FA,
- 0xC39DFD27,
- 0xF33E8D1E,
- 0x0A476341,
- 0x992EFF74,
- 0x3A6F6EAB,
- 0xF4F8FD37,
- 0xA812DC60,
- 0xA1EBDDF8,
- 0x991BE14C,
- 0xDB6E6B0D,
- 0xC67B5510,
- 0x6D672C37,
- 0x2765D43B,
- 0xDCD0E804,
- 0xF1290DC7,
- 0xCC00FFA3,
- 0xB5390F92,
- 0x690FED0B,
- 0x667B9FFB,
- 0xCEDB7D9C,
- 0xA091CF0B,
- 0xD9155EA3,
- 0xBB132F88,
- 0x515BAD24,
- 0x7B9479BF,
- 0x763BD6EB,
- 0x37392EB3,
- 0xCC115979,
- 0x8026E297,
- 0xF42E312D,
- 0x6842ADA7,
- 0xC66A2B3B,
- 0x12754CCC,
- 0x782EF11C,
- 0x6A124237,
- 0xB79251E7,
- 0x06A1BBE6,
- 0x4BFB6350,
- 0x1A6B1018,
- 0x11CAEDFA,
- 0x3D25BDD8,
- 0xE2E1C3C9,
- 0x44421659,
- 0x0A121386,
- 0xD90CEC6E,
- 0xD5ABEA2A,
- 0x64AF674E,
- 0xDA86A85F,
- 0xBEBFE988,
- 0x64E4C3FE,
- 0x9DBC8057,
- 0xF0F7C086,
- 0x60787BF8,
- 0x6003604D,
- 0xD1FD8346,
- 0xF6381FB0,
- 0x7745AE04,
- 0xD736FCCC,
- 0x83426B33,
- 0xF01EAB71,
- 0xB0804187,
- 0x3C005E5F,
- 0x77A057BE,
- 0xBDE8AE24,
- 0x55464299,
- 0xBF582E61,
- 0x4E58F48F,
- 0xF2DDFDA2,
- 0xF474EF38,
- 0x8789BDC2,
- 0x5366F9C3,
- 0xC8B38E74,
- 0xB475F255,
- 0x46FCD9B9,
- 0x7AEB2661,
- 0x8B1DDF84,
- 0x846A0E79,
- 0x915F95E2,
- 0x466E598E,
- 0x20B45770,
- 0x8CD55591,
- 0xC902DE4C,
- 0xB90BACE1,
- 0xBB8205D0,
- 0x11A86248,
- 0x7574A99E,
- 0xB77F19B6,
- 0xE0A9DC09,
- 0x662D09A1,
- 0xC4324633,
- 0xE85A1F02,
- 0x09F0BE8C,
- 0x4A99A025,
- 0x1D6EFE10,
- 0x1AB93D1D,
- 0x0BA5A4DF,
- 0xA186F20F,
- 0x2868F169,
- 0xDCB7DA83,
- 0x573906FE,
- 0xA1E2CE9B,
- 0x4FCD7F52,
- 0x50115E01,
- 0xA70683FA,
- 0xA002B5C4,
- 0x0DE6D027,
- 0x9AF88C27,
- 0x773F8641,
- 0xC3604C06,
- 0x61A806B5,
- 0xF0177A28,
- 0xC0F586E0,
- 0x006058AA,
- 0x30DC7D62,
- 0x11E69ED7,
- 0x2338EA63,
- 0x53C2DD94,
- 0xC2C21634,
- 0xBBCBEE56,
- 0x90BCB6DE,
- 0xEBFC7DA1,
- 0xCE591D76,
- 0x6F05E409,
- 0x4B7C0188,
- 0x39720A3D,
- 0x7C927C24,
- 0x86E3725F,
- 0x724D9DB9,
- 0x1AC15BB4,
- 0xD39EB8FC,
- 0xED545578,
- 0x08FCA5B5,
- 0xD83D7CD3,
- 0x4DAD0FC4,
- 0x1E50EF5E,
- 0xB161E6F8,
- 0xA28514D9,
- 0x6C51133C,
- 0x6FD5C7E7,
- 0x56E14EC4,
- 0x362ABFCE,
- 0xDDC6C837,
- 0xD79A3234,
- 0x92638212,
- 0x670EFA8E,
- 0x406000E0
- }, KS3 =
- {
- 0x3A39CE37,
- 0xD3FAF5CF,
- 0xABC27737,
- 0x5AC52D1B,
- 0x5CB0679E,
- 0x4FA33742,
- 0xD3822740,
- 0x99BC9BBE,
- 0xD5118E9D,
- 0xBF0F7315,
- 0xD62D1C7E,
- 0xC700C47B,
- 0xB78C1B6B,
- 0x21A19045,
- 0xB26EB1BE,
- 0x6A366EB4,
- 0x5748AB2F,
- 0xBC946E79,
- 0xC6A376D2,
- 0x6549C2C8,
- 0x530FF8EE,
- 0x468DDE7D,
- 0xD5730A1D,
- 0x4CD04DC6,
- 0x2939BBDB,
- 0xA9BA4650,
- 0xAC9526E8,
- 0xBE5EE304,
- 0xA1FAD5F0,
- 0x6A2D519A,
- 0x63EF8CE2,
- 0x9A86EE22,
- 0xC089C2B8,
- 0x43242EF6,
- 0xA51E03AA,
- 0x9CF2D0A4,
- 0x83C061BA,
- 0x9BE96A4D,
- 0x8FE51550,
- 0xBA645BD6,
- 0x2826A2F9,
- 0xA73A3AE1,
- 0x4BA99586,
- 0xEF5562E9,
- 0xC72FEFD3,
- 0xF752F7DA,
- 0x3F046F69,
- 0x77FA0A59,
- 0x80E4A915,
- 0x87B08601,
- 0x9B09E6AD,
- 0x3B3EE593,
- 0xE990FD5A,
- 0x9E34D797,
- 0x2CF0B7D9,
- 0x022B8B51,
- 0x96D5AC3A,
- 0x017DA67D,
- 0xD1CF3ED6,
- 0x7C7D2D28,
- 0x1F9F25CF,
- 0xADF2B89B,
- 0x5AD6B472,
- 0x5A88F54C,
- 0xE029AC71,
- 0xE019A5E6,
- 0x47B0ACFD,
- 0xED93FA9B,
- 0xE8D3C48D,
- 0x283B57CC,
- 0xF8D56629,
- 0x79132E28,
- 0x785F0191,
- 0xED756055,
- 0xF7960E44,
- 0xE3D35E8C,
- 0x15056DD4,
- 0x88F46DBA,
- 0x03A16125,
- 0x0564F0BD,
- 0xC3EB9E15,
- 0x3C9057A2,
- 0x97271AEC,
- 0xA93A072A,
- 0x1B3F6D9B,
- 0x1E6321F5,
- 0xF59C66FB,
- 0x26DCF319,
- 0x7533D928,
- 0xB155FDF5,
- 0x03563482,
- 0x8ABA3CBB,
- 0x28517711,
- 0xC20AD9F8,
- 0xABCC5167,
- 0xCCAD925F,
- 0x4DE81751,
- 0x3830DC8E,
- 0x379D5862,
- 0x9320F991,
- 0xEA7A90C2,
- 0xFB3E7BCE,
- 0x5121CE64,
- 0x774FBE32,
- 0xA8B6E37E,
- 0xC3293D46,
- 0x48DE5369,
- 0x6413E680,
- 0xA2AE0810,
- 0xDD6DB224,
- 0x69852DFD,
- 0x09072166,
- 0xB39A460A,
- 0x6445C0DD,
- 0x586CDECF,
- 0x1C20C8AE,
- 0x5BBEF7DD,
- 0x1B588D40,
- 0xCCD2017F,
- 0x6BB4E3BB,
- 0xDDA26A7E,
- 0x3A59FF45,
- 0x3E350A44,
- 0xBCB4CDD5,
- 0x72EACEA8,
- 0xFA6484BB,
- 0x8D6612AE,
- 0xBF3C6F47,
- 0xD29BE463,
- 0x542F5D9E,
- 0xAEC2771B,
- 0xF64E6370,
- 0x740E0D8D,
- 0xE75B1357,
- 0xF8721671,
- 0xAF537D5D,
- 0x4040CB08,
- 0x4EB4E2CC,
- 0x34D2466A,
- 0x0115AF84,
- 0xE1B00428,
- 0x95983A1D,
- 0x06B89FB4,
- 0xCE6EA048,
- 0x6F3F3B82,
- 0x3520AB82,
- 0x011A1D4B,
- 0x277227F8,
- 0x611560B1,
- 0xE7933FDC,
- 0xBB3A792B,
- 0x344525BD,
- 0xA08839E1,
- 0x51CE794B,
- 0x2F32C9B7,
- 0xA01FBAC9,
- 0xE01CC87E,
- 0xBCC7D1F6,
- 0xCF0111C3,
- 0xA1E8AAC7,
- 0x1A908749,
- 0xD44FBD9A,
- 0xD0DADECB,
- 0xD50ADA38,
- 0x0339C32A,
- 0xC6913667,
- 0x8DF9317C,
- 0xE0B12B4F,
- 0xF79E59B7,
- 0x43F5BB3A,
- 0xF2D519FF,
- 0x27D9459C,
- 0xBF97222C,
- 0x15E6FC2A,
- 0x0F91FC71,
- 0x9B941525,
- 0xFAE59361,
- 0xCEB69CEB,
- 0xC2A86459,
- 0x12BAA8D1,
- 0xB6C1075E,
- 0xE3056A0C,
- 0x10D25065,
- 0xCB03A442,
- 0xE0EC6E0E,
- 0x1698DB3B,
- 0x4C98A0BE,
- 0x3278E964,
- 0x9F1F9532,
- 0xE0D392DF,
- 0xD3A0342B,
- 0x8971F21E,
- 0x1B0A7441,
- 0x4BA3348C,
- 0xC5BE7120,
- 0xC37632D8,
- 0xDF359F8D,
- 0x9B992F2E,
- 0xE60B6F47,
- 0x0FE3F11D,
- 0xE54CDA54,
- 0x1EDAD891,
- 0xCE6279CF,
- 0xCD3E7E6F,
- 0x1618B166,
- 0xFD2C1D05,
- 0x848FD2C5,
- 0xF6FB2299,
- 0xF523F357,
- 0xA6327623,
- 0x93A83531,
- 0x56CCCD02,
- 0xACF08162,
- 0x5A75EBB5,
- 0x6E163697,
- 0x88D273CC,
- 0xDE966292,
- 0x81B949D0,
- 0x4C50901B,
- 0x71C65614,
- 0xE6C6C7BD,
- 0x327A140A,
- 0x45E1D006,
- 0xC3F27B9A,
- 0xC9AA53FD,
- 0x62A80F00,
- 0xBB25BFE2,
- 0x35BDD2F6,
- 0x71126905,
- 0xB2040222,
- 0xB6CBCF7C,
- 0xCD769C2B,
- 0x53113EC0,
- 0x1640E3D3,
- 0x38ABBD60,
- 0x2547ADF0,
- 0xBA38209C,
- 0xF746CE76,
- 0x77AFA1C5,
- 0x20756060,
- 0x85CBFE4E,
- 0x8AE88DD8,
- 0x7AAAF9B0,
- 0x4CF9AA7E,
- 0x1948C25C,
- 0x02FB8A8C,
- 0x01C36AE4,
- 0xD6EBE1F9,
- 0x90D4F869,
- 0xA65CDEA0,
- 0x3F09252D,
- 0xC208E69F,
- 0xB74E6132,
- 0xCE77E25B,
- 0x578FDFE3,
- 0x3AC372E6
- };
- private static final int ROUNDS = 16;
- private static final int BLOCK_SIZE = 8;
- private static final int SBOX_SK = 256;
- private static final int P_SZ = ROUNDS + 2;
- private final int[] S0, S1, S2, S3;
- private final int[] P;
- private boolean encrypting = false;
- private byte[] workingKey = null;
- public BlowfishEngine()
- {
- S0 = new int[SBOX_SK];
- S1 = new int[SBOX_SK];
- S2 = new int[SBOX_SK];
- S3 = new int[SBOX_SK];
- P = new int[P_SZ];
- }
- public void init(boolean pEncrypting, byte[] key)
- {
- encrypting = pEncrypting;
- workingKey = key;
- setKey(workingKey);
- }
- public String getAlgorithmName()
- {
- return "Blowfish";
- }
- public final int processBlock(byte[] in, int inOff, byte[] out, int outOff) throws IOException
- {
- if (workingKey == null)
- throw new IllegalStateException("Blowfish not initialised");
- if (inOff + BLOCK_SIZE > in.length)
- throw new IOException("input buffer too short");
- if (outOff + BLOCK_SIZE > out.length)
- throw new IOException("output buffer too short");
- if (encrypting)
- encryptBlock(in, inOff, out, outOff);
- else
- decryptBlock(in, inOff, out, outOff);
- return BLOCK_SIZE;
- }
- public void reset()
- {
- }
- public int getBlockSize()
- {
- return BLOCK_SIZE;
- }
- private int F(int x)
- {
- return (S0[x >>> 24] + S1[x >>> 16 & 0xff] ^ S2[x >>> 8 & 0xff]) + S3[x & 0xff];
- }
- private void processTable(int xl, int xr, int[] table)
- {
- int size = table.length;
- for (int s = 0; s < size; s += 2)
- {
- xl ^= P[0];
- for (int i = 1; i < ROUNDS; i += 2)
- {
- xr ^= F(xl) ^ P[i];
- xl ^= F(xr) ^ P[i + 1];
- }
- xr ^= P[ROUNDS + 1];
- table[s] = xr;
- table[s + 1] = xl;
- xr = xl;
- xl = table[s];
- }
- }
- private void setKey(byte[] key)
- {
- System.arraycopy(KS0, 0, S0, 0, SBOX_SK);
- System.arraycopy(KS1, 0, S1, 0, SBOX_SK);
- System.arraycopy(KS2, 0, S2, 0, SBOX_SK);
- System.arraycopy(KS3, 0, S3, 0, SBOX_SK);
- System.arraycopy(KP, 0, P, 0, P_SZ);
- int keyLength = key.length;
- int keyIndex = 0;
- for (int i = 0; i < P_SZ; i++)
- {
- int data = 0x0000000;
- for (int j = 0; j < 4; j++)
- {
- data = data << 8 | key[keyIndex++] & 0xff;
- if (keyIndex >= keyLength)
- keyIndex = 0;
- }
- P[i] ^= data;
- }
- processTable(0, 0, P);
- processTable(P[P_SZ - 2], P[P_SZ - 1], S0);
- processTable(S0[SBOX_SK - 2], S0[SBOX_SK - 1], S1);
- processTable(S1[SBOX_SK - 2], S1[SBOX_SK - 1], S2);
- processTable(S2[SBOX_SK - 2], S2[SBOX_SK - 1], S3);
- }
- public void encryptBlock(byte[] src, int srcIndex, byte[] dst, int dstIndex)
- {
- int xl = BytesTo32bits(src, srcIndex);
- int xr = BytesTo32bits(src, srcIndex + 4);
- xl ^= P[0];
- for (int i = 1; i < ROUNDS; i += 2)
- {
- xr ^= F(xl) ^ P[i];
- xl ^= F(xr) ^ P[i + 1];
- }
- xr ^= P[ROUNDS + 1];
- Bits32ToBytes(xr, dst, dstIndex);
- Bits32ToBytes(xl, dst, dstIndex + 4);
- }
- public void decryptBlock(byte[] src, int srcIndex, byte[] dst, int dstIndex)
- {
- int xl = BytesTo32bits(src, srcIndex);
- int xr = BytesTo32bits(src, srcIndex + 4);
- xl ^= P[ROUNDS + 1];
- for (int i = ROUNDS; i > 0; i -= 2)
- {
- xr ^= F(xl) ^ P[i];
- xl ^= F(xr) ^ P[i - 1];
- }
- xr ^= P[0];
- Bits32ToBytes(xr, dst, dstIndex);
- Bits32ToBytes(xl, dst, dstIndex + 4);
- }
- private static int BytesTo32bits(byte[] b, int i)
- {
- return (b[i + 3] & 0xff) << 24 | (b[i + 2] & 0xff) << 16 | (b[i + 1] & 0xff) << 8 | b[i] & 0xff;
- }
- private static void Bits32ToBytes(int in, byte[] b, int offset)
- {
- b[offset] = (byte) in;
- b[offset + 1] = (byte) (in >> 8);
- b[offset + 2] = (byte) (in >> 16);
- b[offset + 3] = (byte) (in >> 24);
- }
- }
- Index: Head-src/Hwid/crypt/+FirstKey.java
- ===================================================================
- /*
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later
- * version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see <http://www.gnu.org/licenses/>.
- */
- package Hwid.crypt;
- import Hwid.HwidConfig;
- import java.util.logging.Logger;
- public class FirstKey
- {
- protected static Logger _log = Logger.getLogger(FirstKey.class.getName());
- private static final byte[] TKBOX =
- {
- -112,
- 22,
- 124,
- -93,
- 68,
- -116,
- -19,
- -125,
- -4,
- 101,
- -62,
- 5,
- 70,
- 25,
- 29,
- 81,
- 65,
- -86,
- 79,
- -69,
- 2,
- 97,
- -108,
- -11,
- -84,
- -56,
- 17,
- 7,
- 31,
- 52,
- -34,
- -41,
- -110,
- -60,
- 57,
- -5,
- -6,
- -24,
- 98,
- -100,
- 23,
- 4,
- -74,
- -37,
- 1,
- 6,
- -2,
- -14,
- -77,
- 12,
- -7,
- 3,
- -29,
- -17,
- -75,
- 49,
- 44,
- -78,
- 94,
- 21,
- 0,
- 35,
- -18,
- 83,
- 9,
- -42,
- 60,
- 93,
- 54,
- 20,
- -49,
- 114,
- 106,
- -82,
- 113,
- -90,
- 86,
- -124,
- -73,
- -81,
- 90,
- 121,
- 115,
- 125,
- 47,
- 24,
- -28,
- 73,
- 56,
- -31,
- 8,
- 71,
- 122,
- 58,
- -33,
- 108,
- -111,
- 102,
- -118,
- -103,
- -122,
- 88,
- 28,
- -76,
- 67,
- -115,
- -67,
- 78,
- 36,
- 117,
- -8,
- -25,
- -97,
- 107,
- -91,
- -50,
- -53,
- -52,
- 111,
- -114,
- -58,
- -128,
- 84,
- -98,
- 63,
- 74,
- 10,
- 41,
- -32,
- 126,
- 69,
- -68,
- 11,
- -119,
- -44,
- -39,
- -107,
- -40,
- 85,
- -87,
- 61,
- 91,
- -1,
- 50,
- -72,
- -117,
- 15,
- 55,
- -51,
- 43,
- 87,
- 105,
- 120,
- -88,
- 116,
- 80,
- -48,
- -123,
- -127,
- -105,
- -22,
- 76,
- 109,
- 19,
- -46,
- -30,
- 112,
- 16,
- -10,
- 45,
- -63,
- -47,
- 123,
- -106,
- 27,
- 38,
- 104,
- -70,
- -79,
- 18,
- -99,
- -16,
- -85,
- -23,
- 30,
- -66,
- 48,
- -89,
- -61,
- -113,
- -12,
- 51,
- -95,
- -15,
- 32,
- -9,
- 62,
- -38,
- 14,
- -45,
- -80,
- 66,
- 100,
- 103,
- -104,
- -27,
- -43,
- 110,
- -83,
- -26,
- -101,
- 46,
- -120,
- -54,
- 37,
- 42,
- 13,
- 75,
- 82,
- -109,
- 26,
- -94,
- -57,
- -64,
- 119,
- 53,
- 39,
- -13,
- -121,
- 33,
- 72,
- -126,
- -65,
- -36,
- -71,
- 118,
- -35,
- 92,
- 96,
- 89,
- 64,
- 34,
- -20,
- -96,
- 77,
- 40,
- 127,
- -21,
- 59,
- -55,
- -102,
- 95,
- -3,
- 99,
- -59,
- -92
- };
- private static final byte[] MGBOX =
- {
- -14,
- -108,
- 90,
- 75,
- 15,
- 115,
- -38,
- -37,
- -125,
- 29,
- -77,
- 9,
- -4,
- 54,
- -72,
- 70,
- 65,
- -44,
- -48,
- 85,
- -13,
- -121,
- 118,
- -102,
- 40,
- 53,
- 113,
- -5,
- -9,
- 28,
- 3,
- 125,
- 21,
- -124,
- 10,
- 67,
- -6,
- -98,
- 96,
- -105,
- -104,
- 126,
- -93,
- 82,
- -47,
- 41,
- -91,
- 89,
- -59,
- 122,
- 47,
- 37,
- -31,
- 59,
- 56,
- 12,
- -112,
- -58,
- -39,
- -10,
- -40,
- -49,
- 22,
- -107,
- 33,
- -89,
- 109,
- 31,
- 88,
- 81,
- 72,
- 42,
- -66,
- -85,
- -15,
- 93,
- -101,
- -7,
- -128,
- -19,
- -27,
- -90,
- -11,
- 111,
- 49,
- -70,
- 121,
- 79,
- -123,
- -127,
- -79,
- 35,
- -28,
- 114,
- -22,
- 44,
- -54,
- 107,
- 106,
- 30,
- 92,
- 4,
- -43,
- -82,
- -78,
- -26,
- -61,
- 57,
- 77,
- 95,
- 58,
- 69,
- -76,
- 103,
- -56,
- 78,
- 26,
- -92,
- 48,
- -32,
- -52,
- 16,
- -67,
- 51,
- -50,
- -73,
- -29,
- 52,
- -60,
- -118,
- -1,
- -80,
- 63,
- 2,
- 124,
- -36,
- -65,
- 8,
- -33,
- -115,
- -3,
- 108,
- -21,
- 18,
- 110,
- 36,
- -51,
- 46,
- -103,
- 94,
- 20,
- -114,
- 80,
- 127,
- -86,
- 19,
- -119,
- -113,
- 68,
- -25,
- -120,
- -71,
- 32,
- 38,
- -95,
- -57,
- 5,
- 7,
- 105,
- -17,
- -34,
- -81,
- 24,
- -74,
- -35,
- 100,
- 1,
- -46,
- -94,
- 43,
- 13,
- 17,
- -87,
- 11,
- -69,
- -62,
- -126,
- -63,
- -64,
- -23,
- -97,
- 27,
- -18,
- -53,
- 84,
- 0,
- -106,
- -83,
- 39,
- 116,
- 91,
- 104,
- 14,
- -24,
- -42,
- 34,
- -88,
- -84,
- 62,
- 61,
- -2,
- 112,
- 23,
- 119,
- 73,
- 6,
- -122,
- 55,
- -99,
- -41,
- 83,
- 99,
- 60,
- 87,
- 45,
- 120,
- -55,
- 117,
- -117,
- 98,
- 123,
- -8,
- 76,
- -16,
- -30,
- 64,
- -96,
- -109,
- -75,
- 25,
- 101,
- -110,
- 86,
- 50,
- 71,
- -12,
- 74,
- -100,
- -116,
- -68,
- 66,
- -20,
- -45,
- 102,
- -111,
- 97
- };
- public static final byte[] SKBOX =
- {
- HwidConfig.FST_KEY,
- HwidConfig.SCN_KEY,
- 2,
- 15,
- -5,
- 17,
- 24,
- 23,
- 18,
- 45,
- 1,
- 21,
- 122,
- 16,
- HwidConfig.ANP_KEY,
- HwidConfig.ULT_KEY
- };
- public static byte[] expandKey(byte[] key, int size)
- {
- byte[] P = new byte[64];
- for (int i = 0; i < 64; i++)
- P[i] = key[i % size];
- for (int i = 0; i < 256; i++)
- {
- byte t = P[i % 64];
- byte m = (byte) (MGBOX[MGBOX[t & 0xFF] & 0xFF] & 0xFF ^ TKBOX[TKBOX[i] & 0xFF] & 0xFF);
- P[i % 64] = TKBOX[m & 0xFF];
- }
- return P;
- }
- }
- Index: Head-src/Hwid/crypt/+GameCrypt.java
- ===================================================================
- /*
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later
- * version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see <http://www.gnu.org/licenses/>.
- */
- package Hwid.crypt;
- import Hwid.HwidConfig;
- import Hwid.crypt.impl.L2Client;
- import Hwid.crypt.impl.L2Server;
- import Hwid.crypt.impl.VMPC;
- public class GameCrypt
- {
- private ProtectionCrypt _client;
- private ProtectionCrypt _server;
- private boolean _isEnabled = false;
- private boolean _isProtected = false;
- public void setProtected(boolean state)
- {
- _isProtected = state;
- }
- public void setKey(byte[] key)
- {
- if (_isProtected)
- {
- _client = new VMPC();
- _client.setup(key, HwidConfig.GUARD_CLIENT_CRYPT);
- _server = new L2Server();
- _server.setup(key, null);
- _server = new VMPC();
- _server.setup(key, HwidConfig.GUARD_SERVER_CRYPT);
- }
- else
- {
- _client = new L2Client();
- _client.setup(key, null);
- _server = new L2Server();
- _server.setup(key, null);
- }
- }
- public void decrypt(byte[] raw, int offset, int size)
- {
- if (_isEnabled)
- _client.crypt(raw, offset, size);
- }
- public void encrypt(byte[] raw, int offset, int size)
- {
- if (_isEnabled)
- _server.crypt(raw, offset, size);
- else
- _isEnabled = true;
- }
- }
- Index: head-src/Hwid/crypt/+Manager.java
- ===================================================================
- /*
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later
- * version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see <http://www.gnu.org/licenses/>.
- */
- package Hwid.crypt;
- import Hwid.hwidmanager.HWIDManager;
- import java.util.Iterator;
- import java.util.concurrent.ConcurrentHashMap;
- import java.util.concurrent.ScheduledFuture;
- import java.util.logging.Logger;
- import com.l2jfrozen.Config;
- import com.l2jfrozen.gameserver.network.L2GameClient;
- public final class Manager
- {
- protected static Logger _log = Logger.getLogger(Manager.class.getName());
- protected static String _logFile = "Manager";
- protected static String _logMainFile = "hwid_logs";
- protected static Manager _instance;
- protected static ScheduledFuture<?> _GGTask = null;
- protected static ConcurrentHashMap<String, Manager.InfoSet> _objects = new ConcurrentHashMap<>();
- public Manager()
- {
- //
- }
- public static Manager getInstance()
- {
- if (_instance == null)
- {
- System.out.println("- HWID Manager read successfully...");
- _instance = new Manager();
- }
- return _instance;
- }
- public class InfoSet
- {
- public String _playerName = "";
- public long _lastGGSendTime;
- public long _lastGGRecvTime;
- public int _attempts;
- public String _HWID = "";
- public InfoSet(String name, String HWID)
- {
- _playerName = name;
- _lastGGSendTime = System.currentTimeMillis();
- _lastGGRecvTime = _lastGGSendTime;
- _attempts = 0;
- _HWID = HWID;
- }
- }
- public void addPlayer(L2GameClient client)
- {
- int i = 1;
- HWIDManager.updateHWIDInfo(client, i);
- _objects.put(client.getPlayerName(), new Manager.InfoSet(client.getPlayerName(), client.getHWID()));
- }
- public static void removePlayer(String name)
- {
- if (!_objects.containsKey(name))
- {
- if (Config.DEBUG)
- _log.warning("trying to remove player that non exists");
- }
- else
- _objects.remove(name);
- }
- public static int getCountByHWID(String HWID)
- {
- int result = 0;
- Iterator<InfoSet> var3 = _objects.values().iterator();
- while (var3.hasNext())
- {
- Manager.InfoSet object = var3.next();
- if (object._HWID.equals(HWID))
- result++;
- }
- return result;
- }
- }
- Index: head-src/Hwid/crypt/+ProtectionCrypt.java
- ===================================================================
- /*
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later
- * version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see <http://www.gnu.org/licenses/>.
- */
- package Hwid.crypt;
- public abstract interface ProtectionCrypt
- {
- public abstract void setup(byte[] rnd_key, byte[] client_server_key);
- public abstract void crypt(byte[] raw, int offset, int size);
- }
- Index: head-src/Hwid/crypt/+ProtectionPackets.java
- ===================================================================
- /*
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later
- * version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see <http://www.gnu.org/licenses/>.
- */
- package Hwid.crypt;
- import Hwid.utils.Rnd;
- public class ProtectionPackets
- {
- public static int readB(byte[] raw, int offset, byte[] data, int size)
- {
- for (int i = 0; i < size; i++)
- {
- data[i] = (byte) (raw[offset] ^ raw[0]);
- offset += raw[offset + 1] & 0xFF;
- }
- return offset;
- }
- public static int readS(byte[] raw, int offset, byte[] data, int size)
- {
- for (int i = 0; i < size; i++)
- {
- data[i] = (byte) (raw[offset] ^ raw[0]);
- offset += raw[offset + 1] & 0xFF;
- if (data[i] == 0)
- break;
- }
- return offset;
- }
- public static int writeB(byte[] raw, int offset, byte[] data, int size)
- {
- for (int i = 0; i < size; i++)
- {
- raw[offset] = (byte) (data[i] ^ raw[0]);
- raw[offset + 1] = (byte) (2 + Rnd.nextInt(10));
- offset += raw[offset + 1] & 0xFF;
- }
- return offset;
- }
- public static byte ck(byte[] raw, int offset, int size)
- {
- byte c = -1;
- for (int i = 0; i < size; i++)
- c = (byte) (c ^ raw[offset + i]);
- return c;
- }
- }
- Index: head-src/Hwid/crypt/+impl/+L2Client.java
- ===================================================================
- /*
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later
- * version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see <http://www.gnu.org/licenses/>.
- */
- package Hwid.crypt.impl;
- import Hwid.crypt.ProtectionCrypt;
- public class L2Client implements ProtectionCrypt
- {
- private ProtectionCrypt _client;
- private final byte[] _key = new byte[16];
- private byte[] _iv = null;
- @Override
- public void setup(byte[] key, byte[] iv)
- {
- System.arraycopy(key, 0, _key, 0, 16);
- _iv = iv;
- }
- @Override
- public void crypt(byte[] raw, int offset, int size)
- {
- if (_iv != null)
- {
- _client = new VMPC();
- _client.setup(_key, _iv);
- _client.crypt(raw, offset, size);
- }
- int temp = 0;
- int temp2 = 0;
- for (int i = 0; i < size; i++)
- {
- temp2 = raw[offset + i] & 0xFF;
- raw[offset + i] = (byte) (temp2 ^ _key[i & 0xF] ^ temp);
- temp = temp2;
- }
- int old = _key[8] & 0xFF;
- old |= _key[9] << 8 & 0xFF00;
- old |= _key[10] << 16 & 0xFF0000;
- old |= _key[11] << 24 & 0xFF000000;
- old += size;
- _key[8] = (byte) (old & 0xFF);
- _key[9] = (byte) (old >> 8 & 0xFF);
- _key[10] = (byte) (old >> 16 & 0xFF);
- _key[11] = (byte) (old >> 24 & 0xFF);
- }
- }
- Index: head-src/Hwid/crypt/impl/+L2Server.java
- ===================================================================
- /*
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later
- * version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see <http://www.gnu.org/licenses/>.
- */
- package Hwid.crypt.impl;
- import Hwid.crypt.ProtectionCrypt;
- public class L2Server implements ProtectionCrypt
- {
- private final byte[] _key = new byte[16];
- private byte[] _iv = null;
- private ProtectionCrypt _server;
- @Override
- public void setup(byte[] key, byte[] iv)
- {
- System.arraycopy(key, 0, _key, 0, 16);
- _iv = iv;
- }
- @Override
- public void crypt(byte[] raw, int offset, int size)
- {
- int temp = 0;
- for (int i = 0; i < size; i++)
- {
- int temp2 = raw[offset + i] & 0xFF;
- temp = temp2 ^ _key[i & 0xF] ^ temp;
- raw[offset + i] = (byte) temp;
- }
- int old = _key[8] & 0xFF;
- old |= _key[9] << 8 & 0xFF00;
- old |= _key[10] << 16 & 0xFF0000;
- old |= _key[11] << 24 & 0xFF000000;
- old += size;
- _key[8] = (byte) (old & 0xFF);
- _key[9] = (byte) (old >> 8 & 0xFF);
- _key[10] = (byte) (old >> 16 & 0xFF);
- _key[11] = (byte) (old >> 24 & 0xFF);
- if (_iv != null)
- {
- _server = new VMPC();
- _server.setup(_key, _iv);
- _server.crypt(raw, offset, size);
- }
- }
- }
- Index: head-src/Hwid/crypt/impl/+VMPC.java
- ===================================================================
- /*
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later
- * version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see <http://www.gnu.org/licenses/>.
- */
- package Hwid.crypt.impl;
- import Hwid.crypt.ProtectionCrypt;
- public class VMPC implements ProtectionCrypt
- {
- private byte _n = 0;
- private final byte[] _P = new byte[256];
- private byte _s = 0;
- @Override
- public void setup(byte[] key, byte[] iv)
- {
- _s = 0;
- for (int i = 0; i < 256; i++)
- _P[i] = (byte) (i & 0xFF);
- for (int m = 0; m < 768; m++)
- {
- _s = _P[_s + _P[m & 0xFF] + key[m % 64] & 0xFF];
- byte temp = _P[m & 0xFF];
- _P[m & 0xFF] = _P[_s & 0xFF];
- _P[_s & 0xFF] = temp;
- }
- for (int m = 0; m < 768; m++)
- {
- _s = _P[_s + _P[m & 0xFF] + iv[m % 64] & 0xFF];
- byte temp = _P[m & 0xFF];
- _P[m & 0xFF] = _P[_s & 0xFF];
- _P[_s & 0xFF] = temp;
- }
- for (int m = 0; m < 768; m++)
- {
- _s = _P[_s + _P[m & 0xFF] + key[m % 64] & 0xFF];
- byte temp = _P[m & 0xFF];
- _P[m & 0xFF] = _P[_s & 0xFF];
- _P[_s & 0xFF] = temp;
- }
- _n = 0;
- }
- @Override
- public void crypt(byte[] raw, int offset, int size)
- {
- for (int i = 0; i < size; i++)
- {
- _s = _P[_s + _P[_n & 0xFF] & 0xFF];
- byte z = _P[_P[_P[_s & 0xFF] & 0xFF] + 1 & 0xFF];
- byte temp = _P[_n & 0xFF];
- _P[_n & 0xFF] = _P[_s & 0xFF];
- _P[_s & 0xFF] = temp;
- _n = (byte) (_n + 1 & 0xFF);
- raw[offset + i] = (byte) (raw[offset + i] ^ z);
- }
- }
- }
- Index: head-src/Hwid/hwidmanager/+HWIDAdminBan.java
- ===================================================================
- /*
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later
- * version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see <http://www.gnu.org/licenses/>.
- */
- package Hwid.hwidmanager;
- import Hwid.HwidConfig;
- import com.l2jfrozen.gameserver.handler.IAdminCommandHandler;
- import com.l2jfrozen.gameserver.model.L2Object;
- import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
- public class HWIDAdminBan implements IAdminCommandHandler
- {
- private static final String[] ADMIN_COMMANDS =
- {
- "admin_ban_hwid"
- };
- @Override
- public boolean useAdminCommand(String command, L2PcInstance activeChar)
- {
- if (!HwidConfig.ALLOW_GUARD_SYSTEM)
- return false;
- if (activeChar == null)
- return false;
- if (command.startsWith("admin_ban_hwid"))
- {
- L2Object playerTarger = activeChar.getTarget();
- if (playerTarger != null && !playerTarger.equals(activeChar))
- {
- activeChar.sendMessage("Target is empty");
- return false;
- }
- if (playerTarger == null && activeChar.equals(""))
- {
- activeChar.sendMessage("Usage: //ban_hwid <account_name> (if none, target char's account gets banned).");
- return false;
- }
- L2PcInstance target = (L2PcInstance) playerTarger;
- if (target != null)
- {
- HWIDBan.addHWIDBan(target.getClient());
- activeChar.sendMessage(target.getName() + " banned in HWID");
- }
- }
- return true;
- }
- @Override
- public String[] getAdminCommandList()
- {
- return ADMIN_COMMANDS;
- }
- }
- Index: head-src/Hwid/hwidmanager/+HWIDBan.java
- ===================================================================
- /*
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later
- * version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see <http://www.gnu.org/licenses/>.
- */
- package Hwid.hwidmanager;
- import java.sql.Connection;
- import java.sql.PreparedStatement;
- import java.sql.ResultSet;
- import java.util.HashMap;
- import java.util.Map;
- import java.util.logging.Logger;
- import com.l2jfrozen.util.database.L2DatabaseFactory;
- import com.l2jfrozen.gameserver.network.L2GameClient;
- public class HWIDBan
- {
- protected static Logger _log = Logger.getLogger(HWIDBan.class.getName());
- private static HWIDBan _instance;
- private static Map<Integer, HWIDBanList> _lists;
- public HWIDBan()
- {
- _lists = new HashMap<>();
- load();
- System.out.println("- HWID Ban: Loaded " + _lists.size() + " HWIDs");
- }
- public static HWIDBan getInstance()
- {
- if (_instance == null)
- _instance = new HWIDBan();
- return _instance;
- }
- private static void load()
- {
- String HWID = "";
- int counterHWIDBan = 0;
- try
- {
- Connection con = L2DatabaseFactory.getInstance().getConnection();
- Throwable localThrowable2 = null;
- try
- {
- PreparedStatement statement = con.prepareStatement("SELECT * FROM hwid_bans");
- ResultSet rset = statement.executeQuery();
- while (rset.next())
- {
- HWID = rset.getString("HWID");
- HWIDBanList hb = new HWIDBanList(counterHWIDBan);
- hb.setHWIDBan(HWID);
- _lists.put(Integer.valueOf(counterHWIDBan), hb);
- counterHWIDBan++;
- }
- }
- catch (Throwable localThrowable1)
- {
- localThrowable2 = localThrowable1;
- throw localThrowable1;
- }
- finally
- {
- if (con != null)
- if (localThrowable2 != null)
- try
- {
- con.close();
- }
- catch (Throwable x2)
- {
- localThrowable2.addSuppressed(x2);
- }
- else
- con.close();
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
- public static void reload()
- {
- _instance = new HWIDBan();
- }
- public boolean checkFullHWIDBanned(L2GameClient client)
- {
- if (_lists.size() == 0)
- return false;
- for (int i = 0; i < _lists.size(); i++)
- if (_lists.get(Integer.valueOf(i)).getHWID().equals(client.getHWID()))
- return true;
- return false;
- }
- public static int getCountHWIDBan()
- {
- return _lists.size();
- }
- public static void addHWIDBan(L2GameClient client)
- {
- String HWID = client.getHWID();
- int counterHwidBan = _lists.size();
- HWIDBanList hb = new HWIDBanList(counterHwidBan);
- hb.setHWIDBan(HWID);
- _lists.put(Integer.valueOf(counterHwidBan), hb);
- try
- {
- Connection con = L2DatabaseFactory.getInstance().getConnection();
- Throwable localThrowable2 = null;
- try
- {
- PreparedStatement statement = con.prepareStatement("INSERT INTO hwid_bans SET HWID=?");
- statement.setString(1, HWID);
- statement.execute();
- }
- catch (Throwable localThrowable1)
- {
- localThrowable2 = localThrowable1;
- throw localThrowable1;
- }
- finally
- {
- if (con != null)
- if (localThrowable2 != null)
- try
- {
- con.close();
- }
- catch (Throwable x2)
- {
- localThrowable2.addSuppressed(x2);
- }
- else
- con.close();
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
- }
- Index: head-src/Hwid/hwidmanager/+HWIDBanList.java
- ===================================================================
- /*
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later
- * version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see <http://www.gnu.org/licenses/>.
- */
- package Hwid.hwidmanager;
- public class HWIDBanList
- {
- private final int _id;
- private String HWID;
- public HWIDBanList(int id)
- {
- _id = id;
- }
- public int getId()
- {
- return _id;
- }
- public String getHWID()
- {
- return HWID;
- }
- public void setHWIDBan(String hwid1)
- {
- HWID = hwid1;
- }
- }
- Index: head-src/Hwid/hwidmanager/+HWIDInfoList.java
- ===================================================================
- /*
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later
- * version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see <http://www.gnu.org/licenses/>.
- */
- package Hwid.hwidmanager;
- public class HWIDInfoList
- {
- private final int _id;
- private String HWID;
- private int count;
- private int playerID;
- private String login;
- private LockType lockType;
- public static enum LockType
- {
- PLAYER_LOCK,
- ACCOUNT_LOCK,
- NONE
- }
- public HWIDInfoList(int id)
- {
- _id = id;
- }
- public int get_id()
- {
- return _id;
- }
- public void setHwids(String hwid)
- {
- HWID = hwid;
- count = 1;
- }
- public String getHWID()
- {
- return HWID;
- }
- public void setHWID(String HWID)
- {
- this.HWID = HWID;
- }
- public int getPlayerID()
- {
- return playerID;
- }
- public void setPlayerID(int playerID)
- {
- this.playerID = playerID;
- }
- public String getLogin()
- {
- return login;
- }
- public void setLogin(String login)
- {
- this.login = login;
- }
- public LockType getLockType()
- {
- return lockType;
- }
- public void setLockType(LockType lockType)
- {
- this.lockType = lockType;
- }
- public int getCount()
- {
- return count;
- }
- public void setCount(int count)
- {
- this.count = count;
- }
- }
- Index: head-src/Hwid/hwidmanager/+HWIDManager.java
- ===================================================================
- /*
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later
- * version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see <http://www.gnu.org/licenses/>.
- */
- package Hwid.hwidmanager;
- import java.sql.Connection;
- import java.sql.PreparedStatement;
- import java.sql.ResultSet;
- import java.util.HashMap;
- import java.util.Map;
- import java.util.logging.Logger;
- import com.l2jfrozen.util.database.L2DatabaseFactory;
- import com.l2jfrozen.gameserver.network.L2GameClient;
- public class HWIDManager
- {
- protected static Logger _log = Logger.getLogger(HWIDManager.class.getName());
- private static HWIDManager _instance;
- public static Map<Integer, HWIDInfoList> _listHWID;
- public static Map<Integer, Integer> _sessions;
- public HWIDManager()
- {
- _listHWID = new HashMap<>();
- load();
- System.out.println("- HWID Info: Loaded " + _listHWID.size() + " HWIDs");
- }
- public static HWIDManager getInstance()
- {
- if (_instance == null)
- _instance = new HWIDManager();
- return _instance;
- }
- private static void load()
- {
- try
- {
- Connection con = L2DatabaseFactory.getInstance().getConnection();
- Throwable localThrowable2 = null;
- try
- {
- PreparedStatement statement = con.prepareStatement("SELECT * FROM hwid_info");
- ResultSet rset = statement.executeQuery();
- int counterHWIDInfo = 0;
- while (rset.next())
- {
- HWIDInfoList hInfo = new HWIDInfoList(counterHWIDInfo);
- hInfo.setHwids(rset.getString("HWID"));
- hInfo.setCount(rset.getInt("WindowsCount"));
- hInfo.setLogin(rset.getString("Account"));
- hInfo.setPlayerID(rset.getInt("PlayerID"));
- hInfo.setLockType(HWIDInfoList.LockType.valueOf(rset.getString("LockType")));
- _listHWID.put(Integer.valueOf(counterHWIDInfo), hInfo);
- counterHWIDInfo++;
- }
- }
- catch (Throwable localThrowable1)
- {
- localThrowable2 = localThrowable1;
- throw localThrowable1;
- }
- finally
- {
- if (con != null)
- if (localThrowable2 != null)
- try
- {
- con.close();
- }
- catch (Throwable x2)
- {
- localThrowable2.addSuppressed(x2);
- }
- else
- con.close();
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
- public static int getAllowedWindowsCount(final L2GameClient pi)
- {
- if (_listHWID.size() == 0)
- return -1;
- for (int i = 0; i < _listHWID.size(); i++)
- if (_listHWID.get(i).getHWID().equals(pi.getHWID()))
- {
- if (_listHWID.get(i).getHWID().equals(""))
- return -1;
- return _listHWID.get(i).getCount();
- }
- return -1;
- }
- public static void reload()
- {
- _instance = new HWIDManager();
- }
- public static void updateHWIDInfo(L2GameClient client, int windowscount)
- {
- updateHWIDInfo(client, windowscount, HWIDInfoList.LockType.NONE);
- }
- public static void updateHwidInfo(final L2GameClient client, final HWIDInfoList.LockType lockType)
- {
- updateHWIDInfo(client, 1, lockType);
- }
- public static void updateHWIDInfo(L2GameClient client, int windowsCount, HWIDInfoList.LockType lockType)
- {
- int counterHwidInfo = _listHWID.size();
- boolean isFound = false;
- for (int i = 0; i < _listHWID.size(); i++)
- if (_listHWID.get(i).getHWID().equals(client.getHWID()))
- {
- isFound = true;
- counterHwidInfo = i;
- break;
- }
- final HWIDInfoList hInfo = new HWIDInfoList(counterHwidInfo);
- hInfo.setHwids(client.getHWID());
- hInfo.setCount(windowsCount);
- hInfo.setLogin(client.getAccountName());
- hInfo.setPlayerID(client.getPlayerId());
- hInfo.setLockType(lockType);
- _listHWID.put(Integer.valueOf(counterHwidInfo), hInfo);
- if (isFound)
- try
- {
- Connection con = L2DatabaseFactory.getInstance().getConnection();
- Throwable localThrowable3 = null;
- try
- {
- PreparedStatement statement = con.prepareStatement("UPDATE hwid_info SET WindowsCount=?,Account=?,PlayerID=?,LockType=? WHERE HWID=?");
- statement.setInt(1, windowsCount);
- statement.setString(2, client.getPlayerName());
- statement.setInt(3, client.getPlayerId());
- statement.setString(4, lockType.toString());
- statement.setString(5, client.getHWID());
- statement.execute();
- }
- catch (Throwable localThrowable1)
- {
- localThrowable3 = localThrowable1;
- throw localThrowable1;
- }
- finally
- {
- if (con != null)
- if (localThrowable3 != null)
- try
- {
- con.close();
- }
- catch (Throwable x2)
- {
- localThrowable3.addSuppressed(x2);
- }
- else
- con.close();
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- else
- try
- {
- Connection con = L2DatabaseFactory.getInstance().getConnection();
- Throwable localThrowable3 = null;
- try
- {
- PreparedStatement statement = con.prepareStatement("INSERT INTO hwid_info (HWID, WindowsCount, Account, PlayerID, LockType) values (?,?,?,?,?)");
- statement.setString(1, client.getHWID());
- statement.setInt(2, windowsCount);
- statement.setString(3, client.getPlayerName());// .getAccountName());
- statement.setInt(4, client.getPlayerId());
- statement.setString(5, lockType.toString());
- statement.execute();
- }
- catch (Throwable localThrowable2)
- {
- localThrowable3 = localThrowable2;
- throw localThrowable2;
- }
- finally
- {
- if (con != null)
- if (localThrowable3 != null)
- try
- {
- con.close();
- }
- catch (Throwable x2)
- {
- localThrowable3.addSuppressed(x2);
- }
- else
- con.close();
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
- public static void updateHWIDInfo(L2GameClient client, HWIDInfoList.LockType lockType)
- {
- updateHWIDInfo(client, 1, lockType);
- }
- public static int getCountHwidInfo()
- {
- return _listHWID.size();
- }
- }
- Index: head-src/Hwid/utils/+Rnd.java
- ===================================================================
- /*
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later
- * version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see <http://www.gnu.org/licenses/>.
- */
- package Hwid.utils;
- import java.util.Random;
- public class Rnd
- {
- private static final Random random = new Random();
- public static int nextInt(int n)
- {
- if (n < 0)
- return random.nextInt(-n) * -1;
- if (n == 0)
- return 0;
- return random.nextInt(n);
- }
- public static byte[] nextBytes(byte[] array)
- {
- random.nextBytes(array);
- return array;
- }
- }
- Index: head-src/Hwid.utils;Util.java
- ===================================================================
- /*
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later
- * version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see <http://www.gnu.org/licenses/>.
- */
- package Hwid.utils;
- public class Util
- {
- public Util()
- {
- }
- public static void intToBytes(int value, byte[] array, int offset)
- {
- array[offset++] = (byte) (value & 255);
- array[offset++] = (byte) (value >> 8 & 255);
- array[offset++] = (byte) (value >> 16 & 255);
- array[offset++] = (byte) (value >> 24 & 255);
- }
- public static String LastErrorConvertion(Integer LastError)
- {
- return LastError.toString();
- }
- public static final String asHex(byte[] raw)
- {
- return asHex(raw, 0, raw.length);
- }
- public static final String asHex(byte[] raw, int offset, int size)
- {
- StringBuffer strbuf = new StringBuffer(raw.length * 2);
- for (int i = 0; i < size; ++i)
- {
- if ((raw[offset + i] & 255) < 16)
- strbuf.append("0");
- strbuf.append(Long.toString(raw[offset + i] & 255, 16));
- }
- return strbuf.toString();
- }
- public static int bytesToInt(byte[] array, int offset)
- {
- return array[offset++] & 255 | (array[offset++] & 255) << 8 | (array[offset++] & 255) << 16 | (array[offset++] & 255) << 24;
- }
- public static String asHwidString(String hex)
- {
- byte[] buf = asByteArray(hex);
- return asHex(buf);
- }
- public static byte[] asByteArray(String hex)
- {
- byte[] buf = new byte[hex.length() / 2];
- for (int i = 0; i < hex.length(); i += 2)
- {
- int j = Integer.parseInt(hex.substring(i, i + 2), 16);
- buf[i / 2] = (byte) (j & 255);
- }
- return buf;
- }
- public static boolean verifyChecksum(byte[] raw, int offset, int size)
- {
- if ((size & 3) == 0 && size > 4)
- {
- long chksum = 0L;
- int count = size - 4;
- for (int i1 = offset; i1 < count; i1 += 4)
- chksum ^= bytesToInt(raw, i1);
- long check = bytesToInt(raw, count);
- return check == chksum;
- }
- return false;
- }
- /*
- * public static byte[] asByteArray(String hex) { byte[] buf = new byte[hex.length() / 2]; for (int i = 0; i < hex.length(); i += 2) { int j = Integer.parseInt(hex.substring(i, i + 2), 16); buf[(i / 2)] = (byte)(j & 0xFF); } return buf; } public static String asHwidString(String hex) { byte[]
- * buf = asByteArray(hex); return asHex(buf); } public static final String asHex(byte[] raw, int offset, int size) { StringBuffer strbuf = new StringBuffer(raw.length * 2); for (int i = 0; i < size; i++) { if ((raw[(offset + i)] & 0xFF) < 16) { strbuf.append("0"); }
- * strbuf.append(Long.toString(raw[(offset + i)] & 0xFF, 16)); } return strbuf.toString(); } public static final String asHex(byte[] raw) { return asHex(raw, 0, raw.length); }
- */
- }
- Index: com.l2jfrozen.gameserver.GameServer.java
- ===================================================================
- + import Hwid.Hwid;
- @@
- + Util.printSection("Hwid Manager");
- + Hwid.Init();
- Util.printSection("Custom Mods");
- if (Config.L2JMOD_ALLOW_WEDDING || Config.ALLOW_AWAY_STATUS || Config.PCB_ENABLE || Config.POWERPAK_ENABLED )
- {
- if (Config.L2JMOD_ALLOW_WEDDING)
- CoupleManager.getInstance();
- if (Config.ALLOW_AWAY_STATUS)
- AwayManager.getInstance();
- Index: com.l2jfrozen.gameserver.handler.AdminCommandHandler.java
- ===================================================================
- import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminGeodata;
- import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminGetOlympiadStat;
- import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminGm;
- import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminGmChat;
- import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminHeal;
- import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminHelpPage;
- + import Hwid.hwidmanager.HWIDAdminBan;
- @@
- registerAdminCommandHandler(new AdminAugment());
- registerAdminCommandHandler(new AdminAio());
- registerAdminCommandHandler(new AdminCharSupervision());
- registerAdminCommandHandler(new AdminInventory());
- registerAdminCommandHandler(new AdminGetOlympiadStat());
- registerAdminCommandHandler(new AdminSendDonate());
- registerAdminCommandHandler(new AdminEditOlympiadStat());
- registerAdminCommandHandler(new AdminCustom());
- + registerAdminCommandHandler(new HWIDAdminBan());
- Index: com.l2jfrozen.gameserver.network.L2GameClient.java
- ===================================================================
- --- package net.sf.l2j.gameserver.network;GameClient.java (revision 84)
- +++ package net.sf.l2j.gameserver.network;GameClient.java (working copy)
- import com.l2jfrozen.util.CloseUtil;
- import com.l2jfrozen.util.OlympiadLogger;
- import com.l2jfrozen.util.database.DatabaseUtils;
- import com.l2jfrozen.util.database.L2DatabaseFactory;
- import Dev.Tournament.properties.ArenaTask;
- + import Hwid.Hwid;
- @@
- public byte[] enableCrypt()
- {
- byte[] key = BlowFishKeygen.getRandomKey();
- _crypt.setKey(key);
- + if (Hwid.isProtectionOn())
- + key = Hwid.getKey(key);
- return key;
- }
- @@
- private boolean cancelCleanup()
- {
- final Future<?> task = _cleanupTask;
- if (task != null)
- {
- _cleanupTask = null;
- return task.cancel(true);
- }
- return false;
- }
- + // Hwid Protection
- + private String _playerName = "";
- + private String _loginName = "";
- + private int _playerId = 0;
- + private String _hwid = "";
- + private int revision = 0;
- +
- + public final String getPlayerName()
- + {
- + return _playerName;
- + }
- +
- + public void setPlayerName(String name)
- + {
- + _playerName = name;
- + }
- +
- + public void setPlayerId(int plId)
- + {
- + _playerId = plId;
- + }
- +
- + public int getPlayerId()
- + {
- + return _playerId;
- + }
- +
- + public final String getHWID()
- + {
- + return _hwid;
- + }
- +
- + public void setHWID(String hwid)
- + {
- + _hwid = hwid;
- + }
- +
- + public void setRevision(int revision)
- + {
- + this.revision = revision;
- + }
- +
- + public int getRevision()
- + {
- + return this.revision;
- + }
- +
- + public final String getLoginName()
- + {
- + return _loginName;
- + }
- +
- + public void setLoginName(String name)
- + {
- + _loginName = name;
- + }
- +
- + public synchronized boolean BanedHwid(String hwidban)
- + {
- + boolean result = true;
- + try (Connection con = L2DatabaseFactory.getInstance().getConnection())
- + {
- + PreparedStatement statement = con.prepareStatement("SELECT hwid FROM banned_hwid WHERE hwid=?");
- + statement.setString(1, hwidban);
- + ResultSet rset = statement.executeQuery();
- + result = rset.next();
- + rset.close();
- + statement.close();
- + }
- + catch (Exception e)
- + {
- + LOGGER.warn("HWIDReload: " + e.getMessage(), e);
- + //LOGGER.log(Level.WARN, "HWIDReload: " + e.getMessage(), e);
- + }
- + return result;
- + }
- +
- Index: com.l2jfrozen.gameserver.network.clientpackets.AuthLogin.java
- ===================================================================
- import com.l2jfrozen.gameserver.network.L2GameClient;
- + import Hwid.Hwid;
- private int _loginKey1;
- private int _loginKey2;
- + private final byte[] _data = new byte[48];
- @Override
- protected void runImpl()
- {
- final SessionKey key = new SessionKey(_loginKey1, _loginKey2, _playKey1, _playKey2);
- + if (Hwid.isProtectionOn())
- + {
- + if (!Hwid.doAuthLogin(getClient(), _data, _loginName))
- + return;
- + }
- com.l2jfrozen.gameserver.network.clientpackets.EnterWorld.java
- ===================================================================
- import com.l2jfrozen.gameserver.communitybbs.Manager.RegionBBSManager;
- import com.l2jfrozen.gameserver.controllers.GameTimeController;
- import com.l2jfrozen.gameserver.datatables.CharSchemesTable;
- import com.l2jfrozen.gameserver.datatables.GmListTable;
- + import Hwid.Hwid;
- @Override
- protected void runImpl()
- {
- final L2PcInstance activeChar = getClient().getActiveChar();
- + // Means that it's not ok multiBox situation, so logout
- + Hwid.enterlog(activeChar, getClient());
- com.l2jfrozen.gameserver.network.clientpackets.GameGuardReply.java
- ===================================================================
- import com.l2jfrozen.Config;
- import com.l2jfrozen.crypt.nProtect;
- +import com.l2jfrozen.gameserver.network.serverpackets.KeyPacket;
- +import Hwid.Hwid;
- +import Hwid.HwidConfig;
- + private int _version;
- + private byte _data[];
- + private String _hwidHdd = "NoHWID-HD";
- + private String _hwidMac = "NoHWID-MAC";
- + private String _hwidCPU = "NoHWID-CPU";
- @Override
- protected void readImpl()
- {
- + _version = readD();
- + if (Hwid.isProtectionOn())
- + {
- + if (_buf.remaining() > 260)
- + {
- + _data = new byte[260];
- + readB(_data);
- + if (Hwid.isProtectionOn())
- + {
- + _hwidHdd = readS();
- + _hwidMac = readS();
- + _hwidCPU = readS();
- + }
- + }
- + }
- + else if (Hwid.isProtectionOn())
- + {
- + getClient().close(new KeyPacket(getClient().enableCrypt()));
- + }
- }
- @Override
- protected void runImpl()
- {
- + if (_version == -2)
- + {
- + getClient().close((L2GameServerPacket) null);
- + }
- + else if (_version < Config.MIN_PROTOCOL_REVISION || _version > Config.MAX_PROTOCOL_REVISION)
- + {
- + LOGGER.info("Client: " + getClient().toString() + " -> Protocol Revision: " + _version + " is invalid. Minimum and maximum allowed are: " + Config.MIN_PROTOCOL_REVISION + " and " + Config.MAX_PROTOCOL_REVISION + ". Closing connection.");
- + getClient().close((L2GameServerPacket) null);
- + }
- + else
- + {
- + getClient().sendPacket(new KeyPacket(getClient().enableCrypt()));
- + }
- + if (Hwid.isProtectionOn())
- + {
- + if (_hwidHdd.equals("NoGuard") && _hwidMac.equals("NoGuard") && _hwidCPU.equals("NoGuard"))
- + {
- + LOGGER.info("HWID Status: No Client side dlls");
- + getClient().close(new KeyPacket(getClient().enableCrypt()));
- + }
- +
- + switch (HwidConfig.GET_CLIENT_HWID)
- + {
- + case 1:
- + getClient().setHWID(_hwidHdd);
- + break;
- + case 2:
- + getClient().setHWID(_hwidMac);
- + break;
- + case 3:
- + getClient().setHWID(_hwidCPU);
- + break;
- + }
- + }
- // TODO: clean nProtect System
- if (!nProtect.getInstance().checkGameGuardRepy(getClient(), _reply))
- return;
- com.l2jfrozen.gameserver.network.clientpackets.ProtocolVersion.java
- ===================================================================
- import com.l2jfrozen.gameserver.network.serverpackets.SendStatus;
- +import Hwid.Hwid;
- +import Hwid.HwidConfig;
- @@
- static Logger LOGGER = Logger.getLogger(ProtocolVersion.class);
- private int _version;
- + private byte _data[];
- + private String
- + _hwidHdd = "NoHWID-HD";
- + private String _hwidMac = "NoHWID-MAC";
- + private String _hwidCPU = "NoHWID-CPU";
- + L2PcInstance player;
- @Override
- protected void readImpl()
- {
- _version = readH();
- + if (Hwid.isProtectionOn())
- + {
- + if (_buf.remaining() > 260)
- + {
- + _data = new byte[260];
- + readB(_data);
- + if (Hwid.isProtectionOn())
- + {
- + _hwidHdd = readS();
- + _hwidMac = readS();
- + _hwidCPU = readS();
- + }
- + }
- + }
- + else if (Hwid.isProtectionOn())
- + {
- + getClient().close(new KeyPacket(getClient().enableCrypt()));
- + }
- }
- @@
- protected void runImpl()
- {
- + if (Hwid.isProtectionOn())
- + {
- + if (_hwidHdd.equals("NoGuard") && _hwidMac.equals("NoGuard") && _hwidCPU.equals("NoGuard"))
- + {
- + LOGGER.info("HWID Status: No Client side dlls");
- + getClient().close(new KeyPacket(getClient().enableCrypt()));
- + }
- +
- + switch (HwidConfig.GET_CLIENT_HWID)
- + {
- + case 1:
- + getClient().setHWID(_hwidHdd);
- + break;
- + case 2:
- + getClient().setHWID(_hwidMac);
- + break;
- + case 3:
- + getClient().setHWID(_hwidCPU);
- + break;
- + }
- + }
- // this packet is never encrypted
- if (_version == 65534 || _version == -2) // Ping
- Index: com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance.java
- ===================================================================
- + private String _hwid = "";
- +
- + public final String getHWID()
- + {
- + return _hwid;
- + }
- +
- + public void setHWID(String hwid)
- + {
- + _hwid = hwid;
- + }
- +
- + /**
- + * This is a multitype HWID function it worked with L2JGuard, catsguard and used in all scoria pack. some here - simple
- + * @return
- + */
- + public String gethwid()
- + { // cats reflect method
- + if (getClient().getHWID() != null)
- + return getClient().getHWID();
- + else if (getClient().getHWID() != null)
- + return getClient().getHWID();
- + else
- + return null;
- + }
- +
- + public String getHWid()
- + {
- + return getClient().getHWID();
- + }
- Index: hwid_bans.sql
- ===================================================================
- DROP TABLE IF EXISTS `hwid_bans`;
- CREATE TABLE `hwid_bans` (
- `HWID` varchar(32) DEFAULT NULL,
- `HWIDSecond` varchar(32) DEFAULT NULL,
- `expiretime` int(11) NOT NULL DEFAULT '0',
- `comments` varchar(255) DEFAULT '',
- UNIQUE KEY `HWID` (`HWID`)
- ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
- Index: hwid_info.sql
- ===================================================================
- DROP TABLE IF EXISTS `hwid_info`;
- CREATE TABLE `hwid_info` (
- `HWID` varchar(32) NOT NULL DEFAULT '',
- `WindowsCount` int(10) unsigned NOT NULL DEFAULT '1',
- `Account` varchar(45) NOT NULL DEFAULT '',
- `PlayerID` int(10) unsigned NOT NULL DEFAULT '0',
- `LockType` enum('PLAYER_LOCK','ACCOUNT_LOCK','NONE') NOT NULL DEFAULT 'NONE',
- PRIMARY KEY (`HWID`)
- ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
- Admin_commands_rights.sql
- ===================================================================
- INSERT INTO `admin_command_access_rights` VALUES('admin_ban_hwid','1');
- config/Hwid.properties
- ===============================================================
- # Allow Guard Protection System
- AllowGuardSystem = True
- # Licence Key
- UserName =
- # =================================================================
- # Protection 2.0 - Key Configurations - Not Change
- # Range of versions of protection client modules
- FstKey = 112
- ScnKey = 56
- AnpKey = -5
- UltKey = 12
- # Not Change values
- ServerKey = aHR0cDovL3RzLnZvdGUtZ2FtZXMuY29tL25HdWFyZDIvbnBnbXVwLnBocA==
- ClientKey = aHR0cDovL3ZndWFyZC5wcm8vbkd1YXJkMi9ucGdtdXAucGhw
- # =================================================================
- # Installing client HWID
- # 1 = HWID HDD
- # 2 = HWID MAC
- # 3 = HWID CPU
- UseClientHWID = 2
- KickWithEmptyHWID = False
- KickWithLastErrorHWID = False
- # Configure the number of open windows client
- # If 0 = Unlimited
- # 1 = 2 players for HWID, 2 = 3 players for HWID
- AllowedWindowsCount = 10
- # Dont use in Interlude only Freya/H5
- EnableHWIDLock = False
- # =================================================================
- # LOGS
- # Enable log on Console Server - Player, HWID, NAME, ID
- EnableConsoleLog = False
- EnableHWIDBans = True
- EnableHWIDBonus = False
- StoreHWID = True
- LogHWIDs = True
- #=============================================
- #EDIT PROTOCOL revision in : config/functions/developer
- #=============================================
- #BETTER NOT EDIT!!
Add Comment
Please, Sign In to add comment