SHOW:
|
|
- or go back to the newest paste.
| 1 | - | diff --git a/aCis_datapack/data/xml/adminCommands.xml b/aCis_datapack/data/xml/adminCommands.xml |
| 1 | + | ### Eclipse Workspace Patch 1.0 |
| 2 | - | index 833d64e53552002c1736307add438de01552f679..ec7bb827aedabb1e82b28e7c3e244fc19a41c22e 100644 |
| 2 | + | #P aCis_gameserver |
| 3 | - | --- a/aCis_datapack/data/xml/adminCommands.xml |
| 3 | + | Index: java/net/sf/l2j/gameserver/model/actor/Player.java |
| 4 | - | +++ b/aCis_datapack/data/xml/adminCommands.xml |
| 4 | + | =================================================================== |
| 5 | - | @@ -191,4 +191,7 @@ |
| 5 | + | --- java/net/sf/l2j/gameserver/model/actor/Player.java (revision 15) |
| 6 | +++ java/net/sf/l2j/gameserver/model/actor/Player.java (working copy) | |
| 7 | @@ -486,6 +486,8 @@ | |
| 8 | public int _activeBoxes = -1; | |
| 9 | public List<String> _activeBoxesCharacters = new ArrayList<>(); | |
| 10 | ||
| 11 | + private String _hwid; | |
| 12 | + | |
| 13 | /** | |
| 14 | - | diff --git a/aCis_datapack/sql/hwid_bans.sql b/aCis_datapack/sql/hwid_bans.sql |
| 14 | + | |
| 15 | - | new file mode 100644 |
| 15 | + | |
| 16 | - | index 0000000000000000000000000000000000000000..bf5808548c74fa21024ea6d828c7afdd9f0fd6ad |
| 16 | + | @@ -7761,4 +7763,14 @@ |
| 17 | - | --- /dev/null |
| 17 | + | |
| 18 | - | +++ b/aCis_datapack/sql/hwid_bans.sql |
| 18 | + | return gms; |
| 19 | } | |
| 20 | + | |
| 21 | + public String getHWid() | |
| 22 | + {
| |
| 23 | + if (getClient() == null) | |
| 24 | + {
| |
| 25 | + return _hwid; | |
| 26 | + } | |
| 27 | + _hwid = getClient().getHWID(); | |
| 28 | - | diff --git a/aCis_datapack/sql/hwid_info.sql b/aCis_datapack/sql/hwid_info.sql |
| 28 | + | |
| 29 | - | new file mode 100644 |
| 29 | + | |
| 30 | - | index 0000000000000000000000000000000000000000..d8eebfec659c2f67ee31b1dd1ce7bf700ed2d04b |
| 30 | + | |
| 31 | - | --- /dev/null |
| 31 | + | |
| 32 | - | +++ b/aCis_datapack/sql/hwid_info.sql |
| 32 | + | Index: java/hwid/hwidmanager/hwidAdminBan.java |
| 33 | =================================================================== | |
| 34 | --- java/hwid/hwidmanager/hwidAdminBan.java (nonexistent) | |
| 35 | +++ java/hwid/hwidmanager/hwidAdminBan.java (working copy) | |
| 36 | @@ -0,0 +1,40 @@ | |
| 37 | +package hwid.hwidmanager; | |
| 38 | + | |
| 39 | +import net.sf.l2j.Config; | |
| 40 | +import net.sf.l2j.gameserver.handler.IAdminCommandHandler; | |
| 41 | +import net.sf.l2j.gameserver.model.WorldObject; | |
| 42 | - | diff --git a/aCis_datapack/tools/database_installer.bat b/aCis_datapack/tools/database_installer.bat |
| 42 | + | |
| 43 | - | index 53582a37c1db0a29f0c9f2aa5c3620148e931344..9ac044d551cf4ea446e8267fd168527880e6fd5b 100644 |
| 43 | + | |
| 44 | - | --- a/aCis_datapack/tools/database_installer.bat |
| 44 | + | |
| 45 | - | +++ b/aCis_datapack/tools/database_installer.bat |
| 45 | + | |
| 46 | - | @@ -105,6 +105,8 @@ echo Installing empty character-related tables. |
| 46 | + | |
| 47 | + {
| |
| 48 | + "admin_hwid_ban" | |
| 49 | + }; | |
| 50 | + | |
| 51 | + @Override | |
| 52 | + public void useAdminCommand(final String command, final Player player) | |
| 53 | + {
| |
| 54 | + if (!Config.ALLOW_GUARD_SYSTEM || player == null) | |
| 55 | - | diff --git a/aCis_datapack/tools/database_installer.sh b/aCis_datapack/tools/database_installer.sh |
| 55 | + | |
| 56 | - | index 216b33983639b86696f03acae0d1a798dcac11a7..b8d3f81d5ab42d6fa1fff99d546936646923017d 100644 |
| 56 | + | |
| 57 | - | --- a/aCis_datapack/tools/database_installer.sh |
| 57 | + | |
| 58 | - | +++ b/aCis_datapack/tools/database_installer.sh |
| 58 | + | |
| 59 | - | @@ -125,6 +125,8 @@ $MYG < ../sql/grandboss_data.sql &> /dev/null |
| 59 | + | |
| 60 | + if (!(playerTarget instanceof Player)) | |
| 61 | + {
| |
| 62 | + player.sendMessage("Target is empty");
| |
| 63 | + return; | |
| 64 | + } | |
| 65 | + final Player target = (Player)playerTarget; | |
| 66 | + hwidBan.addHWIDBan(target.getClient()); | |
| 67 | + player.sendMessage(target.getName() + " banned in HWID"); | |
| 68 | - | diff --git a/aCis_datapack/tools/full_install.sql b/aCis_datapack/tools/full_install.sql |
| 68 | + | |
| 69 | - | index 6ce24b8fc9c0f507c9ddf686b3fdff33c055e16f..f676ec989aa962a0da507384e931fe21db111e02 100644 |
| 69 | + | |
| 70 | - | --- a/aCis_datapack/tools/full_install.sql |
| 70 | + | |
| 71 | - | +++ b/aCis_datapack/tools/full_install.sql |
| 71 | + | |
| 72 | - | @@ -50,6 +50,8 @@ DROP TABLE IF EXISTS games; |
| 72 | + | |
| 73 | + {
| |
| 74 | + return ADMIN_COMMANDS; | |
| 75 | + } | |
| 76 | +} | |
| 77 | \ No newline at end of file | |
| 78 | Index: java/hwid/hwidmanager/hwidBan.java | |
| 79 | - | DROP TABLE IF EXISTS items_delayed; |
| 79 | + | =================================================================== |
| 80 | --- java/hwid/hwidmanager/hwidBan.java (nonexistent) | |
| 81 | - | diff --git a/aCis_gameserver/build.xml b/aCis_gameserver/build.xml |
| 81 | + | +++ java/hwid/hwidmanager/hwidBan.java (working copy) |
| 82 | - | index 6f94e077b3412c85d69e81303a6105911c4ce8e6..6caf8766ce95c1dc7bf50188a49ead7b8ffbfe0e 100644 |
| 82 | + | |
| 83 | - | --- a/aCis_gameserver/build.xml |
| 83 | + | |
| 84 | - | +++ b/aCis_gameserver/build.xml |
| 84 | + | |
| 85 | +import java.sql.Connection; | |
| 86 | +import java.sql.PreparedStatement; | |
| 87 | +import java.sql.ResultSet; | |
| 88 | +import java.util.HashMap; | |
| 89 | +import java.util.Map; | |
| 90 | + | |
| 91 | +import net.sf.l2j.commons.logging.CLogger; | |
| 92 | - | <mkdir dir="${build.dist.login}/config" />
|
| 92 | + | |
| 93 | - | diff --git a/aCis_gameserver/config/en/hwid.properties b/aCis_gameserver/config/en/hwid.properties |
| 93 | + | |
| 94 | - | new file mode 100644 |
| 94 | + | |
| 95 | - | index 0000000000000000000000000000000000000000..9c1c7aab9f51db4a8558784af9a590d5ec016173 |
| 95 | + | |
| 96 | - | --- /dev/null |
| 96 | + | |
| 97 | - | +++ b/aCis_gameserver/config/en/hwid.properties |
| 97 | + | |
| 98 | + protected static CLogger LOGGER = new CLogger(hwidBan.class.getName()); | |
| 99 | + private static hwidBan INSTANCE; | |
| 100 | + private static Map<Integer, hwidBanList> _lists = new HashMap<>(); | |
| 101 | + | |
| 102 | + public hwidBan() | |
| 103 | - | +AllowGuardSystem = False |
| 103 | + | |
| 104 | + load(); | |
| 105 | + LOGGER.info("Loaded " + hwidBan._lists.size() + " banned(s) HWID(s)");
| |
| 106 | + } | |
| 107 | + | |
| 108 | + public static hwidBan getInstance() | |
| 109 | + {
| |
| 110 | + if (INSTANCE == null) | |
| 111 | + INSTANCE = new hwidBan(); | |
| 112 | + return INSTANCE; | |
| 113 | + } | |
| 114 | + | |
| 115 | + private static void load() | |
| 116 | + {
| |
| 117 | + String HWID = ""; | |
| 118 | + int counterHWIDBan = 0; | |
| 119 | + try (Connection con = ConnectionPool.getConnection(); | |
| 120 | + PreparedStatement statement = con.prepareStatement("SELECT * FROM hwid_bans");
| |
| 121 | + ResultSet rset = statement.executeQuery()) | |
| 122 | + {
| |
| 123 | + while (rset.next()) | |
| 124 | + {
| |
| 125 | + HWID = rset.getString("HWID");
| |
| 126 | + final hwidBanList hb = new hwidBanList(counterHWIDBan); | |
| 127 | - | diff --git a/aCis_gameserver/config/hwid.properties b/aCis_gameserver/config/hwid.properties |
| 127 | + | |
| 128 | - | new file mode 100644 |
| 128 | + | |
| 129 | - | index 0000000000000000000000000000000000000000..9c1c7aab9f51db4a8558784af9a590d5ec016173 |
| 129 | + | |
| 130 | - | --- /dev/null |
| 130 | + | |
| 131 | - | +++ b/aCis_gameserver/config/hwid.properties |
| 131 | + | |
| 132 | + catch (Exception e) | |
| 133 | + {
| |
| 134 | + e.printStackTrace(); | |
| 135 | + } | |
| 136 | + } | |
| 137 | - | +AllowGuardSystem = False |
| 137 | + | |
| 138 | + public static void reload() | |
| 139 | + {
| |
| 140 | + INSTANCE = new hwidBan(); | |
| 141 | + } | |
| 142 | + | |
| 143 | + public boolean checkFullHWIDBanned(final GameClient client) | |
| 144 | + {
| |
| 145 | + if (_lists.size() == 0) | |
| 146 | + {
| |
| 147 | + return false; | |
| 148 | + } | |
| 149 | + for (int i = 0; i < _lists.size(); ++i) | |
| 150 | + {
| |
| 151 | + if (_lists.get(i).getHWID().equals(client.getHWID())) | |
| 152 | + return true; | |
| 153 | + } | |
| 154 | + return false; | |
| 155 | + } | |
| 156 | + | |
| 157 | + public static int getCountHWIDBan() | |
| 158 | + {
| |
| 159 | + return _lists.size(); | |
| 160 | + } | |
| 161 | - | diff --git a/aCis_gameserver/java/hwid/crypt/BlowfishEngine.java b/aCis_gameserver/java/hwid/crypt/BlowfishEngine.java |
| 161 | + | |
| 162 | - | new file mode 100644 |
| 162 | + | |
| 163 | - | index 0000000000000000000000000000000000000000..3010a49e9c77e003fb0098676f481789fd12eba0 |
| 163 | + | |
| 164 | - | --- /dev/null |
| 164 | + | |
| 165 | - | +++ b/aCis_gameserver/java/hwid/crypt/BlowfishEngine.java |
| 165 | + | |
| 166 | + final hwidBanList hb = new hwidBanList(counterHwidBan); | |
| 167 | + hb.setHWIDBan(HWID); | |
| 168 | + _lists.put(counterHwidBan, hb); | |
| 169 | + try (Connection con = ConnectionPool.getConnection(); | |
| 170 | + PreparedStatement statement = con.prepareStatement("INSERT INTO hwid_bans SET HWID=?"))
| |
| 171 | + {
| |
| 172 | + statement.setString(1, HWID); | |
| 173 | + statement.execute(); | |
| 174 | + } | |
| 175 | + catch (Exception e) | |
| 176 | + {
| |
| 177 | + e.printStackTrace(); | |
| 178 | + } | |
| 179 | + } | |
| 180 | +} | |
| 181 | \ No newline at end of file | |
| 182 | Index: java/hwid/hwidmanager/hwidBanList.java | |
| 183 | =================================================================== | |
| 184 | --- java/hwid/hwidmanager/hwidBanList.java (nonexistent) | |
| 185 | +++ java/hwid/hwidmanager/hwidBanList.java (working copy) | |
| 186 | @@ -0,0 +1,27 @@ | |
| 187 | +package hwid.hwidmanager; | |
| 188 | + | |
| 189 | +public class hwidBanList | |
| 190 | +{
| |
| 191 | + private final int _id; | |
| 192 | + private String _hwid; | |
| 193 | + | |
| 194 | + public hwidBanList(final int id) | |
| 195 | + {
| |
| 196 | + _id = id; | |
| 197 | + } | |
| 198 | + | |
| 199 | + public int getId() | |
| 200 | + {
| |
| 201 | + return _id; | |
| 202 | + } | |
| 203 | + | |
| 204 | + public String getHWID() | |
| 205 | + {
| |
| 206 | + return _hwid; | |
| 207 | + } | |
| 208 | + | |
| 209 | + public void setHWIDBan(final String hwid) | |
| 210 | + {
| |
| 211 | + _hwid = hwid; | |
| 212 | + } | |
| 213 | +} | |
| 214 | Index: java/hwid/hwidmanager/hwidInfoClient.java | |
| 215 | =================================================================== | |
| 216 | --- java/hwid/hwidmanager/hwidInfoClient.java (nonexistent) | |
| 217 | +++ java/hwid/hwidmanager/hwidInfoClient.java (working copy) | |
| 218 | @@ -0,0 +1,69 @@ | |
| 219 | +package hwid.hwidmanager; | |
| 220 | + | |
| 221 | +public class hwidInfoClient | |
| 222 | +{
| |
| 223 | + private String _playerName; | |
| 224 | + private String _loginName; | |
| 225 | + private int _playerId; | |
| 226 | + private String _hwid; | |
| 227 | + private int _revision; | |
| 228 | + | |
| 229 | + public hwidInfoClient() | |
| 230 | + {
| |
| 231 | + _playerName = ""; | |
| 232 | + _loginName = ""; | |
| 233 | + _playerId = 0; | |
| 234 | + _hwid = ""; | |
| 235 | + _revision = 0; | |
| 236 | + } | |
| 237 | + | |
| 238 | + public final String getPlayerName() | |
| 239 | + {
| |
| 240 | + return _playerName; | |
| 241 | + } | |
| 242 | + | |
| 243 | + public void setPlayerName(final String name) | |
| 244 | + {
| |
| 245 | + _playerName = name; | |
| 246 | + } | |
| 247 | + | |
| 248 | + public void setPlayerId(final int plId) | |
| 249 | + {
| |
| 250 | + _playerId = plId; | |
| 251 | + } | |
| 252 | + | |
| 253 | + public int getPlayerId() | |
| 254 | + {
| |
| 255 | + return _playerId; | |
| 256 | + } | |
| 257 | + | |
| 258 | + public final String getHWID() | |
| 259 | + {
| |
| 260 | + return _hwid; | |
| 261 | + } | |
| 262 | + | |
| 263 | + public void setHWID(final String hwid) | |
| 264 | + {
| |
| 265 | + _hwid = hwid; | |
| 266 | + } | |
| 267 | + | |
| 268 | + public void setRevision(final int revision) | |
| 269 | + {
| |
| 270 | + _revision = revision; | |
| 271 | + } | |
| 272 | + | |
| 273 | + public int getRevision() | |
| 274 | + {
| |
| 275 | + return _revision; | |
| 276 | + } | |
| 277 | + | |
| 278 | + public final String getLoginName() | |
| 279 | + {
| |
| 280 | + return _loginName; | |
| 281 | + } | |
| 282 | + | |
| 283 | + public void setLoginName(final String name) | |
| 284 | + {
| |
| 285 | + _loginName = name; | |
| 286 | + } | |
| 287 | +} | |
| 288 | \ No newline at end of file | |
| 289 | Index: java/hwid/hwidmanager/hwidInfoList.java | |
| 290 | =================================================================== | |
| 291 | --- java/hwid/hwidmanager/hwidInfoList.java (nonexistent) | |
| 292 | +++ java/hwid/hwidmanager/hwidInfoList.java (working copy) | |
| 293 | @@ -0,0 +1,78 @@ | |
| 294 | +package hwid.hwidmanager; | |
| 295 | + | |
| 296 | +public class hwidInfoList | |
| 297 | +{
| |
| 298 | + private final int _id; | |
| 299 | + private String _hwid; | |
| 300 | + private int _count; | |
| 301 | + private int _playerID; | |
| 302 | + private String _login; | |
| 303 | + private LockType _lockType; | |
| 304 | + | |
| 305 | + public hwidInfoList(final int id) | |
| 306 | + {
| |
| 307 | + _id = id; | |
| 308 | + } | |
| 309 | + | |
| 310 | + public int get_id() | |
| 311 | + {
| |
| 312 | + return _id; | |
| 313 | + } | |
| 314 | + | |
| 315 | + public int getCount() | |
| 316 | + {
| |
| 317 | + return _count; | |
| 318 | + } | |
| 319 | + | |
| 320 | + public void setCount(final int count) | |
| 321 | + {
| |
| 322 | + _count = count; | |
| 323 | + } | |
| 324 | + | |
| 325 | + public int getPlayerID() | |
| 326 | + {
| |
| 327 | + return _playerID; | |
| 328 | + } | |
| 329 | + | |
| 330 | + public void setPlayerID(final int playerID) | |
| 331 | + {
| |
| 332 | + _playerID = playerID; | |
| 333 | + } | |
| 334 | + | |
| 335 | + public String getHWID() | |
| 336 | + {
| |
| 337 | + return _hwid; | |
| 338 | + } | |
| 339 | + | |
| 340 | - | diff --git a/aCis_gameserver/java/hwid/crypt/FirstKey.java b/aCis_gameserver/java/hwid/crypt/FirstKey.java |
| 340 | + | |
| 341 | - | new file mode 100644 |
| 341 | + | |
| 342 | - | index 0000000000000000000000000000000000000000..80da89163a4f9b4c7c27624cabe7ddb4fe14c5c3 |
| 342 | + | |
| 343 | - | --- /dev/null |
| 343 | + | |
| 344 | - | +++ b/aCis_gameserver/java/hwid/crypt/FirstKey.java |
| 344 | + | |
| 345 | + public String getLogin() | |
| 346 | + {
| |
| 347 | + return _login; | |
| 348 | + } | |
| 349 | + | |
| 350 | + public void setLogin(final String login) | |
| 351 | + {
| |
| 352 | + _login = login; | |
| 353 | + } | |
| 354 | + | |
| 355 | + public LockType getLockType() | |
| 356 | + {
| |
| 357 | + return _lockType; | |
| 358 | + } | |
| 359 | + | |
| 360 | + public void setLockType(final LockType lockType) | |
| 361 | + {
| |
| 362 | + _lockType = lockType; | |
| 363 | + } | |
| 364 | + | |
| 365 | + public enum LockType | |
| 366 | + {
| |
| 367 | + PLAYER_LOCK, | |
| 368 | + ACCOUNT_LOCK, | |
| 369 | + NONE; | |
| 370 | + } | |
| 371 | +} | |
| 372 | \ No newline at end of file | |
| 373 | Index: java/hwid/hwidmanager/hwidManager.java | |
| 374 | =================================================================== | |
| 375 | - | diff --git a/aCis_gameserver/java/hwid/crypt/GameCrypt.java b/aCis_gameserver/java/hwid/crypt/GameCrypt.java |
| 375 | + | --- java/hwid/hwidmanager/hwidManager.java (nonexistent) |
| 376 | - | new file mode 100644 |
| 376 | + | +++ java/hwid/hwidmanager/hwidManager.java (working copy) |
| 377 | - | index 0000000000000000000000000000000000000000..11ef8215a39e52d5ff372e2fe4f89b54f97730bb |
| 377 | + | |
| 378 | - | --- /dev/null |
| 378 | + | |
| 379 | - | +++ b/aCis_gameserver/java/hwid/crypt/GameCrypt.java |
| 379 | + | |
| 380 | +import java.util.ArrayList; | |
| 381 | +import java.util.Collection; | |
| 382 | +import java.util.HashMap; | |
| 383 | +import java.util.List; | |
| 384 | +import java.util.Map; | |
| 385 | + | |
| 386 | +import net.sf.l2j.commons.logging.CLogger; | |
| 387 | + | |
| 388 | +import net.sf.l2j.Config; | |
| 389 | +import net.sf.l2j.gameserver.model.actor.Player; | |
| 390 | +import net.sf.l2j.gameserver.network.GameClient; | |
| 391 | +import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage; | |
| 392 | + | |
| 393 | +public class hwidManager | |
| 394 | +{
| |
| 395 | + private static final CLogger LOGGER = new CLogger(hwidManager.class.getName()); | |
| 396 | + | |
| 397 | + public hwidManager() | |
| 398 | + {
| |
| 399 | + } | |
| 400 | + | |
| 401 | + private static boolean multiboxKickTask(final Player activeChar, final Integer numberBox, final Collection<Player> world) | |
| 402 | + {
| |
| 403 | + final Map<String, List<Player>> hwidMap = new HashMap<>(); | |
| 404 | + for (final Player player : world) | |
| 405 | + {
| |
| 406 | + if (player.getClient() != null) | |
| 407 | + {
| |
| 408 | + if (player.getClient().isDetached()) | |
| 409 | + continue; | |
| 410 | + | |
| 411 | + final String hwid = activeChar.getHWid(); | |
| 412 | + final String playerHwid = player.getHWid(); | |
| 413 | + if (!hwid.equals(playerHwid)) | |
| 414 | + continue; | |
| 415 | + | |
| 416 | + if (hwidMap.get(hwid) == null) | |
| 417 | + hwidMap.put(hwid, new ArrayList<Player>()); | |
| 418 | + | |
| 419 | + hwidMap.get(hwid).add(player); | |
| 420 | + if (hwidMap.get(hwid).size() >= numberBox) | |
| 421 | + return true; | |
| 422 | + | |
| 423 | + continue; | |
| 424 | + } | |
| 425 | + } | |
| 426 | + return false; | |
| 427 | + } | |
| 428 | + | |
| 429 | + public boolean validBox(final Player activeChar, final Integer numberBox, final Collection<Player> world, final Boolean forcedLogOut) | |
| 430 | + {
| |
| 431 | + if (multiboxKickTask(activeChar, numberBox, world)) | |
| 432 | + {
| |
| 433 | + if (forcedLogOut) | |
| 434 | + {
| |
| 435 | + final GameClient client = activeChar.getClient(); | |
| 436 | + LOGGER.warn("Dualbox Protection: " + client.getHWID() + " was trying to use over " + numberBox + " clients!");
| |
| 437 | - | diff --git a/aCis_gameserver/java/hwid/crypt/Manager.java b/aCis_gameserver/java/hwid/crypt/Manager.java |
| 437 | + | |
| 438 | - | new file mode 100644 |
| 438 | + | |
| 439 | - | index 0000000000000000000000000000000000000000..86240080a68be5a3dd0872c1892a733a0ee8e411 |
| 439 | + | |
| 440 | - | --- /dev/null |
| 440 | + | |
| 441 | - | +++ b/aCis_gameserver/java/hwid/crypt/Manager.java |
| 441 | + | |
| 442 | + showChatWindow(activeChar, 0); | |
| 443 | + waitSecs(30); | |
| 444 | + activeChar.getClient().closeNow(); | |
| 445 | + } | |
| 446 | + return true; | |
| 447 | + } | |
| 448 | + return false; | |
| 449 | + } | |
| 450 | + | |
| 451 | + public void showChatWindow(final Player player, final int val) | |
| 452 | + {
| |
| 453 | + final NpcHtmlMessage msg = new NpcHtmlMessage(5); | |
| 454 | + msg.setHtml(ExcedLimit(player)); | |
| 455 | + player.sendPacket(msg); | |
| 456 | + } | |
| 457 | + | |
| 458 | + private static String ExcedLimit(final Player player) | |
| 459 | + {
| |
| 460 | + final StringBuilder tb = new StringBuilder(); | |
| 461 | + tb.append("<html><body><center>");
| |
| 462 | + tb.append("<img src=\"L2UI_CH3.herotower_deco\" width=256 height=32>HWID<font color=LEVEL> Dual Box </font>'- Manager");
| |
| 463 | + tb.append("<br><table><tr><td height=7><img src=\"L2UI.SquareGray\" width=220 height=1></td></tr></table>");
| |
| 464 | + tb.append("<img src=\"L2UI.SquareGray\" width=295 height=1><table width=295 border=0 bgcolor=000000><tr><td align=center>");
| |
| 465 | + tb.append("<br>You have exceeded the PC connection limit.<br1>Server have limit to <font color=LEVEL>" + Config.PROTECT_WINDOWS_COUNT + "</font> per PC.<br><br>You will be disconnected in '<font color=LEVEL>30 seconds</font>'.<br1>" + player.getName() + ", Thanks for following the server rules.<br1>Thanks.<br>");
| |
| 466 | + tb.append("<br><img src=\"l2ui.squarewhite\" width=\"150\" height=\"1\"><br>");
| |
| 467 | + tb.append("<br></td></tr></table><img src=\"L2UI.SquareGray\" width=295 height=1>");
| |
| 468 | + tb.append("<table><tr><td height=7><img src=\"L2UI.SquareGray\" width=220 height=1></td></tr></table><br>");
| |
| 469 | + tb.append("<br><br><font color=333333>Respect the rules</font>");
| |
| 470 | + return tb.toString(); | |
| 471 | + } | |
| 472 | + | |
| 473 | + public static void waitSecs(final int i) | |
| 474 | + {
| |
| 475 | + try | |
| 476 | + {
| |
| 477 | + Thread.sleep(i * 1000); | |
| 478 | + } | |
| 479 | + catch (InterruptedException ie) | |
| 480 | + {
| |
| 481 | + ie.printStackTrace(); | |
| 482 | + } | |
| 483 | + } | |
| 484 | + | |
| 485 | + public static final hwidManager getInstance() | |
| 486 | + {
| |
| 487 | + return SingletonHolder.INSTANCE; | |
| 488 | + } | |
| 489 | + | |
| 490 | + private static class SingletonHolder | |
| 491 | + {
| |
| 492 | + protected static final hwidManager INSTANCE = new hwidManager(); | |
| 493 | + } | |
| 494 | +} | |
| 495 | \ No newline at end of file | |
| 496 | Index: java/hwid/hwidmanager/hwidPlayer.java | |
| 497 | =================================================================== | |
| 498 | --- java/hwid/hwidmanager/hwidPlayer.java (nonexistent) | |
| 499 | +++ java/hwid/hwidmanager/hwidPlayer.java (working copy) | |
| 500 | @@ -0,0 +1,199 @@ | |
| 501 | +package hwid.hwidmanager; | |
| 502 | + | |
| 503 | +import java.sql.Connection; | |
| 504 | +import java.sql.PreparedStatement; | |
| 505 | +import java.sql.ResultSet; | |
| 506 | +import java.util.HashMap; | |
| 507 | +import java.util.Map; | |
| 508 | + | |
| 509 | +import net.sf.l2j.commons.logging.CLogger; | |
| 510 | +import net.sf.l2j.commons.pool.ConnectionPool; | |
| 511 | + | |
| 512 | +import net.sf.l2j.gameserver.network.GameClient; | |
| 513 | + | |
| 514 | +import hwid.hwidmanager.hwidInfoList.LockType; | |
| 515 | + | |
| 516 | +public class hwidPlayer | |
| 517 | +{
| |
| 518 | + protected static CLogger LOGGER = new CLogger(hwidPlayer.class.getName()); | |
| 519 | + private static hwidPlayer INSTANCE; | |
| 520 | + private static Map<Integer, hwidInfoList> _list = new HashMap<>(); | |
| 521 | + private static Map<Integer, Integer> _sessions = new HashMap<>(); | |
| 522 | - | diff --git a/aCis_gameserver/java/hwid/crypt/ProtectionCrypt.java b/aCis_gameserver/java/hwid/crypt/ProtectionCrypt.java |
| 522 | + | |
| 523 | - | new file mode 100644 |
| 523 | + | |
| 524 | - | index 0000000000000000000000000000000000000000..1bfcecf28d43a279cd9759ac38aaf8a8cc7928d4 |
| 524 | + | |
| 525 | - | --- /dev/null |
| 525 | + | |
| 526 | - | +++ b/aCis_gameserver/java/hwid/crypt/ProtectionCrypt.java |
| 526 | + | |
| 527 | + } | |
| 528 | + | |
| 529 | + public static hwidPlayer getInstance() | |
| 530 | + {
| |
| 531 | + if (INSTANCE == null) | |
| 532 | + INSTANCE = new hwidPlayer(); | |
| 533 | + return INSTANCE; | |
| 534 | + } | |
| 535 | + | |
| 536 | - | diff --git a/aCis_gameserver/java/hwid/crypt/ProtectionPackets.java b/aCis_gameserver/java/hwid/crypt/ProtectionPackets.java |
| 536 | + | |
| 537 | - | new file mode 100644 |
| 537 | + | |
| 538 | - | index 0000000000000000000000000000000000000000..41cc1e30d3e74a4426b2dabb48ec7bc6afce6610 |
| 538 | + | |
| 539 | - | --- /dev/null |
| 539 | + | |
| 540 | - | +++ b/aCis_gameserver/java/hwid/crypt/ProtectionPackets.java |
| 540 | + | |
| 541 | + {
| |
| 542 | + int counterHWIDInfo = 0; | |
| 543 | + while (rset.next()) | |
| 544 | + {
| |
| 545 | + final hwidInfoList hInfo = new hwidInfoList(counterHWIDInfo); | |
| 546 | + hInfo.setHWID(rset.getString("HWID"));
| |
| 547 | + hInfo.setLogin(rset.getString("Account"));
| |
| 548 | + hInfo.setPlayerID(rset.getInt("PlayerID"));
| |
| 549 | + hInfo.setLockType(LockType.valueOf(rset.getString("LockType")));
| |
| 550 | + _list.put(counterHWIDInfo, hInfo); | |
| 551 | + ++counterHWIDInfo; | |
| 552 | + } | |
| 553 | + } | |
| 554 | + catch (Exception e) | |
| 555 | + {
| |
| 556 | + e.printStackTrace(); | |
| 557 | + } | |
| 558 | + } | |
| 559 | + | |
| 560 | + public static void reload() | |
| 561 | + {
| |
| 562 | + INSTANCE = new hwidPlayer(); | |
| 563 | + } | |
| 564 | + | |
| 565 | + public static int startSession(int WindowsCount) | |
| 566 | + {
| |
| 567 | + synchronized (_list) | |
| 568 | + {
| |
| 569 | + if (_sessions.get(WindowsCount) == null) | |
| 570 | + _sessions.put(WindowsCount, 0); | |
| 571 | + _sessions.put(WindowsCount, _sessions.get(WindowsCount) + 1); | |
| 572 | + } | |
| 573 | + return _sessions.get(WindowsCount); | |
| 574 | + } | |
| 575 | + | |
| 576 | + public static void updateHWIDInfo(GameClient client) | |
| 577 | + {
| |
| 578 | + updateHWIDInfo(client, LockType.NONE); | |
| 579 | + } | |
| 580 | + | |
| 581 | + public static void updateHWIDInfo(final GameClient client, final LockType lockType) | |
| 582 | + {
| |
| 583 | + int counterHwidInfo = _list.size(); | |
| 584 | + boolean isFound = false; | |
| 585 | + for (int i = 0; i < _list.size(); ++i) | |
| 586 | + {
| |
| 587 | + if (_list.get(i).getHWID().equals(client.getHWID())) | |
| 588 | + {
| |
| 589 | + isFound = true; | |
| 590 | + counterHwidInfo = i; | |
| 591 | + break; | |
| 592 | - | diff --git a/aCis_gameserver/java/hwid/crypt/impl/L2Client.java b/aCis_gameserver/java/hwid/crypt/impl/L2Client.java |
| 592 | + | |
| 593 | - | new file mode 100644 |
| 593 | + | |
| 594 | - | index 0000000000000000000000000000000000000000..8c6b55c26fa837e7a340795716c17bedef945009 |
| 594 | + | |
| 595 | - | --- /dev/null |
| 595 | + | |
| 596 | - | +++ b/aCis_gameserver/java/hwid/crypt/impl/L2Client.java |
| 596 | + | |
| 597 | + hInfo.setPlayerID(client.getPlayerId()); | |
| 598 | + hInfo.setLockType(lockType); | |
| 599 | + _list.put(counterHwidInfo, hInfo); | |
| 600 | + if (isFound) | |
| 601 | + {
| |
| 602 | + try (Connection con = ConnectionPool.getConnection(); | |
| 603 | + PreparedStatement statement = con.prepareStatement("UPDATE hwid_info SET Account=?,PlayerID=?,LockType=? WHERE HWID=?"))
| |
| 604 | + {
| |
| 605 | + statement.setString(1, client.getAccountName()); | |
| 606 | + statement.setInt(2, client.getPlayerId()); | |
| 607 | + statement.setString(3, lockType.toString()); | |
| 608 | + statement.setString(4, client.getHWID()); | |
| 609 | + statement.execute(); | |
| 610 | + } | |
| 611 | + catch (Exception e) | |
| 612 | + {
| |
| 613 | + e.printStackTrace(); | |
| 614 | + } | |
| 615 | + } | |
| 616 | + else | |
| 617 | - | + System.arraycopy(key, 0, _key, 0, 16); |
| 617 | + | |
| 618 | + try (Connection con = ConnectionPool.getConnection(); | |
| 619 | + PreparedStatement statement = con.prepareStatement("INSERT INTO hwid_info (HWID, Account, PlayerID, LockType) values (?,?,?,?)"))
| |
| 620 | + {
| |
| 621 | + statement.setString(1, client.getHWID()); | |
| 622 | + statement.setString(2, client.getAccountName()); | |
| 623 | + statement.setInt(3, client.getPlayerId()); | |
| 624 | + statement.setString(4, lockType.toString()); | |
| 625 | + statement.execute(); | |
| 626 | + } | |
| 627 | + catch (Exception e) | |
| 628 | + {
| |
| 629 | + e.printStackTrace(); | |
| 630 | + } | |
| 631 | + } | |
| 632 | + } | |
| 633 | + | |
| 634 | + public static boolean checkLockedHWID(final GameClient client) | |
| 635 | + {
| |
| 636 | + if (_list.size() == 0) | |
| 637 | + return false; | |
| 638 | + | |
| 639 | + boolean result = false; | |
| 640 | + for (int i = 0; i < _list.size(); ++i) | |
| 641 | + {
| |
| 642 | + switch (_list.get(i).getLockType().ordinal()) | |
| 643 | + {
| |
| 644 | + case 2: | |
| 645 | + {
| |
| 646 | + if (client.getPlayerId() == 0) | |
| 647 | + break; | |
| 648 | + | |
| 649 | - | diff --git a/aCis_gameserver/java/hwid/crypt/impl/L2Server.java b/aCis_gameserver/java/hwid/crypt/impl/L2Server.java |
| 649 | + | |
| 650 | - | new file mode 100644 |
| 650 | + | |
| 651 | - | index 0000000000000000000000000000000000000000..a8aecb79a953dee93ca33798e100c5606d210445 |
| 651 | + | |
| 652 | - | --- /dev/null |
| 652 | + | |
| 653 | - | +++ b/aCis_gameserver/java/hwid/crypt/impl/L2Server.java |
| 653 | + | |
| 654 | + | |
| 655 | + result = true; | |
| 656 | + break; | |
| 657 | + } | |
| 658 | + case 3: | |
| 659 | + {
| |
| 660 | + if (!_list.get(i).getLogin().equals(client.getLoginName())) | |
| 661 | + break; | |
| 662 | + | |
| 663 | + if (_list.get(i).getHWID().equals(client.getHWID())) | |
| 664 | + return false; | |
| 665 | + | |
| 666 | + result = true; | |
| 667 | + break; | |
| 668 | + } | |
| 669 | + } | |
| 670 | + } | |
| 671 | + return result; | |
| 672 | + } | |
| 673 | + | |
| 674 | - | + System.arraycopy(key, 0, _key, 0, 16); |
| 674 | + | |
| 675 | + {
| |
| 676 | + if (_list.size() == 0) | |
| 677 | + return -1; | |
| 678 | + | |
| 679 | + int i = 0; | |
| 680 | + while (i < _list.size()) | |
| 681 | + {
| |
| 682 | + if (!_list.get(i).getHWID().equals(client.getHWID())) | |
| 683 | + ++i; | |
| 684 | + else | |
| 685 | + {
| |
| 686 | + if (_list.get(i).getHWID().equals(""))
| |
| 687 | + return -1; | |
| 688 | + | |
| 689 | + return _list.get(i).getCount(); | |
| 690 | + } | |
| 691 | + } | |
| 692 | + return -1; | |
| 693 | + } | |
| 694 | + | |
| 695 | + public static int getCountHwidInfo() | |
| 696 | + {
| |
| 697 | + return _list.size(); | |
| 698 | + } | |
| 699 | +} | |
| 700 | \ No newline at end of file | |
| 701 | Index: config/hwid.properties | |
| 702 | =================================================================== | |
| 703 | --- config/hwid.properties (nonexistent) | |
| 704 | +++ config/hwid.properties (working copy) | |
| 705 | - | diff --git a/aCis_gameserver/java/hwid/crypt/impl/VMPC.java b/aCis_gameserver/java/hwid/crypt/impl/VMPC.java |
| 705 | + | |
| 706 | - | new file mode 100644 |
| 706 | + | |
| 707 | - | index 0000000000000000000000000000000000000000..10b5eae92f1c93716ecb9506eb8c8e6fa0828693 |
| 707 | + | |
| 708 | - | --- /dev/null |
| 708 | + | |
| 709 | - | +++ b/aCis_gameserver/java/hwid/crypt/impl/VMPC.java |
| 709 | + | |
| 710 | +AllowGuardSystem = True | |
| 711 | + | |
| 712 | +# Installing client HWID | |
| 713 | +# 1 = HWID HDD | |
| 714 | +# 2 = HWID MAC | |
| 715 | +# 3 = HWID CPU | |
| 716 | +UseClientHWID = 2 | |
| 717 | +KickWithEmptyHWID = True | |
| 718 | +KickWithLastErrorHWID = True | |
| 719 | + | |
| 720 | +# What is the criterion to prohibit the launch of multiple windows? | |
| 721 | +# IP - to IP, HWID - client on HWID | |
| 722 | +ClientWindowsCountSec = HWID | |
| 723 | + | |
| 724 | +# Configure the number of open windows client | |
| 725 | +# If 0 = Unlimited | |
| 726 | +AllowedWindowsCount = 2 | |
| 727 | + | |
| 728 | +# Enable log on Console Server - Player, HWID, NAME, ID | |
| 729 | +EnableConsoleLog = True | |
| 730 | +EnableHWIDBans = True | |
| 731 | +EnableHWIDBonus = True | |
| 732 | +StoreHWID = True | |
| 733 | +LogHWIDs = True | |
| 734 | Index: java/hwid/crypt/GameCrypt.java | |
| 735 | =================================================================== | |
| 736 | --- java/hwid/crypt/GameCrypt.java (nonexistent) | |
| 737 | +++ java/hwid/crypt/GameCrypt.java (working copy) | |
| 738 | @@ -0,0 +1,55 @@ | |
| 739 | +package hwid.crypt; | |
| 740 | + | |
| 741 | +import net.sf.l2j.Config; | |
| 742 | + | |
| 743 | +import hwid.crypt.impl.L2Client; | |
| 744 | +import hwid.crypt.impl.L2Server; | |
| 745 | +import hwid.crypt.impl.VMPC; | |
| 746 | + | |
| 747 | +public class GameCrypt | |
| 748 | +{
| |
| 749 | + private ProtectionCrypt _client; | |
| 750 | + private ProtectionCrypt _server; | |
| 751 | + private boolean _isEnabled; | |
| 752 | + private boolean _isProtected; | |
| 753 | + | |
| 754 | + public GameCrypt() | |
| 755 | + {
| |
| 756 | + _isEnabled = false; | |
| 757 | + _isProtected = false; | |
| 758 | + } | |
| 759 | + | |
| 760 | + public void setProtected(final boolean state) | |
| 761 | + {
| |
| 762 | + _isProtected = state; | |
| 763 | + } | |
| 764 | + | |
| 765 | + public void setKey(final byte[] key) | |
| 766 | + {
| |
| 767 | + if (_isProtected) | |
| 768 | + {
| |
| 769 | + (_client = new VMPC()).setup(key, Config.GUARD_CLIENT_CRYPT); | |
| 770 | + (_server = new L2Server()).setup(key, null); | |
| 771 | + (_server = new VMPC()).setup(key, Config.GUARD_SERVER_CRYPT); | |
| 772 | + } | |
| 773 | + else | |
| 774 | + {
| |
| 775 | + (_client = new L2Client()).setup(key, null); | |
| 776 | - | diff --git a/aCis_gameserver/java/hwid/hwid.java b/aCis_gameserver/java/hwid/hwid.java |
| 776 | + | |
| 777 | - | new file mode 100644 |
| 777 | + | |
| 778 | - | index 0000000000000000000000000000000000000000..d8e3803a5e3f0b4b7719b694a8adc453dbc4e1f4 |
| 778 | + | |
| 779 | - | --- /dev/null |
| 779 | + | |
| 780 | - | +++ b/aCis_gameserver/java/hwid/hwid.java |
| 780 | + | |
| 781 | + {
| |
| 782 | + if (_isEnabled) | |
| 783 | + _client.crypt(raw, offset, size); | |
| 784 | + } | |
| 785 | + | |
| 786 | + public void encrypt(final byte[] raw, final int offset, final int size) | |
| 787 | + {
| |
| 788 | + if (_isEnabled) | |
| 789 | + _server.crypt(raw, offset, size); | |
| 790 | + else | |
| 791 | + _isEnabled = true; | |
| 792 | + } | |
| 793 | +} | |
| 794 | \ No newline at end of file | |
| 795 | Index: build.xml | |
| 796 | =================================================================== | |
| 797 | --- build.xml (revision 15) | |
| 798 | +++ build.xml (working copy) | |
| 799 | @@ -41,6 +41,7 @@ | |
| 800 | <fixcrlf srcdir="${build.dist.game}" eol="crlf" eof="remove" includes="**/*.bat" />
| |
| 801 | <fixcrlf srcdir="${build.dist.login}" eol="crlf" eof="remove" includes="**/*.bat" />
| |
| 802 | <mkdir dir="${build.dist.game}/log" />
| |
| 803 | + <mkdir dir="${build.dist.game}/log/hwid" />
| |
| 804 | <mkdir dir="${build.dist.login}/log" />
| |
| 805 | <mkdir dir="${build.dist.game}/config" />
| |
| 806 | <mkdir dir="${build.dist.game}/config/customs" />
| |
| 807 | Index: java/hwid/crypt/ProtectionPackets.java | |
| 808 | =================================================================== | |
| 809 | --- java/hwid/crypt/ProtectionPackets.java (nonexistent) | |
| 810 | +++ java/hwid/crypt/ProtectionPackets.java (working copy) | |
| 811 | @@ -0,0 +1,49 @@ | |
| 812 | +package hwid.crypt; | |
| 813 | + | |
| 814 | +import net.sf.l2j.commons.random.Rnd; | |
| 815 | + | |
| 816 | +public class ProtectionPackets | |
| 817 | +{
| |
| 818 | + public static int readB(final byte[] raw, int offset, final byte[] data, final int size) | |
| 819 | + {
| |
| 820 | + for (int i = 0; i < size; ++i) | |
| 821 | + {
| |
| 822 | + data[i] = (byte)(raw[offset] ^ raw[0]); | |
| 823 | + offset += (raw[offset + 1] & 0xFF); | |
| 824 | + } | |
| 825 | + return offset; | |
| 826 | + } | |
| 827 | + | |
| 828 | + public static int readS(final byte[] raw, int offset, final byte[] data, final int size) | |
| 829 | + {
| |
| 830 | + for (int i = 0; i < size; ++i) | |
| 831 | + {
| |
| 832 | + data[i] = (byte)(raw[offset] ^ raw[0]); | |
| 833 | + offset += (raw[offset + 1] & 0xFF); | |
| 834 | + if (data[i] == 0) | |
| 835 | + break; | |
| 836 | + } | |
| 837 | + return offset; | |
| 838 | + } | |
| 839 | + | |
| 840 | + public static int writeB(final byte[] raw, int offset, final byte[] data, final int size) | |
| 841 | + {
| |
| 842 | + for (int i = 0; i < size; ++i) | |
| 843 | + {
| |
| 844 | + raw[offset] = (byte)(data[i] ^ raw[0]); | |
| 845 | + raw[offset + 1] = (byte)(2 + Rnd.nextInt(10)); | |
| 846 | + offset += (raw[offset + 1] & 0xFF); | |
| 847 | + } | |
| 848 | + return offset; | |
| 849 | + } | |
| 850 | + | |
| 851 | + public static byte ck(final byte[] raw, final int offset, final int size) | |
| 852 | + {
| |
| 853 | + byte c = -1; | |
| 854 | + for (int i = 0; i < size; ++i) | |
| 855 | + {
| |
| 856 | + c ^= raw[offset + i]; | |
| 857 | + } | |
| 858 | + return c; | |
| 859 | + } | |
| 860 | +} | |
| 861 | \ No newline at end of file | |
| 862 | Index: java/hwid/crypt/BlowfishEngine.java | |
| 863 | =================================================================== | |
| 864 | --- java/hwid/crypt/BlowfishEngine.java (nonexistent) | |
| 865 | +++ java/hwid/crypt/BlowfishEngine.java (working copy) | |
| 866 | @@ -0,0 +1,172 @@ | |
| 867 | +package hwid.crypt; | |
| 868 | + | |
| 869 | +import java.io.IOException; | |
| 870 | + | |
| 871 | +public class BlowfishEngine | |
| 872 | +{
| |
| 873 | + private static final int[] KP = new int[] { 608135816, -2052912941, 320440878, 57701188, -1542899678, 698298832, 137296536, -330404727, 1160258022, 953160567, -1101764913, 887688300, -1062458953, -914599715, 1065670069, -1253635817, -1843997223, -1988494565 };
| |
| 874 | + private static final int[] KS0 = new int[] { -785314906, -1730169428, 805139163, -803545161, -1193168915, 1780907670, -1166241723, -248741991, 614570311, -1282315017, 134345442, -2054226922, 1667834072, 1901547113, -1537671517, -191677058, 227898511, 1921955416, 1904987480, -2112533778, 2069144605, -1034266187, -1674521287, 720527379, -976113629, 677414384, -901678824, -1193592593, -1904616272, 1614419982, 1822297739, -1340175810, -686458943, -1120842969, 2024746970, 1432378464, -430627341, -1437226092, 1464375394, 1676153920, 1439316330, 715854006, -1261675468, 289532110, -1588296017, 2087905683, -1276242927, 1668267050, 732546397, 1947742710, -832815594, -1685613794, -1344882125, 1814351708, 2050118529, 680887927, 999245976, 1800124847, -994056165, 1713906067, 1641548236, -81679983, 1216130144, 1575780402, -276538019, -377129551, -601480446, -345695352, 596196993, -745100091, 258830323, -2081144263, 772490370, -1534844924, 1774776394, -1642095778, 566650946, -152474470, 1728879713, -1412200208, 1783734482, -665571480, -1777359064, -1420741725, 1861159788, 326777828, -1170476976, 2130389656, -1578015459, 967770486, 1724537150, -2109534584, -1930525159, 1164943284, 2105845187, 998989502, -529566248, -2050940813, 1075463327, 1455516326, 1322494562, 910128902, 469688178, 1117454909, 936433444, -804646328, -619713837, 1240580251, 122909385, -2137449605, 634681816, -152510729, -469872614, -1233564613, -1754472259, 79693498, -1045868618, 1084186820, 1583128258, 426386531, 1761308591, 1047286709, 322548459, 995290223, 1845252383, -1691314900, -863943356, -1352745719, -1092366332, -567063811, 1712269319, 422464435, -1060394921, 1170764815, -771006663, -1177289765, 1434042557, 442511882, -694091578, 1076654713, 1738483198, -81812532, -1901729288, -617471240, 1014306527, -43947243, 793779912, -1392160085, 842905082, -48003232, 1395751752, 1040244610, -1638115397, -898659168, 445077038, -552113701, -717051658, 679411651, -1402522938, -1940957837, 1767581616, -1144366904, -503340195, -1192226400, 284835224, -48135240, 1258075500, 768725851, -1705778055, -1225243291, -762426948, 1274779536, -505548070, -1530167757, 1660621633, -823867672, -283063590, 913787905, -797008130, 737222580, -1780753843, -1366257256, -357724559, 1804850592, -795946544, -1345903136, -1908647121, -1904896841, -1879645445, -233690268, -2004305902, -1878134756, 1336762016, 1754252060, -774901359, -1280786003, 791618072, -1106372745, -361419266, -1962795103, -442446833, -1250986776, 413987798, -829824359, -1264037920, -49028937, 2093235073, -760370983, 375366246, -2137688315, -1815317740, 555357303, -424861595, 2008414854, -950779147, -73583153, -338841844, 2067696032, -700376109, -1373733303, 2428461, 544322398, 577241275, 1471733935, 610547355, -267798242, 1432588573, 1507829418, 2025931657, -648391809, 545086370, 48609733, -2094660746, 1653985193, 298326376, 1316178497, -1287180854, 2064951626, 458293330, -1705826027, -703637697, -1130641692, 727753846, -2115603456, 146436021, 1461446943, -224990101, 705550613, -1235000031, -407242314, -13368018, -981117340, 1404054877, -1449160799, 146425753, 1854211946 };
| |
| 875 | + private static final int[] KS1 = new int[] { 1266315497, -1246549692, -613086930, -1004984797, -1385257296, 1235738493, -1662099272, -1880247706, -324367247, 1771706367, 1449415276, -1028546847, 422970021, 1963543593, -1604775104, -468174274, 1062508698, 1531092325, 1804592342, -1711849514, -1580033017, -269995787, 1294809318, -265986623, 1289560198, -2072974554, 1669523910, 35572830, 157838143, 1052438473, 1016535060, 1802137761, 1753167236, 1386275462, -1214491899, -1437595849, 1040679964, 2145300060, -1904392980, 1461121720, -1338320329, -263189491, -266592508, 33600511, -1374882534, 1018524850, 629373528, -603381315, -779021319, 2091462646, -1808644237, 586499841, 988145025, 935516892, -927631820, -1695294041, -1455136442, 265290510, -322386114, -1535828415, -499593831, 1005194799, 847297441, 406762289, 1314163512, 1332590856, 1866599683, -167115585, 750260880, 613907577, 1450815602, -1129346641, -560302305, -644675568, -1282691566, -590397650, 1427272223, 778793252, 1343938022, -1618686585, 2052605720, 1946737175, -1130390852, -380928628, -327488454, -612033030, 1661551462, -1000029230, -283371449, 840292616, -582796489, 616741398, 312560963, 711312465, 1351876610, 322626781, 1910503582, 271666773, -2119403562, 1594956187, 70604529, -677132437, 1007753275, 1495573769, -225450259, -1745748998, -1631928532, 504708206, -2031925904, -353800271, -2045878774, 1514023603, 1998579484, 1312622330, 694541497, -1712906993, -2143385130, 1382467621, 776784248, -1676627094, -971698502, -1797068168, -1510196141, 503983604, -218673497, 907881277, 423175695, 432175456, 1378068232, -149744970, -340918674, -356311194, -474200683, -1501837181, -1317062703, 26017576, -1020076561, -1100195163, 1700274565, 1756076034, -288447217, -617638597, 720338349, 1533947780, 354530856, 688349552, -321042571, 1637815568, 332179504, -345916010, 53804574, -1442618417, -1250730864, 1282449977, -711025141, -877994476, -288586052, 1617046695, -1666491221, -1292663698, 1686838959, 431878346, -1608291911, 1700445008, 1080580658, 1009431731, 832498133, -1071531785, -1688990951, -2023776103, -1778935426, 1648197032, -130578278, -1746719369, 300782431, 375919233, 238389289, -941219882, -1763778655, 2019080857, 1475708069, 455242339, -1685863425, 448939670, -843904277, 1395535956, -1881585436, 1841049896, 1491858159, 885456874, -30872223, -293847949, 1565136089, -396052509, 1108368660, 540939232, 1173283510, -1549095958, -613658859, -87339056, -951913406, -278217803, 1699691293, 1103962373, -669091426, -2038084153, -464828566, 1031889488, -815619598, 1535977030, -58162272, -1043876189, 2132092099, 1774941330, 1199868427, 1452454533, 157007616, -1390851939, 342012276, 595725824, 1480756522, 206960106, 497939518, 591360097, 863170706, -1919713727, -698356495, 1814182875, 2094937945, -873565088, 1082520231, -831049106, -1509457788, 435703966, -386934699, 1641649973, -1452693590, -989067582, 1510255612, -2146710820, -1639679442, -1018874748, -36346107, 236887753, -613164077, 274041037, 1734335097, -479771840, -976997275, 1899903192, 1026095262, -244449504, 356393447, -1884275382, -421290197, -612127241 };
| |
| 876 | + private static final int[] KS2 = new int[] { -381855128, -1803468553, -162781668, -1805047500, 1091903735, 1979897079, -1124832466, -727580568, -737663887, 857797738, 1136121015, 1342202287, 507115054, -1759230650, 337727348, -1081374656, 1301675037, -1766485585, 1895095763, 1721773893, -1078195732, 62756741, 2142006736, 835421444, -1762973773, 1442658625, -635090970, -1412822374, 676362277, 1392781812, 170690266, -373920261, 1759253602, -683120384, 1745797284, 664899054, 1329594018, -393761396, -1249058810, 2062866102, -1429332356, -751345684, -830954599, 1080764994, 553557557, -638351943, -298199125, 991055499, 499776247, 1265440854, 648242737, -354183246, 980351604, -581221582, 1749149687, -898096901, -83167922, -654396521, 1161844396, -1169648345, 1431517754, 545492359, -26498633, -795437749, 1437099964, -1592419752, -861329053, -1713251533, -1507177898, 1060185593, 1593081372, -1876348548, -34019326, 69676912, -2135222948, 86519011, -1782508216, -456757982, 1220612927, -955283748, 133810670, 1090789135, 1078426020, 1569222167, 845107691, -711212847, -222510705, 1091646820, 628848692, 1613405280, -537335645, 526609435, 236106946, 48312990, -1352249391, -892239595, 1797494240, 859738849, 992217954, -289490654, -2051890674, -424014439, -562951028, 765654824, -804095931, -1783130883, 1685915746, -405998096, 1414112111, -2021832454, -1013056217, -214004450, 172450625, -1724973196, 980381355, -185008841, -1475158944, -1578377736, -1726226100, -613520627, -964995824, 1835478071, 660984891, -590288892, -248967737, -872349789, -1254551662, 1762651403, 1719377915, -824476260, -1601057013, -652910941, -1156370552, 1364962596, 2073328063, 1983633131, 926494387, -871278215, -2144935273, -198299347, 1749200295, -966120645, 309677260, 2016342300, 1779581495, -1215147545, 111262694, 1274766160, 443224088, 298511866, 1025883608, -488520759, 1145181785, 168956806, -653464466, -710153686, 1689216846, -628709281, -1094719096, 1692713982, -1648590761, -252198778, 1618508792, 1610833997, -771914938, -164094032, 2001055236, -684262196, -2092799181, -266425487, -1333771897, 1006657119, 2006996926, -1108824540, 1430667929, -1084739999, 1314452623, -220332638, -193663176, -2021016126, 1399257539, -927756684, -1267338667, 1190975929, 2062231137, -1960976508, -2073424263, -1856006686, 1181637006, 548689776, -1932175983, -922558900, -1190417183, -1149106736, 296247880, 1970579870, -1216407114, -525738999, 1714227617, -1003338189, -396747006, 166772364, 1251581989, 493813264, 448347421, 195405023, -1584991729, 677966185, -591930749, 1463355134, -1578971493, 1338867538, 1343315457, -1492745222, -1610435132, 233230375, -1694987225, 2000651841, -1017099258, 1638401717, -266896856, -1057650976, 6314154, 819756386, 300326615, 590932579, 1405279636, -1027467724, -1144263082, -1866680610, -335774303, -833020554, 1862657033, 1266418056, 963775037, 2089974820, -2031914401, 1917689273, 448879540, -744572676, -313240200, 150775221, -667058989, 1303187396, 508620638, -1318983944, -1568336679, 1817252668, 1876281319, 1457606340, 908771278, -574175177, -677760460, -1838972398, 1729034894, 1080033504 };
| |
| 877 | + private static final int[] KS3 = new int[] { 976866871, -738527793, -1413318857, 1522871579, 1555064734, 1336096578, -746444992, -1715692610, -720269667, -1089506539, -701686658, -956251013, -1215554709, 564236357, -1301368386, 1781952180, 1464380207, -1131123079, -962365742, 1699332808, 1393555694, 1183702653, -713881059, 1288719814, 691649499, -1447410096, -1399511320, -1101077756, -1577396752, 1781354906, 1676643554, -1702433246, -1064713544, 1126444790, -1524759638, -1661808476, -2084544070, -1679201715, -1880812208, -1167828010, 673620729, -1489356063, 1269405062, -279616791, -953159725, -145557542, 1057255273, 2012875353, -2132498155, -2018474495, -1693849939, 993977747, -376373926, -1640704105, 753973209, 36408145, -1764381638, 25011837, -774947114, 2088578344, 530523599, -1376601957, 1524020338, 1518925132, -534139791, -535190042, 1202760957, -309069157, -388774771, 674977740, -120232407, 2031300136, 2019492241, -311074731, -141160892, -472686964, 352677332, -1997247046, 60907813, 90501309, -1007968747, 1016092578, -1759044884, -1455814870, 457141659, 509813237, -174299397, 652014361, 1966332200, -1319764491, 55981186, -1967506245, 676427537, -1039476232, -1412673177, -861040033, 1307055953, 942726286, 933058658, -1826555503, -361066302, -79791154, 1361170020, 2001714738, -1464409218, -1020707514, 1222529897, 1679025792, -1565652976, -580013532, 1770335741, 151462246, -1281735158, 1682292957, 1483529935, 471910574, 1539241949, 458788160, -858652289, 1807016891, -576558466, 978976581, 1043663428, -1129001515, 1927990952, -94075717, -1922690386, -1086558393, -761535389, 1412390302, -1362987237, -162634896, 1947078029, -413461673, -126740879, -1353482915, 1077988104, 1320477388, 886195818, 18198404, -508558296, -1785185763, 112762804, -831610808, 1866414978, 891333506, 18488651, 661792760, 1628790961, -409780260, -1153795797, 876946877, -1601685023, 1372485963, 791857591, -1608533303, -534984578, -1127755274, -822013501, -1578587449, 445679433, -732971622, -790962485, -720709064, 54117162, -963561881, -1913048708, -525259953, -140617289, 1140177722, -220915201, 668550556, -1080614356, 367459370, 261225585, -1684794075, -85617823, -826893077, -1029151655, 314222801, -1228863650, -486184436, 282218597, -888953790, -521376242, 379116347, 1285071038, 846784868, -1625320142, -523005217, -744475605, -1989021154, 453669953, 1268987020, -977374944, -1015663912, -550133875, -1684459730, -435458233, 266596637, -447948204, 517658769, -832407089, -851542417, 370717030, -47440635, -2070949179, -151313767, -182193321, -1506642397, -1817692879, 1456262402, -1393524382, 1517677493, 1846949527, -1999473716, -560569710, -2118563376, 1280348187, 1908823572, -423180355, 846861322, 1172426758, -1007518822, -911584259, 1655181056, -1155153950, 901632758, 1897031941, -1308360158, -1228157060, -847864789, 1393639104, 373351379, 950779232, 625454576, -1170726756, -146354570, 2007998917, 544563296, -2050228658, -1964470824, 2058025392, 1291430526, 424198748, 50039436, 29584100, -689184263, -1865090967, -1503863136, 1057563949, -1039604065, -1219600078, -831004069, 1469046755, 985887462 };
| |
| 878 | + private static final int ROUNDS = 16; | |
| 879 | + private static final int BLOCK_SIZE = 8; | |
| 880 | + private static final int SBOX_SK = 256; | |
| 881 | + private static final int P_SZ = 18; | |
| 882 | + private final int[] S0; | |
| 883 | + private final int[] S1; | |
| 884 | + private final int[] S2; | |
| 885 | + private final int[] S3; | |
| 886 | + private final int[] P; | |
| 887 | + private boolean encrypting; | |
| 888 | + private byte[] workingKey; | |
| 889 | + | |
| 890 | + public BlowfishEngine() | |
| 891 | + {
| |
| 892 | + encrypting = false; | |
| 893 | + workingKey = null; | |
| 894 | + S0 = new int[SBOX_SK]; | |
| 895 | + S1 = new int[SBOX_SK]; | |
| 896 | + S2 = new int[SBOX_SK]; | |
| 897 | + S3 = new int[SBOX_SK]; | |
| 898 | + P = new int[P_SZ]; | |
| 899 | + } | |
| 900 | + | |
| 901 | + public void init(final boolean pEncrypting, final byte[] key) | |
| 902 | + {
| |
| 903 | + encrypting = pEncrypting; | |
| 904 | + setKey(workingKey = key); | |
| 905 | + } | |
| 906 | + | |
| 907 | + public String getAlgorithmName() | |
| 908 | + {
| |
| 909 | + return "Blowfish"; | |
| 910 | + } | |
| 911 | + | |
| 912 | + public final int processBlock(final byte[] in, final int inOff, final byte[] out, final int outOff) throws IOException | |
| 913 | + {
| |
| 914 | + if (workingKey == null) | |
| 915 | + {
| |
| 916 | + throw new IllegalStateException("Blowfish not initialised");
| |
| 917 | + } | |
| 918 | + if (inOff + BLOCK_SIZE > in.length) | |
| 919 | + {
| |
| 920 | + throw new IOException("input buffer too short");
| |
| 921 | + } | |
| 922 | + if (outOff + BLOCK_SIZE > out.length) | |
| 923 | + {
| |
| 924 | + throw new IOException("output buffer too short");
| |
| 925 | + } | |
| 926 | + if (encrypting) | |
| 927 | + {
| |
| 928 | + encryptBlock(in, inOff, out, outOff); | |
| 929 | + } | |
| 930 | + else | |
| 931 | + {
| |
| 932 | + decryptBlock(in, inOff, out, outOff); | |
| 933 | + } | |
| 934 | + return BLOCK_SIZE; | |
| 935 | + } | |
| 936 | + | |
| 937 | + public void reset() {}
| |
| 938 | + | |
| 939 | + public int getBlockSize() | |
| 940 | + {
| |
| 941 | + return BLOCK_SIZE; | |
| 942 | + } | |
| 943 | + | |
| 944 | + private int F(final int x) | |
| 945 | + {
| |
| 946 | + return (S0[x >>> 24] + S1[x >>> ROUNDS & 0xFF] ^ S2[x >>> BLOCK_SIZE & 0xFF]) + S3[x & 0xFF]; | |
| 947 | + } | |
| 948 | + | |
| 949 | + private void processTable(int xl, int xr, final int[] table) | |
| 950 | + {
| |
| 951 | + for (int size = table.length, s = 0; s < size; s += 2) | |
| 952 | + {
| |
| 953 | + xl ^= P[0]; | |
| 954 | + for (int i = 1; i < ROUNDS; i += 2) | |
| 955 | + {
| |
| 956 | + xr ^= (F(xl) ^ P[i]); | |
| 957 | + xl ^= (F(xr) ^ P[i + 1]); | |
| 958 | + } | |
| 959 | + xr ^= P[17]; | |
| 960 | + table[s] = xr; | |
| 961 | + table[s + 1] = xl; | |
| 962 | + xr = xl; | |
| 963 | + xl = table[s]; | |
| 964 | + } | |
| 965 | + } | |
| 966 | + | |
| 967 | + private void setKey(final byte[] key) | |
| 968 | + {
| |
| 969 | + System.arraycopy(BlowfishEngine.KS0, 0, S0, 0, SBOX_SK); | |
| 970 | + System.arraycopy(BlowfishEngine.KS1, 0, S1, 0, SBOX_SK); | |
| 971 | + System.arraycopy(BlowfishEngine.KS2, 0, S2, 0, SBOX_SK); | |
| 972 | + System.arraycopy(BlowfishEngine.KS3, 0, S3, 0, SBOX_SK); | |
| 973 | + System.arraycopy(BlowfishEngine.KP, 0, P, 0, P_SZ); | |
| 974 | + final int keyLength = key.length; | |
| 975 | + int keyIndex = 0; | |
| 976 | + for (int i = 0; i < P_SZ; ++i) | |
| 977 | + {
| |
| 978 | + int data = 0; | |
| 979 | + for (int j = 0; j < 4; ++j) | |
| 980 | + {
| |
| 981 | + data = (data << BLOCK_SIZE | (key[keyIndex++] & 0xFF)); | |
| 982 | + if (keyIndex >= keyLength) | |
| 983 | + keyIndex = 0; | |
| 984 | + } | |
| 985 | + final int[] p = P; | |
| 986 | + final int n = i; | |
| 987 | + p[n] ^= data; | |
| 988 | + } | |
| 989 | + processTable(0, 0, P); | |
| 990 | + processTable(P[ROUNDS], P[17], S0); | |
| 991 | + processTable(S0[254], S0[255], S1); | |
| 992 | + processTable(S1[254], S1[255], S2); | |
| 993 | + processTable(S2[254], S2[255], S3); | |
| 994 | + } | |
| 995 | + | |
| 996 | + public void encryptBlock(final byte[] src, final int srcIndex, final byte[] dst, final int dstIndex) | |
| 997 | + {
| |
| 998 | + int xl = BytesTo32bits(src, srcIndex); | |
| 999 | + int xr = BytesTo32bits(src, srcIndex + 4); | |
| 1000 | + xl ^= P[0]; | |
| 1001 | + for (int i = 1; i < ROUNDS; i += 2) | |
| 1002 | + {
| |
| 1003 | + xr ^= (F(xl) ^ P[i]); | |
| 1004 | + xl ^= (F(xr) ^ P[i + 1]); | |
| 1005 | + } | |
| 1006 | + xr ^= P[17]; | |
| 1007 | + Bits32ToBytes(xr, dst, dstIndex); | |
| 1008 | + Bits32ToBytes(xl, dst, dstIndex + 4); | |
| 1009 | + } | |
| 1010 | + | |
| 1011 | + public void decryptBlock(final byte[] src, final int srcIndex, final byte[] dst, final int dstIndex) | |
| 1012 | + {
| |
| 1013 | + int xl = BytesTo32bits(src, srcIndex); | |
| 1014 | + int xr = BytesTo32bits(src, srcIndex + 4); | |
| 1015 | + xl ^= P[17]; | |
| 1016 | + for (int i = ROUNDS; i > 0; i -= 2) | |
| 1017 | + {
| |
| 1018 | + xr ^= (F(xl) ^ P[i]); | |
| 1019 | + xl ^= (F(xr) ^ P[i - 1]); | |
| 1020 | + } | |
| 1021 | + xr ^= P[0]; | |
| 1022 | + Bits32ToBytes(xr, dst, dstIndex); | |
| 1023 | + Bits32ToBytes(xl, dst, dstIndex + 4); | |
| 1024 | + } | |
| 1025 | + | |
| 1026 | + private static int BytesTo32bits(final byte[] b, final int i) | |
| 1027 | + {
| |
| 1028 | + return (b[i + 3] & 0xFF) << 24 | (b[i + 2] & 0xFF) << ROUNDS | (b[i + 1] & 0xFF) << BLOCK_SIZE | (b[i] & 0xFF); | |
| 1029 | + } | |
| 1030 | + | |
| 1031 | + private static void Bits32ToBytes(final int in, final byte[] b, final int offset) | |
| 1032 | + {
| |
| 1033 | + b[offset] = (byte)in; | |
| 1034 | + b[offset + 1] = (byte)(in >> BLOCK_SIZE); | |
| 1035 | + b[offset + 2] = (byte)(in >> ROUNDS); | |
| 1036 | + b[offset + 3] = (byte)(in >> 24); | |
| 1037 | + } | |
| 1038 | +} | |
| 1039 | \ No newline at end of file | |
| 1040 | Index: java/hwid/crypt/impl/VMPC.java | |
| 1041 | =================================================================== | |
| 1042 | --- java/hwid/crypt/impl/VMPC.java (nonexistent) | |
| 1043 | +++ java/hwid/crypt/impl/VMPC.java (working copy) | |
| 1044 | @@ -0,0 +1,64 @@ | |
| 1045 | +package hwid.crypt.impl; | |
| 1046 | + | |
| 1047 | +import hwid.crypt.ProtectionCrypt; | |
| 1048 | + | |
| 1049 | +public class VMPC implements ProtectionCrypt | |
| 1050 | +{
| |
| 1051 | - | diff --git a/aCis_gameserver/java/hwid/hwidmanager/hwidAdminBan.java b/aCis_gameserver/java/hwid/hwidmanager/hwidAdminBan.java |
| 1051 | + | |
| 1052 | - | new file mode 100644 |
| 1052 | + | |
| 1053 | - | index 0000000000000000000000000000000000000000..9ff73004ab7d5fa4020a199cdafd29f12bbe91f2 |
| 1053 | + | |
| 1054 | - | --- /dev/null |
| 1054 | + | |
| 1055 | - | +++ b/aCis_gameserver/java/hwid/hwidmanager/hwidAdminBan.java |
| 1055 | + | |
| 1056 | + {
| |
| 1057 | + _n = 0; | |
| 1058 | + _P = new byte[256]; | |
| 1059 | + _s = 0; | |
| 1060 | + } | |
| 1061 | + | |
| 1062 | + @Override | |
| 1063 | + public void setup(final byte[] key, final byte[] iv) | |
| 1064 | + {
| |
| 1065 | + _s = 0; | |
| 1066 | + for (int i = 0; i < 256; ++i) | |
| 1067 | + {
| |
| 1068 | + _P[i] = (byte)(i & 0xFF); | |
| 1069 | + } | |
| 1070 | + for (int m = 0; m < 768; ++m) | |
| 1071 | + {
| |
| 1072 | + _s = _P[_s + _P[m & 0xFF] + key[m % 64] & 0xFF]; | |
| 1073 | + final byte temp = _P[m & 0xFF]; | |
| 1074 | + _P[m & 0xFF] = _P[_s & 0xFF]; | |
| 1075 | + _P[_s & 0xFF] = temp; | |
| 1076 | + } | |
| 1077 | + for (int m = 0; m < 768; ++m) | |
| 1078 | + {
| |
| 1079 | + _s = _P[_s + _P[m & 0xFF] + iv[m % 64] & 0xFF]; | |
| 1080 | + final byte temp = _P[m & 0xFF]; | |
| 1081 | + _P[m & 0xFF] = _P[_s & 0xFF]; | |
| 1082 | + _P[_s & 0xFF] = temp; | |
| 1083 | + } | |
| 1084 | + for (int m = 0; m < 768; ++m) | |
| 1085 | + {
| |
| 1086 | + _s = _P[_s + _P[m & 0xFF] + key[m % 64] & 0xFF]; | |
| 1087 | + final byte temp = _P[m & 0xFF]; | |
| 1088 | + _P[m & 0xFF] = _P[_s & 0xFF]; | |
| 1089 | + _P[_s & 0xFF] = temp; | |
| 1090 | + } | |
| 1091 | + _n = 0; | |
| 1092 | + } | |
| 1093 | + | |
| 1094 | + @Override | |
| 1095 | + public void crypt(final byte[] raw, final int offset, final int size) | |
| 1096 | + {
| |
| 1097 | + for (int i = 0; i < size; ++i) | |
| 1098 | - | diff --git a/aCis_gameserver/java/hwid/hwidmanager/hwidBan.java b/aCis_gameserver/java/hwid/hwidmanager/hwidBan.java |
| 1098 | + | |
| 1099 | - | new file mode 100644 |
| 1099 | + | |
| 1100 | - | index 0000000000000000000000000000000000000000..3ab0a8d81e778607e143f57f0a7c6a427a560164 |
| 1100 | + | |
| 1101 | - | --- /dev/null |
| 1101 | + | |
| 1102 | - | +++ b/aCis_gameserver/java/hwid/hwidmanager/hwidBan.java |
| 1102 | + | |
| 1103 | + _P[_s & 0xFF] = temp; | |
| 1104 | + _n = (byte)(_n + 1 & 0xFF); | |
| 1105 | + raw[offset + i] ^= z; | |
| 1106 | + } | |
| 1107 | + } | |
| 1108 | +} | |
| 1109 | \ No newline at end of file | |
| 1110 | Index: java/hwid/crypt/Manager.java | |
| 1111 | =================================================================== | |
| 1112 | --- java/hwid/crypt/Manager.java (nonexistent) | |
| 1113 | +++ java/hwid/crypt/Manager.java (working copy) | |
| 1114 | @@ -0,0 +1,78 @@ | |
| 1115 | +package hwid.crypt; | |
| 1116 | + | |
| 1117 | +import java.util.concurrent.ConcurrentHashMap; | |
| 1118 | +import java.util.concurrent.ScheduledFuture; | |
| 1119 | + | |
| 1120 | +import net.sf.l2j.commons.logging.CLogger; | |
| 1121 | + | |
| 1122 | +import net.sf.l2j.Config; | |
| 1123 | +import net.sf.l2j.gameserver.network.GameClient; | |
| 1124 | + | |
| 1125 | +import hwid.hwidmanager.hwidPlayer; | |
| 1126 | + | |
| 1127 | +public final class Manager | |
| 1128 | +{
| |
| 1129 | + protected static CLogger LOGGER = new CLogger(Manager.class.getName()); | |
| 1130 | + protected static String _logFile = "Manager"; | |
| 1131 | + protected static String _logMainFile = "hwid_logs"; | |
| 1132 | + protected static Manager INSTANCE; | |
| 1133 | + protected static ScheduledFuture<?> _GGTask = null; | |
| 1134 | + protected static ConcurrentHashMap<String, InfoSet> _objects = new ConcurrentHashMap<>(); | |
| 1135 | + | |
| 1136 | + public static Manager getInstance() | |
| 1137 | + {
| |
| 1138 | + if (INSTANCE == null) | |
| 1139 | + {
| |
| 1140 | + LOGGER.info("Loaded HWID KEY RUSaCis Project");
| |
| 1141 | + LOGGER.info("Loaded HWID IP " + Config.GAMESERVER_HOSTNAME);
| |
| 1142 | + LOGGER.info("Loaded Anti Leech key...assigned ");
| |
| 1143 | + LOGGER.info("Loaded Restriction Leech...assigned ");
| |
| 1144 | + LOGGER.info("Loaded Licensed to Max Players : " + Config.MAXIMUM_ONLINE_USERS);
| |
| 1145 | + INSTANCE = new Manager(); | |
| 1146 | + } | |
| 1147 | + return INSTANCE; | |
| 1148 | + } | |
| 1149 | + | |
| 1150 | + public void addPlayer(final GameClient client) | |
| 1151 | + {
| |
| 1152 | + hwidPlayer.updateHWIDInfo(client); | |
| 1153 | + _objects.put(client.getPlayerName(), new InfoSet(client.getPlayerName(), client.getHWID())); | |
| 1154 | + } | |
| 1155 | + | |
| 1156 | + public static void removePlayer(final String name) | |
| 1157 | + {
| |
| 1158 | + if (_objects.containsKey(name)) | |
| 1159 | + _objects.remove(name); | |
| 1160 | + } | |
| 1161 | + | |
| 1162 | + public static int getCountByHWID(final String HWID) | |
| 1163 | + {
| |
| 1164 | + int result = 0; | |
| 1165 | + for (final InfoSet object : _objects.values()) | |
| 1166 | + {
| |
| 1167 | + if (object._hwid.equals(HWID)) | |
| 1168 | + ++result; | |
| 1169 | + } | |
| 1170 | + return result; | |
| 1171 | + } | |
| 1172 | + | |
| 1173 | + public class InfoSet | |
| 1174 | + {
| |
| 1175 | + public String _playerName; | |
| 1176 | + public long _lastGGSendTime; | |
| 1177 | + public long _lastGGRecvTime; | |
| 1178 | + public int _attempts; | |
| 1179 | + public String _hwid; | |
| 1180 | + | |
| 1181 | + public InfoSet(final String name, final String HWID) | |
| 1182 | + {
| |
| 1183 | + _playerName = ""; | |
| 1184 | + _hwid = ""; | |
| 1185 | + _playerName = name; | |
| 1186 | + _lastGGSendTime = System.currentTimeMillis(); | |
| 1187 | + _lastGGRecvTime = _lastGGSendTime; | |
| 1188 | + _attempts = 0; | |
| 1189 | + _hwid = HWID; | |
| 1190 | + } | |
| 1191 | + } | |
| 1192 | +} | |
| 1193 | \ No newline at end of file | |
| 1194 | Index: java/hwid/utils/HwidLog.java | |
| 1195 | =================================================================== | |
| 1196 | --- java/hwid/utils/HwidLog.java (nonexistent) | |
| 1197 | +++ java/hwid/utils/HwidLog.java (working copy) | |
| 1198 | @@ -0,0 +1,53 @@ | |
| 1199 | +package hwid.utils; | |
| 1200 | + | |
| 1201 | +import java.io.File; | |
| 1202 | +import java.io.FileWriter; | |
| 1203 | - | diff --git a/aCis_gameserver/java/hwid/hwidmanager/hwidBanList.java b/aCis_gameserver/java/hwid/hwidmanager/hwidBanList.java |
| 1203 | + | |
| 1204 | - | new file mode 100644 |
| 1204 | + | |
| 1205 | - | index 0000000000000000000000000000000000000000..b6f579e81f0a91adc74c55a7864b4cea58d402c1 |
| 1205 | + | |
| 1206 | - | --- /dev/null |
| 1206 | + | |
| 1207 | - | +++ b/aCis_gameserver/java/hwid/hwidmanager/hwidBanList.java |
| 1207 | + | |
| 1208 | +import net.sf.l2j.commons.logging.CLogger; | |
| 1209 | + | |
| 1210 | +public class HwidLog | |
| 1211 | +{
| |
| 1212 | + protected static final CLogger LOGGER = new CLogger(HwidLog.class.getName()); | |
| 1213 | + | |
| 1214 | + public HwidLog() {}
| |
| 1215 | + | |
| 1216 | + public static void auditGMAction(String gmName, String action, String params) | |
| 1217 | + {
| |
| 1218 | + final File file = new File("log/hwid/" + gmName + ".txt");
| |
| 1219 | + if (!file.exists()) | |
| 1220 | + {
| |
| 1221 | + try | |
| 1222 | + {
| |
| 1223 | + file.createNewFile(); | |
| 1224 | + } | |
| 1225 | + catch (IOException e) {}
| |
| 1226 | + } | |
| 1227 | + | |
| 1228 | + try (FileWriter save = new FileWriter(file, true)) | |
| 1229 | + {
| |
| 1230 | + save.write(formatDate(new Date(), "dd/MM/yyyy H:mm:ss") + " >>> HWID: [" + gmName + "] >>> Player: [" + action + "]\r\n"); | |
| 1231 | + } | |
| 1232 | + catch (IOException e) | |
| 1233 | + {
| |
| 1234 | + LOGGER.error("HwidLog for Player " + gmName + " could not be saved: ", e);
| |
| 1235 | + } | |
| 1236 | - | diff --git a/aCis_gameserver/java/hwid/hwidmanager/hwidInfoClient.java b/aCis_gameserver/java/hwid/hwidmanager/hwidInfoClient.java |
| 1236 | + | |
| 1237 | - | new file mode 100644 |
| 1237 | + | |
| 1238 | - | index 0000000000000000000000000000000000000000..4a6ea708fbb917d53eb4eb4405b02870bf18fba7 |
| 1238 | + | |
| 1239 | - | --- /dev/null |
| 1239 | + | |
| 1240 | - | +++ b/aCis_gameserver/java/hwid/hwidmanager/hwidInfoClient.java |
| 1240 | + | |
| 1241 | + } | |
| 1242 | + | |
| 1243 | + public static String formatDate(Date date, String format) | |
| 1244 | + {
| |
| 1245 | + final DateFormat dateFormat = new SimpleDateFormat(format); | |
| 1246 | + if (date != null) | |
| 1247 | + return dateFormat.format(date); | |
| 1248 | + | |
| 1249 | + return null; | |
| 1250 | + } | |
| 1251 | +} | |
| 1252 | \ No newline at end of file | |
| 1253 | Index: java/hwid/utils/Util.java | |
| 1254 | =================================================================== | |
| 1255 | --- java/hwid/utils/Util.java (nonexistent) | |
| 1256 | +++ java/hwid/utils/Util.java (working copy) | |
| 1257 | @@ -0,0 +1,73 @@ | |
| 1258 | +package hwid.utils; | |
| 1259 | + | |
| 1260 | +public class Util | |
| 1261 | +{
| |
| 1262 | + public static void intToBytes(final int value, final byte[] array, int offset) | |
| 1263 | + {
| |
| 1264 | + array[offset++] = (byte)(value & 0xFF); | |
| 1265 | + array[offset++] = (byte)(value >> 8 & 0xFF); | |
| 1266 | + array[offset++] = (byte)(value >> 16 & 0xFF); | |
| 1267 | + array[offset++] = (byte)(value >> 24 & 0xFF); | |
| 1268 | + } | |
| 1269 | + | |
| 1270 | + public static String LastErrorConvertion(final Integer LastError) | |
| 1271 | + {
| |
| 1272 | + return LastError.toString(); | |
| 1273 | + } | |
| 1274 | + | |
| 1275 | + public static final String asHex(final byte[] raw) | |
| 1276 | + {
| |
| 1277 | + return asHex(raw, 0, raw.length); | |
| 1278 | + } | |
| 1279 | + | |
| 1280 | + public static final String asHex(final byte[] raw, final int offset, final int size) | |
| 1281 | + {
| |
| 1282 | + final StringBuffer strbuf = new StringBuffer(raw.length * 2); | |
| 1283 | + for (int i = 0; i < size; ++i) | |
| 1284 | + {
| |
| 1285 | + if ((raw[offset + i] & 0xFF) < 16) | |
| 1286 | + strbuf.append("0");
| |
| 1287 | + | |
| 1288 | + strbuf.append(Long.toString(raw[offset + i] & 0xFF, 16)); | |
| 1289 | + } | |
| 1290 | + return strbuf.toString(); | |
| 1291 | + } | |
| 1292 | + | |
| 1293 | + public static int bytesToInt(final byte[] array, int offset) | |
| 1294 | + {
| |
| 1295 | + return (array[offset++] & 0xFF) | (array[offset++] & 0xFF) << 8 | (array[offset++] & 0xFF) << 16 | (array[offset++] & 0xFF) << 24; | |
| 1296 | + } | |
| 1297 | + | |
| 1298 | + public static String asHwidString(final String hex) | |
| 1299 | + {
| |
| 1300 | + final byte[] buf = asByteArray(hex); | |
| 1301 | + return asHex(buf); | |
| 1302 | + } | |
| 1303 | + | |
| 1304 | + public static byte[] asByteArray(final String hex) | |
| 1305 | + {
| |
| 1306 | + final byte[] buf = new byte[hex.length() / 2]; | |
| 1307 | + for (int i = 0; i < hex.length(); i += 2) | |
| 1308 | + {
| |
| 1309 | + final int j = Integer.parseInt(hex.substring(i, i + 2), 16); | |
| 1310 | + buf[i / 2] = (byte)(j & 0xFF); | |
| 1311 | + } | |
| 1312 | - | diff --git a/aCis_gameserver/java/hwid/hwidmanager/hwidInfoList.java b/aCis_gameserver/java/hwid/hwidmanager/hwidInfoList.java |
| 1312 | + | |
| 1313 | - | new file mode 100644 |
| 1313 | + | |
| 1314 | - | index 0000000000000000000000000000000000000000..d1ac4ddf17c6e09f1bac360bf6391ddccaeea5e1 |
| 1314 | + | |
| 1315 | - | --- /dev/null |
| 1315 | + | |
| 1316 | - | +++ b/aCis_gameserver/java/hwid/hwidmanager/hwidInfoList.java |
| 1316 | + | |
| 1317 | + if ((size & 0x3) == 0x0 && size > 4) | |
| 1318 | + {
| |
| 1319 | + long chksum = 0L; | |
| 1320 | + final int count = size - 4; | |
| 1321 | + for (int i2 = offset; i2 < count; i2 += 4) | |
| 1322 | + {
| |
| 1323 | + chksum ^= bytesToInt(raw, i2); | |
| 1324 | + } | |
| 1325 | + final long check = bytesToInt(raw, count); | |
| 1326 | + return check == chksum; | |
| 1327 | + } | |
| 1328 | + return false; | |
| 1329 | + } | |
| 1330 | +} | |
| 1331 | \ No newline at end of file | |
| 1332 | Index: java/hwid/crypt/FirstKey.java | |
| 1333 | =================================================================== | |
| 1334 | --- java/hwid/crypt/FirstKey.java (nonexistent) | |
| 1335 | +++ java/hwid/crypt/FirstKey.java (working copy) | |
| 1336 | @@ -0,0 +1,29 @@ | |
| 1337 | +package hwid.crypt; | |
| 1338 | + | |
| 1339 | +import net.sf.l2j.commons.logging.CLogger; | |
| 1340 | + | |
| 1341 | +import net.sf.l2j.Config; | |
| 1342 | + | |
| 1343 | +public class FirstKey | |
| 1344 | +{
| |
| 1345 | + protected static CLogger LOGGER = new CLogger(FirstKey.class.getName()); | |
| 1346 | + private static final byte[] TKBOX = new byte[] { -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 };
| |
| 1347 | + private static final byte[] MGBOX = new byte[] { -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 };
| |
| 1348 | + public static final byte[] SKBOX = new byte[] { Config.FST_KEY, Config.SCN_KEY, 2, 15, -5, 17, 24, 23, 18, 45, 1, 21, 122, 16, Config.ANP_KEY, Config.ULT_KEY };
| |
| 1349 | + | |
| 1350 | + public static byte[] expandKey(final byte[] key, final int size) | |
| 1351 | + {
| |
| 1352 | + final byte[] P = new byte[64]; | |
| 1353 | + for (int i = 0; i < 64; ++i) | |
| 1354 | + {
| |
| 1355 | + P[i] = key[i % size]; | |
| 1356 | + } | |
| 1357 | + for (int i = 0; i < 256; ++i) | |
| 1358 | + {
| |
| 1359 | + final byte t = P[i % 64]; | |
| 1360 | + final byte m = (byte)((MGBOX[MGBOX[t & 0xFF] & 0xFF] & 0xFF) ^ (TKBOX[TKBOX[i] & 0xFF] & 0xFF)); | |
| 1361 | + P[i % 64] = TKBOX[m & 0xFF]; | |
| 1362 | + } | |
| 1363 | + return P; | |
| 1364 | + } | |
| 1365 | +} | |
| 1366 | Index: java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java | |
| 1367 | =================================================================== | |
| 1368 | --- java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java (revision 15) | |
| 1369 | +++ java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java (working copy) | |
| 1370 | @@ -55,6 +55,8 @@ | |
| 1371 | import net.sf.l2j.gameserver.skills.L2Skill; | |
| 1372 | import net.sf.l2j.gameserver.taskmanager.GameTimeTaskManager; | |
| 1373 | ||
| 1374 | +import hwid.hwid; | |
| 1375 | + | |
| 1376 | public class EnterWorld extends L2GameClientPacket | |
| 1377 | {
| |
| 1378 | @Override | |
| 1379 | @@ -301,6 +303,8 @@ | |
| 1380 | if (qs != null) | |
| 1381 | qs.getQuest().notifyEvent("UC", null, player);
| |
| 1382 | ||
| 1383 | + hwid.enterlog(player, getClient()); | |
| 1384 | + | |
| 1385 | player.sendPacket(ActionFailed.STATIC_PACKET); | |
| 1386 | } | |
| 1387 | ||
| 1388 | Index: java/hwid/crypt/ProtectionCrypt.java | |
| 1389 | =================================================================== | |
| 1390 | --- java/hwid/crypt/ProtectionCrypt.java (nonexistent) | |
| 1391 | +++ java/hwid/crypt/ProtectionCrypt.java (working copy) | |
| 1392 | @@ -0,0 +1,8 @@ | |
| 1393 | +package hwid.crypt; | |
| 1394 | + | |
| 1395 | +public interface ProtectionCrypt | |
| 1396 | +{
| |
| 1397 | - | diff --git a/aCis_gameserver/java/hwid/hwidmanager/hwidManager.java b/aCis_gameserver/java/hwid/hwidmanager/hwidManager.java |
| 1397 | + | |
| 1398 | - | new file mode 100644 |
| 1398 | + | |
| 1399 | - | index 0000000000000000000000000000000000000000..589f90566c57b0d63ecd05de36de83f433a52bcb |
| 1399 | + | |
| 1400 | - | --- /dev/null |
| 1400 | + | |
| 1401 | - | +++ b/aCis_gameserver/java/hwid/hwidmanager/hwidManager.java |
| 1401 | + | Index: java/hwid/crypt/impl/L2Client.java |
| 1402 | =================================================================== | |
| 1403 | --- java/hwid/crypt/impl/L2Client.java (nonexistent) | |
| 1404 | +++ java/hwid/crypt/impl/L2Client.java (working copy) | |
| 1405 | @@ -0,0 +1,50 @@ | |
| 1406 | +package hwid.crypt.impl; | |
| 1407 | + | |
| 1408 | +import hwid.crypt.ProtectionCrypt; | |
| 1409 | + | |
| 1410 | +public class L2Client implements ProtectionCrypt | |
| 1411 | +{
| |
| 1412 | + private ProtectionCrypt _client; | |
| 1413 | + private byte[] _key; | |
| 1414 | + private byte[] _iv; | |
| 1415 | + | |
| 1416 | + public L2Client() | |
| 1417 | + {
| |
| 1418 | + _key = new byte[16]; | |
| 1419 | + _iv = null; | |
| 1420 | + } | |
| 1421 | + | |
| 1422 | + @Override | |
| 1423 | + public void setup(final byte[] key, final byte[] iv) | |
| 1424 | + {
| |
| 1425 | + System.arraycopy(key, 0, this._key, 0, 16); | |
| 1426 | + _iv = iv; | |
| 1427 | + } | |
| 1428 | + | |
| 1429 | + @Override | |
| 1430 | + public void crypt(final byte[] raw, final int offset, final int size) | |
| 1431 | + {
| |
| 1432 | + if (_iv != null) | |
| 1433 | + {
| |
| 1434 | + (_client = new VMPC()).setup(_key, _iv); | |
| 1435 | + _client.crypt(raw, offset, size); | |
| 1436 | + } | |
| 1437 | + int temp = 0; | |
| 1438 | + int temp2 = 0; | |
| 1439 | + for (int i = 0; i < size; ++i) | |
| 1440 | + {
| |
| 1441 | + temp2 = (raw[offset + i] & 0xFF); | |
| 1442 | + raw[offset + i] = (byte)(temp2 ^ _key[i & 0xF] ^ temp); | |
| 1443 | + temp = temp2; | |
| 1444 | + } | |
| 1445 | + int old = _key[8] & 0xFF; | |
| 1446 | + old |= (_key[9] << 8 & 0xFF00); | |
| 1447 | + old |= (_key[10] << 16 & 0xFF0000); | |
| 1448 | + old |= (_key[11] << 24 & 0xFF000000); | |
| 1449 | + old += size; | |
| 1450 | + _key[8] = (byte)(old & 0xFF); | |
| 1451 | + _key[9] = (byte)(old >> 8 & 0xFF); | |
| 1452 | + _key[10] = (byte)(old >> 16 & 0xFF); | |
| 1453 | + _key[11] = (byte)(old >> 24 & 0xFF); | |
| 1454 | + } | |
| 1455 | +} | |
| 1456 | \ No newline at end of file | |
| 1457 | Index: java/hwid/crypt/impl/L2Server.java | |
| 1458 | =================================================================== | |
| 1459 | --- java/hwid/crypt/impl/L2Server.java (nonexistent) | |
| 1460 | +++ java/hwid/crypt/impl/L2Server.java (working copy) | |
| 1461 | @@ -0,0 +1,49 @@ | |
| 1462 | +package hwid.crypt.impl; | |
| 1463 | + | |
| 1464 | +import hwid.crypt.ProtectionCrypt; | |
| 1465 | + | |
| 1466 | +public class L2Server implements ProtectionCrypt | |
| 1467 | +{
| |
| 1468 | + private byte[] _key; | |
| 1469 | + private byte[] _iv; | |
| 1470 | + private ProtectionCrypt _server; | |
| 1471 | + | |
| 1472 | + public L2Server() | |
| 1473 | + {
| |
| 1474 | + _key = new byte[16]; | |
| 1475 | + _iv = null; | |
| 1476 | + } | |
| 1477 | + | |
| 1478 | + @Override | |
| 1479 | + public void setup(final byte[] key, final byte[] iv) | |
| 1480 | + {
| |
| 1481 | + System.arraycopy(key, 0, this._key, 0, 16); | |
| 1482 | + _iv = iv; | |
| 1483 | + } | |
| 1484 | + | |
| 1485 | + @Override | |
| 1486 | + public void crypt(final byte[] raw, final int offset, final int size) | |
| 1487 | + {
| |
| 1488 | + int temp = 0; | |
| 1489 | + for (int i = 0; i < size; ++i) | |
| 1490 | + {
| |
| 1491 | + final int temp2 = raw[offset + i] & 0xFF; | |
| 1492 | + temp ^= (temp2 ^ _key[i & 0xF]); | |
| 1493 | + raw[offset + i] = (byte)temp; | |
| 1494 | + } | |
| 1495 | + int old = _key[8] & 0xFF; | |
| 1496 | + old |= (_key[9] << 8 & 0xFF00); | |
| 1497 | + old |= (_key[10] << 16 & 0xFF0000); | |
| 1498 | + old |= (_key[11] << 24 & 0xFF000000); | |
| 1499 | + old += size; | |
| 1500 | + _key[8] = (byte)(old & 0xFF); | |
| 1501 | + _key[9] = (byte)(old >> 8 & 0xFF); | |
| 1502 | + _key[10] = (byte)(old >> 16 & 0xFF); | |
| 1503 | + _key[11] = (byte)(old >> 24 & 0xFF); | |
| 1504 | + if (_iv != null) | |
| 1505 | + {
| |
| 1506 | + (_server = new VMPC()).setup(_key, _iv); | |
| 1507 | + _server.crypt(raw, offset, size); | |
| 1508 | + } | |
| 1509 | + } | |
| 1510 | +} | |
| 1511 | \ No newline at end of file | |
| 1512 | Index: java/hwid/hwid.java | |
| 1513 | =================================================================== | |
| 1514 | --- java/hwid/hwid.java (nonexistent) | |
| 1515 | +++ java/hwid/hwid.java (working copy) | |
| 1516 | @@ -0,0 +1,268 @@ | |
| 1517 | +package hwid; | |
| 1518 | + | |
| 1519 | +import java.io.IOException; | |
| 1520 | +import java.nio.ByteBuffer; | |
| 1521 | - | diff --git a/aCis_gameserver/java/hwid/hwidmanager/hwidPlayer.java b/aCis_gameserver/java/hwid/hwidmanager/hwidPlayer.java |
| 1521 | + | |
| 1522 | - | new file mode 100644 |
| 1522 | + | |
| 1523 | - | index 0000000000000000000000000000000000000000..dd14367b4620760145e6b2792d82fe17243e6835 |
| 1523 | + | |
| 1524 | - | --- /dev/null |
| 1524 | + | |
| 1525 | - | +++ b/aCis_gameserver/java/hwid/hwidmanager/hwidPlayer.java |
| 1525 | + | |
| 1526 | +import net.sf.l2j.gameserver.model.World; | |
| 1527 | +import net.sf.l2j.gameserver.model.actor.Player; | |
| 1528 | +import net.sf.l2j.gameserver.network.GameClient; | |
| 1529 | +import net.sf.l2j.gameserver.network.serverpackets.ServerClose; | |
| 1530 | + | |
| 1531 | +import hwid.crypt.BlowfishEngine; | |
| 1532 | +import hwid.crypt.FirstKey; | |
| 1533 | +import hwid.crypt.Manager; | |
| 1534 | +import hwid.hwidmanager.hwidBan; | |
| 1535 | +import hwid.hwidmanager.hwidPlayer; | |
| 1536 | +import hwid.hwidmanager.hwidManager; | |
| 1537 | +import hwid.utils.HwidLog; | |
| 1538 | +import hwid.utils.Util; | |
| 1539 | + | |
| 1540 | +public class hwid | |
| 1541 | +{
| |
| 1542 | + protected static CLogger LOGGER = new CLogger(hwid.class.getName()); | |
| 1543 | + private static byte[] _key = new byte[16]; | |
| 1544 | + static byte version = 11; | |
| 1545 | + protected static ConcurrentHashMap<String, Manager.InfoSet> _objects = new ConcurrentHashMap<>(); | |
| 1546 | + | |
| 1547 | + public static void Init() | |
| 1548 | + {
| |
| 1549 | + if (isProtectionOn()) | |
| 1550 | + {
| |
| 1551 | + hwidBan.getInstance(); | |
| 1552 | + hwidPlayer.getInstance(); | |
| 1553 | + Manager.getInstance(); | |
| 1554 | + hwidManager.getInstance(); | |
| 1555 | + } | |
| 1556 | + } | |
| 1557 | + | |
| 1558 | + public static boolean isProtectionOn() | |
| 1559 | + {
| |
| 1560 | + return Config.ALLOW_GUARD_SYSTEM; | |
| 1561 | + } | |
| 1562 | + | |
| 1563 | + public static byte[] getKey(final byte[] key) | |
| 1564 | + {
| |
| 1565 | + final byte[] bfkey = FirstKey.SKBOX; | |
| 1566 | + try | |
| 1567 | + {
| |
| 1568 | + final BlowfishEngine bf = new BlowfishEngine(); | |
| 1569 | + bf.init(true, bfkey); | |
| 1570 | + bf.processBlock(key, 0, _key, 0); | |
| 1571 | + bf.processBlock(key, 8, _key, 8); | |
| 1572 | + } | |
| 1573 | + catch (IOException e) | |
| 1574 | + {
| |
| 1575 | + LOGGER.warn("HWID: Bad key!!!");
| |
| 1576 | + } | |
| 1577 | + return _key; | |
| 1578 | + } | |
| 1579 | + | |
| 1580 | + public static void addPlayer(final GameClient client) | |
| 1581 | + {
| |
| 1582 | + if (isProtectionOn() && client != null) | |
| 1583 | + Manager.getInstance().addPlayer(client); | |
| 1584 | + } | |
| 1585 | + | |
| 1586 | + public static void removePlayer(final GameClient client) | |
| 1587 | + {
| |
| 1588 | + if (isProtectionOn() && client != null) | |
| 1589 | + Manager.removePlayer(client.getPlayerName()); | |
| 1590 | + } | |
| 1591 | + | |
| 1592 | + public static boolean checkVerfiFlag(final GameClient client, final int flag) | |
| 1593 | + {
| |
| 1594 | + boolean result = true; | |
| 1595 | + final int fl = Integer.reverseBytes(flag); | |
| 1596 | + if (fl == -1) | |
| 1597 | + {
| |
| 1598 | + return false; | |
| 1599 | + } | |
| 1600 | + if (fl == 1342177280) | |
| 1601 | + {
| |
| 1602 | + return false; | |
| 1603 | + } | |
| 1604 | + if ((fl & 0x1) != 0x0) | |
| 1605 | + {
| |
| 1606 | + result = false; | |
| 1607 | + } | |
| 1608 | + if ((fl & 0x10) != 0x0) | |
| 1609 | + {
| |
| 1610 | + result = false; | |
| 1611 | + } | |
| 1612 | + if ((fl & 0x10000000) != 0x0) | |
| 1613 | + {
| |
| 1614 | + result = false; | |
| 1615 | + } | |
| 1616 | + return result; | |
| 1617 | + } | |
| 1618 | + | |
| 1619 | + public static int dumpData(final int _id, int position, final GameClient pi) | |
| 1620 | + {
| |
| 1621 | + int value = 0; | |
| 1622 | + position = ((position > 4) ? 5 : position); | |
| 1623 | + boolean isIdZero = false; | |
| 1624 | + if (_id == 0) | |
| 1625 | + {
| |
| 1626 | + isIdZero = true; | |
| 1627 | + } | |
| 1628 | + switch (position) | |
| 1629 | + {
| |
| 1630 | + case 0: | |
| 1631 | + {
| |
| 1632 | + if (_id != 1435233386) | |
| 1633 | + {
| |
| 1634 | + if (!isIdZero) {}
| |
| 1635 | + value = 1; | |
| 1636 | + break; | |
| 1637 | + } | |
| 1638 | + break; | |
| 1639 | + } | |
| 1640 | + case 1: | |
| 1641 | + {
| |
| 1642 | + if (_id != 16) | |
| 1643 | + {
| |
| 1644 | + if (!isIdZero) {}
| |
| 1645 | + value = 2; | |
| 1646 | + break; | |
| 1647 | + } | |
| 1648 | + break; | |
| 1649 | + } | |
| 1650 | + case 2: | |
| 1651 | + case 3: | |
| 1652 | + case 4: | |
| 1653 | + {
| |
| 1654 | + final int code = _id & 0xFF000000; | |
| 1655 | + if (code == 204) {}
| |
| 1656 | + if (code == 233) | |
| 1657 | + {
| |
| 1658 | + value = 3; | |
| 1659 | + break; | |
| 1660 | + } | |
| 1661 | + break; | |
| 1662 | + } | |
| 1663 | + default: | |
| 1664 | + {
| |
| 1665 | + value = 0; | |
| 1666 | + break; | |
| 1667 | + } | |
| 1668 | + } | |
| 1669 | + return value; | |
| 1670 | + } | |
| 1671 | + | |
| 1672 | + public static int calcPenalty(final byte[] data, final GameClient pi) | |
| 1673 | + {
| |
| 1674 | + int sum = -1; | |
| 1675 | + if (Util.verifyChecksum(data, 0, data.length)) | |
| 1676 | + {
| |
| 1677 | + final ByteBuffer buf = ByteBuffer.wrap(data, 0, data.length - 4); | |
| 1678 | + sum = 0; | |
| 1679 | + for (int lenPenalty = (data.length - 4) / 4, i = 0; i < lenPenalty; ++i) | |
| 1680 | + {
| |
| 1681 | + sum += dumpData(buf.getInt(), i, pi); | |
| 1682 | + } | |
| 1683 | + } | |
| 1684 | + return sum; | |
| 1685 | + } | |
| 1686 | + | |
| 1687 | + public static boolean CheckHWIDs(final GameClient client, final int LastError1, final int LastError2) | |
| 1688 | + {
| |
| 1689 | + boolean resultHWID = false; | |
| 1690 | + boolean resultLastError = false; | |
| 1691 | + final String HWID = client.getHWID(); | |
| 1692 | + if (HWID.equalsIgnoreCase("fab888b1cc9de973c8046519fa841e6") && Config.PROTECT_KICK_WITH_EMPTY_HWID)
| |
| 1693 | + {
| |
| 1694 | + resultHWID = true; | |
| 1695 | + } | |
| 1696 | + if (LastError1 != 0 && Config.PROTECT_KICK_WITH_LASTERROR_HWID) | |
| 1697 | + {
| |
| 1698 | + resultLastError = true; | |
| 1699 | + } | |
| 1700 | + return resultHWID || resultLastError; | |
| 1701 | + } | |
| 1702 | + | |
| 1703 | + public static String fillHex(final int data, final int digits) | |
| 1704 | + {
| |
| 1705 | + String number = Integer.toHexString(data); | |
| 1706 | + for (int i = number.length(); i < digits; ++i) | |
| 1707 | + {
| |
| 1708 | + number = "0" + number; | |
| 1709 | + } | |
| 1710 | + return number; | |
| 1711 | + } | |
| 1712 | + | |
| 1713 | + public static String ExtractHWID(final byte[] _data) | |
| 1714 | + {
| |
| 1715 | + if (!Util.verifyChecksum(_data, 0, _data.length)) | |
| 1716 | + {
| |
| 1717 | + return null; | |
| 1718 | + } | |
| 1719 | + final StringBuilder resultHWID = new StringBuilder(); | |
| 1720 | + for (int i = 0; i < _data.length - 8; ++i) | |
| 1721 | + {
| |
| 1722 | + resultHWID.append(fillHex(_data[i] & 0xFF, 2)); | |
| 1723 | + } | |
| 1724 | + return resultHWID.toString(); | |
| 1725 | + } | |
| 1726 | + | |
| 1727 | - | diff --git a/aCis_gameserver/java/hwid/utils/HwidLog.java b/aCis_gameserver/java/hwid/utils/HwidLog.java |
| 1727 | + | |
| 1728 | - | new file mode 100644 |
| 1728 | + | |
| 1729 | - | index 0000000000000000000000000000000000000000..9c7cef65ca4cb2acb97aba3d4144428bc0e6c84c |
| 1729 | + | |
| 1730 | - | --- /dev/null |
| 1730 | + | |
| 1731 | - | +++ b/aCis_gameserver/java/hwid/utils/HwidLog.java |
| 1731 | + | |
| 1732 | + client.setLoginName(loginName); | |
| 1733 | + final String fullHWID = ExtractHWID(data); | |
| 1734 | + if (fullHWID == null) | |
| 1735 | + {
| |
| 1736 | + LOGGER.warn("AuthLogin CRC Check Fail! May be BOT or unprotected client! Client IP: " + client.toString());
| |
| 1737 | + client.close(ServerClose.STATIC_PACKET); | |
| 1738 | + return false; | |
| 1739 | + } | |
| 1740 | + final int LastError1 = ByteBuffer.wrap(data, 16, 4).getInt(); | |
| 1741 | + if (CheckHWIDs(client, LastError1, 0)) | |
| 1742 | + {
| |
| 1743 | + LOGGER.warn("HWID error, look protection_logs.txt file, from IP: " + client.toString());
| |
| 1744 | + client.close(ServerClose.STATIC_PACKET); | |
| 1745 | + return false; | |
| 1746 | + } | |
| 1747 | + if (hwidBan.getInstance().checkFullHWIDBanned(client)) | |
| 1748 | + {
| |
| 1749 | + LOGGER.warn("Client " + client + " is banned. Kicked! |HWID: " + client.getHWID() + " IP: " + client.toString());
| |
| 1750 | + client.close(ServerClose.STATIC_PACKET); | |
| 1751 | + } | |
| 1752 | + final int VerfiFlag = ByteBuffer.wrap(data, 40, 4).getInt(); | |
| 1753 | + return checkVerfiFlag(client, VerfiFlag); | |
| 1754 | + } | |
| 1755 | + | |
| 1756 | + public static void doDisconection(final GameClient client) | |
| 1757 | + {
| |
| 1758 | + removePlayer(client); | |
| 1759 | + } | |
| 1760 | + | |
| 1761 | + public static boolean checkPlayerWithHWID(final GameClient client, final int playerID, final String playerName) | |
| 1762 | + {
| |
| 1763 | + if (!isProtectionOn()) | |
| 1764 | + return true; | |
| 1765 | + | |
| 1766 | + client.setPlayerName(playerName); | |
| 1767 | + client.setPlayerId(playerID); | |
| 1768 | + addPlayer(client); | |
| 1769 | + return true; | |
| 1770 | + } | |
| 1771 | + | |
| 1772 | + public static void nopath(final GameClient client) | |
| 1773 | + {
| |
| 1774 | + LOGGER.warn("HWID: " + client.toString() + " is trying to loggin server without client side hwid.");
| |
| 1775 | + client.close(ServerClose.STATIC_PACKET); | |
| 1776 | + } | |
| 1777 | + | |
| 1778 | + public static void enterlog(final Player player, final GameClient client) | |
| 1779 | + {
| |
| 1780 | + hwidManager.getInstance().validBox(player, Config.PROTECT_WINDOWS_COUNT + 1, World.getInstance().getPlayers(), true); | |
| 1781 | + LOGGER.info("HWID: [" + client.getHWID() + "], character: [" + player.getName() + "]");
| |
| 1782 | + HwidLog.auditGMAction(player.getHWid(), player.getName()); | |
| 1783 | + } | |
| 1784 | +} | |
| 1785 | \ No newline at end of file | |
| 1786 | Index: java/net/sf/l2j/gameserver/network/clientpackets/AuthLogin.java | |
| 1787 | - | diff --git a/aCis_gameserver/java/hwid/utils/Util.java b/aCis_gameserver/java/hwid/utils/Util.java |
| 1787 | + | =================================================================== |
| 1788 | - | new file mode 100644 |
| 1788 | + | --- java/net/sf/l2j/gameserver/network/clientpackets/AuthLogin.java (revision 15) |
| 1789 | - | index 0000000000000000000000000000000000000000..2a9176c77243bbfc3ddf60352c72ef6315f2ccd2 |
| 1789 | + | +++ java/net/sf/l2j/gameserver/network/clientpackets/AuthLogin.java (working copy) |
| 1790 | - | --- /dev/null |
| 1790 | + | @@ -3,6 +3,8 @@ |
| 1791 | - | +++ b/aCis_gameserver/java/hwid/utils/Util.java |
| 1791 | + | |
| 1792 | import net.sf.l2j.gameserver.network.SessionKey; | |
| 1793 | ||
| 1794 | +import hwid.hwid; | |
| 1795 | + | |
| 1796 | public final class AuthLogin extends L2GameClientPacket | |
| 1797 | {
| |
| 1798 | private String _loginName; | |
| 1799 | @@ -10,6 +12,7 @@ | |
| 1800 | private int _playKey2; | |
| 1801 | private int _loginKey1; | |
| 1802 | private int _loginKey2; | |
| 1803 | + private final byte[] _data = new byte[48]; | |
| 1804 | ||
| 1805 | @Override | |
| 1806 | protected void readImpl() | |
| 1807 | @@ -24,6 +27,12 @@ | |
| 1808 | @Override | |
| 1809 | protected void runImpl() | |
| 1810 | {
| |
| 1811 | + if (hwid.isProtectionOn()) | |
| 1812 | + {
| |
| 1813 | + if (!hwid.doAuthLogin(getClient(), _data, _loginName)) | |
| 1814 | + return; | |
| 1815 | + } | |
| 1816 | + | |
| 1817 | if (getClient().getAccountName() != null) | |
| 1818 | return; | |
| 1819 | ||
| 1820 | Index: java/net/sf/l2j/gameserver/network/GameClient.java | |
| 1821 | =================================================================== | |
| 1822 | --- java/net/sf/l2j/gameserver/network/GameClient.java (revision 15) | |
| 1823 | +++ java/net/sf/l2j/gameserver/network/GameClient.java (working copy) | |
| 1824 | @@ -33,6 +33,8 @@ | |
| 1825 | import net.sf.l2j.gameserver.network.serverpackets.L2GameServerPacket; | |
| 1826 | import net.sf.l2j.gameserver.network.serverpackets.ServerClose; | |
| 1827 | ||
| 1828 | +import hwid.hwid; | |
| 1829 | + | |
| 1830 | /** | |
| 1831 | * Represents a client connected on Game Server.<br> | |
| 1832 | * <br> | |
| 1833 | @@ -264,6 +266,10 @@ | |
| 1834 | {
| |
| 1835 | byte[] key = BlowFishKeygen.getRandomKey(); | |
| 1836 | _crypt.setKey(key); | |
| 1837 | + if (hwid.isProtectionOn()) | |
| 1838 | + {
| |
| 1839 | + key = hwid.getKey(key); | |
| 1840 | + } | |
| 1841 | return key; | |
| 1842 | } | |
| 1843 | ||
| 1844 | @@ -630,6 +636,7 @@ | |
| 1845 | return; | |
| 1846 | ||
| 1847 | getConnection().close(gsp); | |
| 1848 | + hwid.removePlayer(null); | |
| 1849 | } | |
| 1850 | ||
| 1851 | /** | |
| 1852 | @@ -821,4 +828,72 @@ | |
| 1853 | return true; | |
| 1854 | } | |
| 1855 | } | |
| 1856 | + | |
| 1857 | + // HWID | |
| 1858 | + private String _playerName; | |
| 1859 | + private String _loginName; | |
| 1860 | + private int _playerId; | |
| 1861 | + private int _count; | |
| 1862 | + private String _hwid; | |
| 1863 | + private int _revision; | |
| 1864 | + | |
| 1865 | + public final String getPlayerName() | |
| 1866 | + {
| |
| 1867 | - | diff --git a/aCis_gameserver/java/net/sf/l2j/Config.java b/aCis_gameserver/java/net/sf/l2j/Config.java |
| 1867 | + | |
| 1868 | - | index f4f4028b80ee36afaa03ce3272c90865c6e06895..1b3a59f6838be39a817f3238443a1b08b97b06b1 100644 |
| 1868 | + | |
| 1869 | - | --- a/aCis_gameserver/java/net/sf/l2j/Config.java |
| 1869 | + | |
| 1870 | - | +++ b/aCis_gameserver/java/net/sf/l2j/Config.java |
| 1870 | + | |
| 1871 | - | @@ -25,6 +25,8 @@ import net.sf.l2j.commons.math.MathUtil; |
| 1871 | + | |
| 1872 | - | import net.sf.l2j.gameserver.enums.GeoType; |
| 1872 | + | |
| 1873 | + } | |
| 1874 | + | |
| 1875 | + public void setPlayerId(int plId) | |
| 1876 | + {
| |
| 1877 | + _playerId = plId; | |
| 1878 | + } | |
| 1879 | + | |
| 1880 | - | @@ -47,6 +49,7 @@ public final class Config |
| 1880 | + | |
| 1881 | + {
| |
| 1882 | + return _playerId; | |
| 1883 | + } | |
| 1884 | + | |
| 1885 | + public int getCount() | |
| 1886 | + {
| |
| 1887 | + return _count; | |
| 1888 | - | @@ -951,6 +954,25 @@ public final class Config |
| 1888 | + | |
| 1889 | - | public static int CKM_PK_NPC_TITLE_COLOR; |
| 1889 | + | |
| 1890 | - | public static int CKM_PK_NPC_NAME_COLOR; |
| 1890 | + | |
| 1891 | + {
| |
| 1892 | - | + /** hwid settings */ |
| 1892 | + | |
| 1893 | - | + public static final boolean PROTECT_DEBUG = false; |
| 1893 | + | |
| 1894 | - | + public static final boolean PROTECT_ENABLE_HWID_LOCK = false; |
| 1894 | + | |
| 1895 | - | + public static byte[] GUARD_CLIENT_CRYPT_KEY; |
| 1895 | + | |
| 1896 | - | + public static byte[] GUARD_CLIENT_CRYPT; |
| 1896 | + | |
| 1897 | - | + public static byte[] GUARD_SERVER_CRYPT_KEY; |
| 1897 | + | |
| 1898 | - | + public static byte[] GUARD_SERVER_CRYPT; |
| 1898 | + | |
| 1899 | - | + public static boolean ALLOW_GUARD_SYSTEM; |
| 1899 | + | |
| 1900 | - | + public static int PROTECT_WINDOWS_COUNT; |
| 1900 | + | |
| 1901 | - | + public static int GET_CLIENT_HWID; |
| 1901 | + | |
| 1902 | - | + public static boolean ENABLE_CONSOLE_LOG; |
| 1902 | + | |
| 1903 | - | + public static boolean PROTECT_KICK_WITH_EMPTY_HWID; |
| 1903 | + | |
| 1904 | - | + public static boolean PROTECT_KICK_WITH_LASTERROR_HWID; |
| 1904 | + | |
| 1905 | - | + public static byte FST_KEY = 110; |
| 1905 | + | |
| 1906 | - | + public static byte SCN_KEY = 36; |
| 1906 | + | |
| 1907 | - | + public static byte ANP_KEY = -5; |
| 1907 | + | |
| 1908 | - | + public static byte ULT_KEY = 12; |
| 1908 | + | |
| 1909 | - | + public static int NPROTECT_KEY = -1; |
| 1909 | + | |
| 1910 | + public int getRevision() | |
| 1911 | + {
| |
| 1912 | + return _revision; | |
| 1913 | + } | |
| 1914 | - | @@ -2480,7 +2502,7 @@ public final class Config |
| 1914 | + | |
| 1915 | + public final String getLoginName() | |
| 1916 | + {
| |
| 1917 | + return _loginName; | |
| 1918 | + } | |
| 1919 | + | |
| 1920 | + public void setLoginName(String name) | |
| 1921 | + {
| |
| 1922 | + _loginName = name; | |
| 1923 | - | @@ -2784,6 +2806,40 @@ public final class Config |
| 1923 | + | |
| 1924 | - | CKM_PK_NPC_NAME_COLOR = Integer.decode("0x" + rusacis.getProperty("CKMPKNpcNameColor", "FFFFFF"));
|
| 1924 | + | |
| 1925 | \ No newline at end of file | |
| 1926 | Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestGameStart.java | |
| 1927 | - | + /** |
| 1927 | + | =================================================================== |
| 1928 | --- java/net/sf/l2j/gameserver/network/clientpackets/RequestGameStart.java (revision 15) | |
| 1929 | +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestGameStart.java (working copy) | |
| 1930 | @@ -8,6 +8,8 @@ | |
| 1931 | import net.sf.l2j.gameserver.network.serverpackets.CharSelected; | |
| 1932 | import net.sf.l2j.gameserver.network.serverpackets.SSQInfo; | |
| 1933 | ||
| 1934 | +import hwid.hwid; | |
| 1935 | + | |
| 1936 | public class RequestGameStart extends L2GameClientPacket | |
| 1937 | {
| |
| 1938 | private int _slot; | |
| 1939 | @@ -52,6 +54,9 @@ | |
| 1940 | ||
| 1941 | sendPacket(SSQInfo.sendSky()); | |
| 1942 | ||
| 1943 | + if (!hwid.checkPlayerWithHWID(getClient(), player.getObjectId(), player.getName())) | |
| 1944 | + return; | |
| 1945 | + | |
| 1946 | client.setState(GameClientState.ENTERING); | |
| 1947 | ||
| 1948 | sendPacket(new CharSelected(player, client.getSessionId().playOkID1)); | |
| 1949 | Index: java/net/sf/l2j/Config.java | |
| 1950 | =================================================================== | |
| 1951 | --- java/net/sf/l2j/Config.java (revision 15) | |
| 1952 | +++ java/net/sf/l2j/Config.java (working copy) | |
| 1953 | @@ -24,6 +24,8 @@ | |
| 1954 | import net.sf.l2j.gameserver.model.holder.IntIntHolder; | |
| 1955 | import net.sf.l2j.gameserver.model.olympiad.enums.OlympiadPeriod; | |
| 1956 | ||
| 1957 | +import hwid.crypt.FirstKey; | |
| 1958 | + | |
| 1959 | /** | |
| 1960 | * This class contains global server configuration.<br> | |
| 1961 | * It has static final fields initialized from configuration files. | |
| 1962 | @@ -46,6 +48,7 @@ | |
| 1963 | public static final String RUS_ACIS_FILE = "./config/rus_acis.properties"; | |
| 1964 | - | @@ -2852,6 +2908,9 @@ public final class Config |
| 1964 | + | |
| 1965 | public static final String SIEGE_FILE = "./config/siege.properties"; | |
| 1966 | + public static final String HWID_FILE = "./config/hwid.properties"; | |
| 1967 | ||
| 1968 | // -------------------------------------------------- | |
| 1969 | // Clans settings | |
| 1970 | @@ -741,6 +744,26 @@ | |
| 1971 | public static int BUY_PREMIUM_DAYS_28; | |
| 1972 | public static int BUY_PREMIUM_DAYS_28_PRICE; | |
| 1973 | ||
| 1974 | - | diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/GameServer.java b/aCis_gameserver/java/net/sf/l2j/gameserver/GameServer.java |
| 1974 | + | + /** hwid settings */ |
| 1975 | - | index 58e8f4179b1a396933c21751d0b048516d14752b..5f2bbd08279275ca8ec59a695ef78740ae5700e1 100644 |
| 1975 | + | |
| 1976 | - | --- a/aCis_gameserver/java/net/sf/l2j/gameserver/GameServer.java |
| 1976 | + | + public static final boolean PROTECT_DEBUG = false; |
| 1977 | - | +++ b/aCis_gameserver/java/net/sf/l2j/gameserver/GameServer.java |
| 1977 | + | + public static final boolean PROTECT_ENABLE_HWID_LOCK = false; |
| 1978 | - | @@ -109,6 +109,8 @@ import net.sf.l2j.gameserver.taskmanager.WaterTaskManager; |
| 1978 | + | + public static byte[] GUARD_CLIENT_CRYPT_KEY; |
| 1979 | + public static byte[] GUARD_CLIENT_CRYPT; | |
| 1980 | + public static byte[] GUARD_SERVER_CRYPT_KEY; | |
| 1981 | + public static byte[] GUARD_SERVER_CRYPT; | |
| 1982 | + public static boolean ALLOW_GUARD_SYSTEM; | |
| 1983 | + public static int PROTECT_WINDOWS_COUNT; | |
| 1984 | + public static int GET_CLIENT_HWID; | |
| 1985 | + public static boolean ENABLE_CONSOLE_LOG; | |
| 1986 | + public static boolean PROTECT_KICK_WITH_EMPTY_HWID; | |
| 1987 | - | @@ -317,7 +317,11 @@ public class GameServer |
| 1987 | + | + public static boolean PROTECT_KICK_WITH_LASTERROR_HWID; |
| 1988 | + public static byte FST_KEY = 110; | |
| 1989 | + public static byte SCN_KEY = 36; | |
| 1990 | + public static byte ANP_KEY = -5; | |
| 1991 | - | + if (Config.ALLOW_GUARD_SYSTEM) |
| 1991 | + | + public static byte ULT_KEY = 12; |
| 1992 | - | + hwid.Init(); |
| 1992 | + | + public static int NPROTECT_KEY = -1; |
| 1993 | - | + else |
| 1993 | + | |
| 1994 | - | + LOGGER.info("Hwid Manager is disabled.");
|
| 1994 | + | |
| 1995 | * Initialize {@link ExProperties} from specified configuration file.
| |
| 1996 | * @param filename : File name to be loaded. | |
| 1997 | @@ -1243,7 +1266,7 @@ | |
| 1998 | final ExProperties server = initProperties(SERVER_FILE); | |
| 1999 | - | diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/Player.java b/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/Player.java |
| 1999 | + | |
| 2000 | - | index 882ad47f347c94c14358e6b58d8e65fa09f2394a..7e1143b1d6f02f685101af75620733a3adad1864 100644 |
| 2000 | + | |
| 2001 | - | --- a/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/Player.java |
| 2001 | + | |
| 2002 | - | +++ b/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/Player.java |
| 2002 | + | |
| 2003 | - | @@ -513,6 +513,8 @@ public final class Player extends Playable |
| 2003 | + | |
| 2004 | - | private int _eventPoints = 0; |
| 2004 | + | |
| 2005 | - | public String _originalTitle; |
| 2005 | + | |
| 2006 | @@ -1503,6 +1526,40 @@ | |
| 2007 | } | |
| 2008 | ||
| 2009 | /** | |
| 2010 | + * Loads hwid settings.<br> | |
| 2011 | + */ | |
| 2012 | - | @@ -8061,4 +8063,13 @@ public final class Player extends Playable |
| 2012 | + | |
| 2013 | - | // Stop skill effect by ID |
| 2013 | + | |
| 2014 | - | _effects.stopSkillEffects(skill.getId()); |
| 2014 | + | |
| 2015 | + final ExProperties hwid = initProperties(HWID_FILE); | |
| 2016 | + ALLOW_GUARD_SYSTEM = hwid.getProperty("AllowGuardSystem", true);
| |
| 2017 | + PROTECT_WINDOWS_COUNT = hwid.getProperty("AllowedWindowsCount", 1);
| |
| 2018 | + | |
| 2019 | + GET_CLIENT_HWID = hwid.getProperty("UseClientHWID", 2);
| |
| 2020 | + ENABLE_CONSOLE_LOG = hwid.getProperty("EnableConsoleLog", false);
| |
| 2021 | + PROTECT_KICK_WITH_EMPTY_HWID = hwid.getProperty("KickWithEmptyHWID", false);
| |
| 2022 | + PROTECT_KICK_WITH_LASTERROR_HWID = hwid.getProperty("KickWithLastErrorHWID", false);
| |
| 2023 | + | |
| 2024 | + String key_client = "GOGX2_RB(]Slnjt15~EgyqTv%[$YR]!1E~ayK?$9[R%%m4{zoMF$D?f:zvS2q&>~";
| |
| 2025 | + String key_server = "b*qR43<9J1pD>Q4Uns6FsKao~VbU0H]y`A0ytTveiWn)SuSYsM?m*eblL!pwza!t"; | |
| 2026 | + byte[] keyS = key_server.getBytes(); | |
| 2027 | - | diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/network/GameClient.java b/aCis_gameserver/java/net/sf/l2j/gameserver/network/GameClient.java |
| 2027 | + | |
| 2028 | - | index c54a7d6c2f786c74c7700a53eb848633a93a1a7c..5cb01a724074e58876711de6b574d93261ef75da 100644 |
| 2028 | + | |
| 2029 | - | --- a/aCis_gameserver/java/net/sf/l2j/gameserver/network/GameClient.java |
| 2029 | + | |
| 2030 | - | +++ b/aCis_gameserver/java/net/sf/l2j/gameserver/network/GameClient.java |
| 2030 | + | |
| 2031 | - | @@ -35,6 +35,8 @@ import net.sf.l2j.gameserver.model.pledge.Clan; |
| 2031 | + | |
| 2032 | + System.arraycopy(keyC, 0, tmpC, 0, 32); | |
| 2033 | + GUARD_CLIENT_CRYPT_KEY = FirstKey.expandKey(tmpC, 32); | |
| 2034 | + System.arraycopy(keyC, 32, tmpC, 0, 32); | |
| 2035 | + GUARD_CLIENT_CRYPT = FirstKey.expandKey(tmpC, 32); | |
| 2036 | + | |
| 2037 | + System.arraycopy(keyS, 0, tmpS, 0, 32); | |
| 2038 | + GUARD_SERVER_CRYPT_KEY = FirstKey.expandKey(tmpS, 32); | |
| 2039 | + System.arraycopy(keyS, 32, tmpS, 0, 32); | |
| 2040 | - | @@ -232,6 +234,10 @@ public final class GameClient extends MMOClient<MMOConnection<GameClient>> |
| 2040 | + | |
| 2041 | + } | |
| 2042 | + | |
| 2043 | + /** | |
| 2044 | * Loads loginserver settings.<br> | |
| 2045 | * IP addresses, database, account, misc. | |
| 2046 | */ | |
| 2047 | @@ -1575,6 +1632,9 @@ | |
| 2048 | ||
| 2049 | // rusacis settings | |
| 2050 | loadRusAcis(); | |
| 2051 | - | @@ -577,6 +583,7 @@ public final class GameClient extends MMOClient<MMOConnection<GameClient>> |
| 2051 | + | |
| 2052 | + // hwid settings | |
| 2053 | + loadHwid(); | |
| 2054 | } | |
| 2055 | ||
| 2056 | public static final void loadLoginServer() | |
| 2057 | Index: java/hwid/crypt/ProtectionCrypt.java | |
| 2058 | =================================================================== | |
| 2059 | - | @@ -667,4 +674,72 @@ public final class GameClient extends MMOClient<MMOConnection<GameClient>> |
| 2059 | + | --- java/hwid/crypt/ProtectionCrypt.java (nonexistent) |
| 2060 | +++ java/hwid/crypt/ProtectionCrypt.java (working copy) | |
| 2061 | @@ -0,0 +1,8 @@ | |
| 2062 | +package hwid.crypt; | |
| 2063 | + | |
| 2064 | +public interface ProtectionCrypt | |
| 2065 | +{
| |
| 2066 | + void setup(final byte[] p0, final byte[] p1); | |
| 2067 | + | |
| 2068 | + void crypt(final byte[] p0, final int p1, final int p2); | |
| 2069 | +} | |
| 2070 | Index: java/net/sf/l2j/gameserver/GameServer.java | |
| 2071 | =================================================================== | |
| 2072 | --- java/net/sf/l2j/gameserver/GameServer.java (revision 15) | |
| 2073 | +++ java/net/sf/l2j/gameserver/GameServer.java (working copy) | |
| 2074 | @@ -106,6 +106,8 @@ | |
| 2075 | import net.sf.l2j.util.DeadLockDetector; | |
| 2076 | import net.sf.l2j.util.IPv4Filter; | |
| 2077 | ||
| 2078 | +import hwid.hwid; | |
| 2079 | + | |
| 2080 | public class GameServer | |
| 2081 | {
| |
| 2082 | private static final CLogger LOGGER = new CLogger(GameServer.class.getName()); | |
| 2083 | @@ -302,6 +304,9 @@ | |
| 2084 | LOGGER.info("Maximum allowed players: {}.", Config.MAXIMUM_ONLINE_USERS);
| |
| 2085 | LOGGER.info("Server loaded in " + (System.currentTimeMillis() - serverLoadStart) / 1000 + " seconds");
| |
| 2086 | ||
| 2087 | + StringUtil.printSection("Hwid Manager");
| |
| 2088 | + hwid.Init(); | |
| 2089 | + | |
| 2090 | StringUtil.printSection("Login");
| |
| 2091 | LoginServerThread.getInstance().start(); | |
| 2092 | ||
| 2093 | Index: java/hwid/hwid.java | |
| 2094 | =================================================================== | |
| 2095 | --- java/hwid/hwid.java (nonexistent) | |
| 2096 | +++ java/hwid/hwid.java (working copy) | |
| 2097 | @@ -0,0 +1,268 @@ | |
| 2098 | +package hwid; | |
| 2099 | + | |
| 2100 | +import java.io.IOException; | |
| 2101 | +import java.nio.ByteBuffer; | |
| 2102 | +import java.util.concurrent.ConcurrentHashMap; | |
| 2103 | + | |
| 2104 | +import net.sf.l2j.commons.logging.CLogger; | |
| 2105 | + | |
| 2106 | +import net.sf.l2j.Config; | |
| 2107 | +import net.sf.l2j.gameserver.model.World; | |
| 2108 | +import net.sf.l2j.gameserver.model.actor.Player; | |
| 2109 | +import net.sf.l2j.gameserver.network.GameClient; | |
| 2110 | +import net.sf.l2j.gameserver.network.serverpackets.ServerClose; | |
| 2111 | + | |
| 2112 | +import hwid.crypt.BlowfishEngine; | |
| 2113 | +import hwid.crypt.FirstKey; | |
| 2114 | +import hwid.crypt.Manager; | |
| 2115 | +import hwid.hwidmanager.hwidBan; | |
| 2116 | +import hwid.hwidmanager.hwidPlayer; | |
| 2117 | +import hwid.hwidmanager.hwidManager; | |
| 2118 | +import hwid.utils.HwidLog; | |
| 2119 | +import hwid.utils.Util; | |
| 2120 | + | |
| 2121 | +public class hwid | |
| 2122 | +{
| |
| 2123 | + protected static CLogger LOGGER = new CLogger(hwid.class.getName()); | |
| 2124 | + private static byte[] _key = new byte[16]; | |
| 2125 | + static byte version = 11; | |
| 2126 | + protected static ConcurrentHashMap<String, Manager.InfoSet> _objects = new ConcurrentHashMap<>(); | |
| 2127 | + | |
| 2128 | + public static void Init() | |
| 2129 | + {
| |
| 2130 | + if (isProtectionOn()) | |
| 2131 | + {
| |
| 2132 | + hwidBan.getInstance(); | |
| 2133 | - | diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/network/clientpackets/AuthLogin.java b/aCis_gameserver/java/net/sf/l2j/gameserver/network/clientpackets/AuthLogin.java |
| 2133 | + | |
| 2134 | - | index 6dbecbdccf165caad6675029fb1d202096b286d3..dd1a18cd25e1f7419aeaeea54e06ea452a28d92f 100644 |
| 2134 | + | |
| 2135 | - | --- a/aCis_gameserver/java/net/sf/l2j/gameserver/network/clientpackets/AuthLogin.java |
| 2135 | + | |
| 2136 | - | +++ b/aCis_gameserver/java/net/sf/l2j/gameserver/network/clientpackets/AuthLogin.java |
| 2136 | + | |
| 2137 | - | @@ -3,6 +3,8 @@ package net.sf.l2j.gameserver.network.clientpackets; |
| 2137 | + | |
| 2138 | + | |
| 2139 | + public static boolean isProtectionOn() | |
| 2140 | + {
| |
| 2141 | + return Config.ALLOW_GUARD_SYSTEM; | |
| 2142 | + } | |
| 2143 | + | |
| 2144 | + public static byte[] getKey(final byte[] key) | |
| 2145 | + {
| |
| 2146 | - | @@ -10,6 +12,7 @@ public final class AuthLogin extends L2GameClientPacket |
| 2146 | + | |
| 2147 | + try | |
| 2148 | + {
| |
| 2149 | + final BlowfishEngine bf = new BlowfishEngine(); | |
| 2150 | + bf.init(true, bfkey); | |
| 2151 | + bf.processBlock(key, 0, _key, 0); | |
| 2152 | + bf.processBlock(key, 8, _key, 8); | |
| 2153 | + } | |
| 2154 | - | @@ -24,6 +27,12 @@ public final class AuthLogin extends L2GameClientPacket |
| 2154 | + | |
| 2155 | + {
| |
| 2156 | + LOGGER.warn("HWID: Bad key!!!");
| |
| 2157 | + } | |
| 2158 | + return _key; | |
| 2159 | + } | |
| 2160 | + | |
| 2161 | + public static void addPlayer(final GameClient client) | |
| 2162 | + {
| |
| 2163 | + if (isProtectionOn() && client != null) | |
| 2164 | + Manager.getInstance().addPlayer(client); | |
| 2165 | + } | |
| 2166 | + | |
| 2167 | - | diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java b/aCis_gameserver/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java |
| 2167 | + | |
| 2168 | - | index d284949dcab49dacad817487689bc632ac346331..0dc167fc69ac7949c0b27c4a930a18dc6df1afec 100644 |
| 2168 | + | |
| 2169 | - | --- a/aCis_gameserver/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java |
| 2169 | + | |
| 2170 | - | +++ b/aCis_gameserver/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java |
| 2170 | + | |
| 2171 | - | @@ -65,6 +65,8 @@ import net.sf.l2j.gameserver.skills.L2Skill; |
| 2171 | + | |
| 2172 | + | |
| 2173 | - | import net.sf.l2j.util.CustomMessage; |
| 2173 | + | |
| 2174 | + {
| |
| 2175 | + boolean result = true; | |
| 2176 | + final int fl = Integer.reverseBytes(flag); | |
| 2177 | + if (fl == -1) | |
| 2178 | + {
| |
| 2179 | + return false; | |
| 2180 | - | @@ -355,7 +355,8 @@ public class EnterWorld extends L2GameClientPacket |
| 2180 | + | |
| 2181 | + if (fl == 1342177280) | |
| 2182 | + {
| |
| 2183 | + return false; | |
| 2184 | + } | |
| 2185 | - | + hwid.enterlog(player, getClient()); |
| 2185 | + | |
| 2186 | + {
| |
| 2187 | + result = false; | |
| 2188 | + } | |
| 2189 | + if ((fl & 0x10) != 0x0) | |
| 2190 | - | diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/network/clientpackets/RequestGameStart.java b/aCis_gameserver/java/net/sf/l2j/gameserver/network/clientpackets/RequestGameStart.java |
| 2190 | + | |
| 2191 | - | index e46f6fd2951526a9639b1a27be545af8f207caf4..ad61fed30bd25406a42ac8d0f2c4f65cd8c9dcd2 100644 |
| 2191 | + | |
| 2192 | - | --- a/aCis_gameserver/java/net/sf/l2j/gameserver/network/clientpackets/RequestGameStart.java |
| 2192 | + | |
| 2193 | - | +++ b/aCis_gameserver/java/net/sf/l2j/gameserver/network/clientpackets/RequestGameStart.java |
| 2193 | + | |
| 2194 | - | @@ -11,6 +11,8 @@ import net.sf.l2j.gameserver.network.serverpackets.CharSelected; |
| 2194 | + | |
| 2195 | - | import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage; |
| 2195 | + | |
| 2196 | + } | |
| 2197 | + return result; | |
| 2198 | + } | |
| 2199 | + | |
| 2200 | + public static int dumpData(final int _id, int position, final GameClient pi) | |
| 2201 | + {
| |
| 2202 | + int value = 0; | |
| 2203 | - | @@ -64,6 +66,9 @@ public class RequestGameStart extends L2GameClientPacket |
| 2203 | + | |
| 2204 | + boolean isIdZero = false; | |
| 2205 | + if (_id == 0) | |
| 2206 | + {
| |
| 2207 | - | + if (hwid.isProtectionOn() && !hwid.checkPlayerWithHWID(getClient(), player.getObjectId(), player.getName())) |
| 2207 | + | |
| 2208 | + } | |
| 2209 | + switch (position) | |
| 2210 | + {
| |
| 2211 | + case 0: | |
| 2212 | + {
| |
| 2213 | - | diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/network/clientpackets/SendProtocolVersion.java b/aCis_gameserver/java/net/sf/l2j/gameserver/network/clientpackets/SendProtocolVersion.java |
| 2213 | + | |
| 2214 | - | index 2dba43d529f885b7cb33d98be688e2128bf60963..0a0d105c94741a30b37fecf516618258d491d8fa 100644 |
| 2214 | + | |
| 2215 | - | --- a/aCis_gameserver/java/net/sf/l2j/gameserver/network/clientpackets/SendProtocolVersion.java |
| 2215 | + | |
| 2216 | - | +++ b/aCis_gameserver/java/net/sf/l2j/gameserver/network/clientpackets/SendProtocolVersion.java |
| 2216 | + | |
| 2217 | + break; | |
| 2218 | + } | |
| 2219 | + break; | |
| 2220 | + } | |
| 2221 | + case 1: | |
| 2222 | + {
| |
| 2223 | + if (_id != 16) | |
| 2224 | + {
| |
| 2225 | + if (!isIdZero) {}
| |
| 2226 | + value = 2; | |
| 2227 | + break; | |
| 2228 | + } | |
| 2229 | + break; | |
| 2230 | + } | |
| 2231 | + case 2: | |
| 2232 | + case 3: | |
| 2233 | + case 4: | |
| 2234 | + {
| |
| 2235 | + final int code = _id & 0xFF000000; | |
| 2236 | + if (code == 204) {}
| |
| 2237 | + if (code == 233) | |
| 2238 | + {
| |
| 2239 | + value = 3; | |
| 2240 | + break; | |
| 2241 | + } | |
| 2242 | + break; | |
| 2243 | + } | |
| 2244 | + default: | |
| 2245 | + {
| |
| 2246 | + value = 0; | |
| 2247 | + break; | |
| 2248 | + } | |
| 2249 | + } | |
| 2250 | + return value; | |
| 2251 | + } | |
| 2252 | + | |
| 2253 | + public static int calcPenalty(final byte[] data, final GameClient pi) | |
| 2254 | + {
| |
| 2255 | + int sum = -1; | |
| 2256 | + if (Util.verifyChecksum(data, 0, data.length)) | |
| 2257 | + {
| |
| 2258 | + final ByteBuffer buf = ByteBuffer.wrap(data, 0, data.length - 4); | |
| 2259 | + sum = 0; | |
| 2260 | + for (int lenPenalty = (data.length - 4) / 4, i = 0; i < lenPenalty; ++i) | |
| 2261 | + {
| |
| 2262 | + sum += dumpData(buf.getInt(), i, pi); | |
| 2263 | + } | |
| 2264 | + } | |
| 2265 | + return sum; | |
| 2266 | + } | |
| 2267 | + | |
| 2268 | + public static boolean CheckHWIDs(final GameClient client, final int LastError1, final int LastError2) | |
| 2269 | + {
| |
| 2270 | + boolean resultHWID = false; | |
| 2271 | + boolean resultLastError = false; | |
| 2272 | + final String HWID = client.getHWID(); | |
| 2273 | + if (HWID.equalsIgnoreCase("fab888b1cc9de973c8046519fa841e6") && Config.PROTECT_KICK_WITH_EMPTY_HWID)
| |
| 2274 | + {
| |
| 2275 | + resultHWID = true; | |
| 2276 | + } | |
| 2277 | + if (LastError1 != 0 && Config.PROTECT_KICK_WITH_LASTERROR_HWID) | |
| 2278 | + {
| |
| 2279 | + resultLastError = true; | |
| 2280 | + } | |
| 2281 | + return resultHWID || resultLastError; | |
| 2282 | + } | |
| 2283 | + | |
| 2284 | + public static String fillHex(final int data, final int digits) | |
| 2285 | + {
| |
| 2286 | + String number = Integer.toHexString(data); | |
| 2287 | + for (int i = number.length(); i < digits; ++i) | |
| 2288 | + {
| |
| 2289 | + number = "0" + number; | |
| 2290 | + } | |
| 2291 | + return number; | |
| 2292 | + } | |
| 2293 | + | |
| 2294 | + public static String ExtractHWID(final byte[] _data) | |
| 2295 | + {
| |
| 2296 | + if (!Util.verifyChecksum(_data, 0, _data.length)) | |
| 2297 | + {
| |
| 2298 | + return null; | |
| 2299 | + } | |
| 2300 | + final StringBuilder resultHWID = new StringBuilder(); | |
| 2301 | + for (int i = 0; i < _data.length - 8; ++i) | |
| 2302 | + {
| |
| 2303 | + resultHWID.append(fillHex(_data[i] & 0xFF, 2)); | |
| 2304 | + } | |
| 2305 | + return resultHWID.toString(); | |
| 2306 | + } | |
| 2307 | + | |
| 2308 | + public static boolean doAuthLogin(final GameClient client, final byte[] data, final String loginName) | |
| 2309 | + {
| |
| 2310 | + if (!isProtectionOn()) | |
| 2311 | + return true; | |
| 2312 | + | |
| 2313 | + client.setLoginName(loginName); | |
| 2314 | + final String fullHWID = ExtractHWID(data); | |
| 2315 | + if (fullHWID == null) | |
| 2316 | + {
| |
| 2317 | + LOGGER.warn("AuthLogin CRC Check Fail! May be BOT or unprotected client! Client IP: " + client.toString());
| |
| 2318 | + client.close(ServerClose.STATIC_PACKET); | |
| 2319 | + return false; | |
| 2320 | + } | |
| 2321 | + final int LastError1 = ByteBuffer.wrap(data, 16, 4).getInt(); | |
| 2322 | + if (CheckHWIDs(client, LastError1, 0)) | |
| 2323 | + {
| |
| 2324 | + LOGGER.warn("HWID error, look protection_logs.txt file, from IP: " + client.toString());
| |
| 2325 | + client.close(ServerClose.STATIC_PACKET); | |
| 2326 | + return false; | |
| 2327 | + } | |
| 2328 | + if (hwidBan.getInstance().checkFullHWIDBanned(client)) | |
| 2329 | + {
| |
| 2330 | + LOGGER.warn("Client " + client + " is banned. Kicked! |HWID: " + client.getHWID() + " IP: " + client.toString());
| |
| 2331 | + client.close(ServerClose.STATIC_PACKET); | |
| 2332 | + } | |
| 2333 | + final int VerfiFlag = ByteBuffer.wrap(data, 40, 4).getInt(); | |
| 2334 | + return checkVerfiFlag(client, VerfiFlag); | |
| 2335 | + } | |
| 2336 | + | |
| 2337 | + public static void doDisconection(final GameClient client) | |
| 2338 | + {
| |
| 2339 | + removePlayer(client); | |
| 2340 | + } | |
| 2341 | + | |
| 2342 | + public static boolean checkPlayerWithHWID(final GameClient client, final int playerID, final String playerName) | |
| 2343 | + {
| |
| 2344 | + if (!isProtectionOn()) | |
| 2345 | + return true; | |
| 2346 | + | |
| 2347 | + client.setPlayerName(playerName); | |
| 2348 | + client.setPlayerId(playerID); | |
| 2349 | + addPlayer(client); | |
| 2350 | + return true; | |
| 2351 | + } | |
| 2352 | + | |
| 2353 | + public static void nopath(final GameClient client) | |
| 2354 | + {
| |
| 2355 | + LOGGER.warn("HWID: " + client.toString() + " is trying to loggin server without client side hwid.");
| |
| 2356 | + client.close(ServerClose.STATIC_PACKET); | |
| 2357 | + } | |
| 2358 | + | |
| 2359 | + public static void enterlog(final Player player, final GameClient client) | |
| 2360 | + {
| |
| 2361 | + hwidManager.getInstance().validBox(player, Config.PROTECT_WINDOWS_COUNT + 1, World.getInstance().getPlayers(), true); | |
| 2362 | + LOGGER.info("HWID: [" + client.getHWID() + "], character: [" + player.getName() + "]");
| |
| 2363 | + HwidLog.auditGMAction(player.getHWid(), player.getName()); | |
| 2364 | + } | |
| 2365 | +} | |
| 2366 | \ No newline at end of file | |
| 2367 | Index: java/hwid/crypt/impl/L2Server.java | |
| 2368 | =================================================================== | |
| 2369 | --- java/hwid/crypt/impl/L2Server.java (nonexistent) | |
| 2370 | +++ java/hwid/crypt/impl/L2Server.java (working copy) | |
| 2371 | @@ -0,0 +1,49 @@ | |
| 2372 | +package hwid.crypt.impl; | |
| 2373 | + | |
| 2374 | +import hwid.crypt.ProtectionCrypt; | |
| 2375 | + | |
| 2376 | +public class L2Server implements ProtectionCrypt | |
| 2377 | +{
| |
| 2378 | + private byte[] _key; | |
| 2379 | + private byte[] _iv; | |
| 2380 | + private ProtectionCrypt _server; | |
| 2381 | + | |
| 2382 | + public L2Server() | |
| 2383 | + {
| |
| 2384 | + _key = new byte[16]; | |
| 2385 | + _iv = null; | |
| 2386 | + } | |
| 2387 | + | |
| 2388 | + @Override | |
| 2389 | + public void setup(final byte[] key, final byte[] iv) | |
| 2390 | + {
| |
| 2391 | + System.arraycopy(key, 0, this._key, 0, 16); | |
| 2392 | + _iv = iv; | |
| 2393 | + } | |
| 2394 | + | |
| 2395 | + @Override | |
| 2396 | + public void crypt(final byte[] raw, final int offset, final int size) | |
| 2397 | + {
| |
| 2398 | + int temp = 0; | |
| 2399 | + for (int i = 0; i < size; ++i) | |
| 2400 | + {
| |
| 2401 | + final int temp2 = raw[offset + i] & 0xFF; | |
| 2402 | + temp ^= (temp2 ^ _key[i & 0xF]); | |
| 2403 | + raw[offset + i] = (byte)temp; | |
| 2404 | + } | |
| 2405 | + int old = _key[8] & 0xFF; | |
| 2406 | + old |= (_key[9] << 8 & 0xFF00); | |
| 2407 | + old |= (_key[10] << 16 & 0xFF0000); | |
| 2408 | + old |= (_key[11] << 24 & 0xFF000000); | |
| 2409 | + old += size; | |
| 2410 | + _key[8] = (byte)(old & 0xFF); | |
| 2411 | + _key[9] = (byte)(old >> 8 & 0xFF); | |
| 2412 | + _key[10] = (byte)(old >> 16 & 0xFF); | |
| 2413 | + _key[11] = (byte)(old >> 24 & 0xFF); | |
| 2414 | + if (_iv != null) | |
| 2415 | + {
| |
| 2416 | + (_server = new VMPC()).setup(_key, _iv); | |
| 2417 | + _server.crypt(raw, offset, size); | |
| 2418 | + } | |
| 2419 | + } | |
| 2420 | +} | |
| 2421 | \ No newline at end of file | |
| 2422 | Index: config/en/hwid.properties | |
| 2423 | =================================================================== | |
| 2424 | --- config/en/hwid.properties (nonexistent) | |
| 2425 | +++ config/en/hwid.properties (working copy) | |
| 2426 | @@ -0,0 +1,28 @@ | |
| 2427 | +#============================================================= | |
| 2428 | +# Hwid System Manager | |
| 2429 | +#============================================================= | |
| 2430 | +# Allow Guard Protection System | |
| 2431 | +AllowGuardSystem = True | |
| 2432 | + | |
| 2433 | +# Installing client HWID | |
| 2434 | +# 1 = HWID HDD | |
| 2435 | +# 2 = HWID MAC | |
| 2436 | +# 3 = HWID CPU | |
| 2437 | +UseClientHWID = 2 | |
| 2438 | +KickWithEmptyHWID = True | |
| 2439 | +KickWithLastErrorHWID = True | |
| 2440 | + | |
| 2441 | +# What is the criterion to prohibit the launch of multiple windows? | |
| 2442 | +# IP - to IP, HWID - client on HWID | |
| 2443 | +ClientWindowsCountSec = HWID | |
| 2444 | + | |
| 2445 | +# Configure the number of open windows client | |
| 2446 | +# If 0 = Unlimited | |
| 2447 | +AllowedWindowsCount = 2 | |
| 2448 | + | |
| 2449 | +# Enable log on Console Server - Player, HWID, NAME, ID | |
| 2450 | +EnableConsoleLog = True | |
| 2451 | +EnableHWIDBans = True | |
| 2452 | +EnableHWIDBonus = True | |
| 2453 | +StoreHWID = True | |
| 2454 | +LogHWIDs = True | |
| 2455 | Index: java/net/sf/l2j/gameserver/network/clientpackets/SendProtocolVersion.java | |
| 2456 | =================================================================== | |
| 2457 | --- java/net/sf/l2j/gameserver/network/clientpackets/SendProtocolVersion.java (revision 15) | |
| 2458 | +++ java/net/sf/l2j/gameserver/network/clientpackets/SendProtocolVersion.java (working copy) | |
| 2459 | @@ -1,21 +1,61 @@ | |
| 2460 | package net.sf.l2j.gameserver.network.clientpackets; | |
| 2461 | ||
| 2462 | +import net.sf.l2j.Config; | |
| 2463 | import net.sf.l2j.gameserver.network.serverpackets.L2GameServerPacket; | |
| 2464 | import net.sf.l2j.gameserver.network.serverpackets.VersionCheck; | |
| 2465 | ||
| 2466 | +import hwid.hwid; | |
| 2467 | + | |
| 2468 | public final class SendProtocolVersion extends L2GameClientPacket | |
| 2469 | {
| |
| 2470 | private int _version; | |
| 2471 | + private byte _data[]; | |
| 2472 | + private String _hwidHdd = "NoHWID-HD"; | |
| 2473 | + private String _hwidMac = "NoHWID-MAC"; | |
| 2474 | + private String _hwidCPU = "NoHWID-CPU"; | |
| 2475 | ||
| 2476 | @Override | |
| 2477 | protected void readImpl() | |
| 2478 | {
| |
| 2479 | _version = readD(); | |
| 2480 | + if (hwid.isProtectionOn()) | |
| 2481 | + {
| |
| 2482 | + if (_buf.remaining() > 260) | |
| 2483 | + {
| |
| 2484 | + _data = new byte[260]; | |
| 2485 | + readB(_data); | |
| 2486 | + _hwidHdd = readS(); | |
| 2487 | + _hwidMac = readS(); | |
| 2488 | + _hwidCPU = readS(); | |
| 2489 | + } | |
| 2490 | + | |
| 2491 | + if (_hwidHdd.equals("NoHWID-HD") && _hwidMac.equals("NoHWID-MAC") && _hwidCPU.equals("NoHWID-CPU"))
| |
| 2492 | + {
| |
| 2493 | + hwid.nopath(getClient()); | |
| 2494 | + getClient().close((L2GameServerPacket) null); | |
| 2495 | + } | |
| 2496 | + } | |
| 2497 | } | |
| 2498 | ||
| 2499 | @Override | |
| 2500 | protected void runImpl() | |
| 2501 | {
| |
| 2502 | + if (hwid.isProtectionOn()) | |
| 2503 | + {
| |
| 2504 | + switch (Config.GET_CLIENT_HWID) | |
| 2505 | + {
| |
| 2506 | + case 1: | |
| 2507 | + getClient().setHWID(_hwidHdd); | |
| 2508 | + break; | |
| 2509 | + case 2: | |
| 2510 | + getClient().setHWID(_hwidMac); | |
| 2511 | + break; | |
| 2512 | + case 3: | |
| 2513 | + getClient().setHWID(_hwidCPU); | |
| 2514 | + break; | |
| 2515 | + } | |
| 2516 | + } | |
| 2517 | + | |
| 2518 | switch (_version) | |
| 2519 | {
| |
| 2520 | case 737: | |
| 2521 | Index: java/hwid/crypt/impl/L2Client.java | |
| 2522 | =================================================================== | |
| 2523 | --- java/hwid/crypt/impl/L2Client.java (nonexistent) | |
| 2524 | +++ java/hwid/crypt/impl/L2Client.java (working copy) | |
| 2525 | @@ -0,0 +1,50 @@ | |
| 2526 | +package hwid.crypt.impl; | |
| 2527 | + | |
| 2528 | +import hwid.crypt.ProtectionCrypt; | |
| 2529 | + | |
| 2530 | +public class L2Client implements ProtectionCrypt | |
| 2531 | +{
| |
| 2532 | + private ProtectionCrypt _client; | |
| 2533 | + private byte[] _key; | |
| 2534 | + private byte[] _iv; | |
| 2535 | + | |
| 2536 | + public L2Client() | |
| 2537 | + {
| |
| 2538 | + _key = new byte[16]; | |
| 2539 | + _iv = null; | |
| 2540 | + } | |
| 2541 | + | |
| 2542 | + @Override | |
| 2543 | + public void setup(final byte[] key, final byte[] iv) | |
| 2544 | + {
| |
| 2545 | + System.arraycopy(key, 0, this._key, 0, 16); | |
| 2546 | + _iv = iv; | |
| 2547 | + } | |
| 2548 | + | |
| 2549 | + @Override | |
| 2550 | + public void crypt(final byte[] raw, final int offset, final int size) | |
| 2551 | + {
| |
| 2552 | + if (_iv != null) | |
| 2553 | + {
| |
| 2554 | + (_client = new VMPC()).setup(_key, _iv); | |
| 2555 | + _client.crypt(raw, offset, size); | |
| 2556 | + } | |
| 2557 | + int temp = 0; | |
| 2558 | + int temp2 = 0; | |
| 2559 | + for (int i = 0; i < size; ++i) | |
| 2560 | + {
| |
| 2561 | + temp2 = (raw[offset + i] & 0xFF); | |
| 2562 | + raw[offset + i] = (byte)(temp2 ^ _key[i & 0xF] ^ temp); | |
| 2563 | + temp = temp2; | |
| 2564 | + } | |
| 2565 | + int old = _key[8] & 0xFF; | |
| 2566 | + old |= (_key[9] << 8 & 0xFF00); | |
| 2567 | + old |= (_key[10] << 16 & 0xFF0000); | |
| 2568 | + old |= (_key[11] << 24 & 0xFF000000); | |
| 2569 | + old += size; | |
| 2570 | + _key[8] = (byte)(old & 0xFF); | |
| 2571 | + _key[9] = (byte)(old >> 8 & 0xFF); | |
| 2572 | + _key[10] = (byte)(old >> 16 & 0xFF); | |
| 2573 | + _key[11] = (byte)(old >> 24 & 0xFF); | |
| 2574 | + } | |
| 2575 | +} | |
| 2576 | \ No newline at end of file | |
| 2577 | Index: java/hwid/crypt/impl/L2Server.java | |
| 2578 | =================================================================== | |
| 2579 | --- java/hwid/crypt/impl/L2Server.java (nonexistent) | |
| 2580 | +++ java/hwid/crypt/impl/L2Server.java (working copy) | |
| 2581 | @@ -0,0 +1,49 @@ | |
| 2582 | +package hwid.crypt.impl; | |
| 2583 | + | |
| 2584 | +import hwid.crypt.ProtectionCrypt; | |
| 2585 | + | |
| 2586 | +public class L2Server implements ProtectionCrypt | |
| 2587 | +{
| |
| 2588 | + private byte[] _key; | |
| 2589 | + private byte[] _iv; | |
| 2590 | + private ProtectionCrypt _server; | |
| 2591 | + | |
| 2592 | + public L2Server() | |
| 2593 | + {
| |
| 2594 | + _key = new byte[16]; | |
| 2595 | + _iv = null; | |
| 2596 | + } | |
| 2597 | + | |
| 2598 | + @Override | |
| 2599 | + public void setup(final byte[] key, final byte[] iv) | |
| 2600 | + {
| |
| 2601 | + System.arraycopy(key, 0, this._key, 0, 16); | |
| 2602 | + _iv = iv; | |
| 2603 | + } | |
| 2604 | + | |
| 2605 | + @Override | |
| 2606 | + public void crypt(final byte[] raw, final int offset, final int size) | |
| 2607 | + {
| |
| 2608 | + int temp = 0; | |
| 2609 | + for (int i = 0; i < size; ++i) | |
| 2610 | + {
| |
| 2611 | + final int temp2 = raw[offset + i] & 0xFF; | |
| 2612 | + temp ^= (temp2 ^ _key[i & 0xF]); | |
| 2613 | + raw[offset + i] = (byte)temp; | |
| 2614 | + } | |
| 2615 | + int old = _key[8] & 0xFF; | |
| 2616 | + old |= (_key[9] << 8 & 0xFF00); | |
| 2617 | + old |= (_key[10] << 16 & 0xFF0000); | |
| 2618 | + old |= (_key[11] << 24 & 0xFF000000); | |
| 2619 | + old += size; | |
| 2620 | + _key[8] = (byte)(old & 0xFF); | |
| 2621 | + _key[9] = (byte)(old >> 8 & 0xFF); | |
| 2622 | + _key[10] = (byte)(old >> 16 & 0xFF); | |
| 2623 | + _key[11] = (byte)(old >> 24 & 0xFF); | |
| 2624 | + if (_iv != null) | |
| 2625 | + {
| |
| 2626 | + (_server = new VMPC()).setup(_key, _iv); | |
| 2627 | + _server.crypt(raw, offset, size); | |
| 2628 | + } | |
| 2629 | + } | |
| 2630 | +} | |
| 2631 | \ No newline at end of file | |
| 2632 | Index: java/hwid/crypt/impl/L2Client.java | |
| 2633 | =================================================================== | |
| 2634 | --- java/hwid/crypt/impl/L2Client.java (nonexistent) | |
| 2635 | +++ java/hwid/crypt/impl/L2Client.java (working copy) | |
| 2636 | @@ -0,0 +1,50 @@ | |
| 2637 | +package hwid.crypt.impl; | |
| 2638 | + | |
| 2639 | +import hwid.crypt.ProtectionCrypt; | |
| 2640 | + | |
| 2641 | +public class L2Client implements ProtectionCrypt | |
| 2642 | +{
| |
| 2643 | + private ProtectionCrypt _client; | |
| 2644 | + private byte[] _key; | |
| 2645 | + private byte[] _iv; | |
| 2646 | + | |
| 2647 | + public L2Client() | |
| 2648 | + {
| |
| 2649 | + _key = new byte[16]; | |
| 2650 | + _iv = null; | |
| 2651 | + } | |
| 2652 | + | |
| 2653 | + @Override | |
| 2654 | + public void setup(final byte[] key, final byte[] iv) | |
| 2655 | + {
| |
| 2656 | + System.arraycopy(key, 0, this._key, 0, 16); | |
| 2657 | + _iv = iv; | |
| 2658 | + } | |
| 2659 | + | |
| 2660 | + @Override | |
| 2661 | + public void crypt(final byte[] raw, final int offset, final int size) | |
| 2662 | + {
| |
| 2663 | + if (_iv != null) | |
| 2664 | + {
| |
| 2665 | + (_client = new VMPC()).setup(_key, _iv); | |
| 2666 | + _client.crypt(raw, offset, size); | |
| 2667 | + } | |
| 2668 | + int temp = 0; | |
| 2669 | + int temp2 = 0; | |
| 2670 | + for (int i = 0; i < size; ++i) | |
| 2671 | + {
| |
| 2672 | + temp2 = (raw[offset + i] & 0xFF); | |
| 2673 | + raw[offset + i] = (byte)(temp2 ^ _key[i & 0xF] ^ temp); | |
| 2674 | + temp = temp2; | |
| 2675 | + } | |
| 2676 | + int old = _key[8] & 0xFF; | |
| 2677 | + old |= (_key[9] << 8 & 0xFF00); | |
| 2678 | + old |= (_key[10] << 16 & 0xFF0000); | |
| 2679 | + old |= (_key[11] << 24 & 0xFF000000); | |
| 2680 | + old += size; | |
| 2681 | + _key[8] = (byte)(old & 0xFF); | |
| 2682 | + _key[9] = (byte)(old >> 8 & 0xFF); | |
| 2683 | + _key[10] = (byte)(old >> 16 & 0xFF); | |
| 2684 | + _key[11] = (byte)(old >> 24 & 0xFF); | |
| 2685 | + } | |
| 2686 | +} | |
| 2687 | \ No newline at end of file | |
| 2688 | Index: java/hwid/crypt/ProtectionCrypt.java | |
| 2689 | =================================================================== | |
| 2690 | --- java/hwid/crypt/ProtectionCrypt.java (nonexistent) | |
| 2691 | +++ java/hwid/crypt/ProtectionCrypt.java (working copy) | |
| 2692 | @@ -0,0 +1,8 @@ | |
| 2693 | +package hwid.crypt; | |
| 2694 | + | |
| 2695 | +public interface ProtectionCrypt | |
| 2696 | +{
| |
| 2697 | + void setup(final byte[] p0, final byte[] p1); | |
| 2698 | + | |
| 2699 | + void crypt(final byte[] p0, final int p1, final int p2); | |
| 2700 | +} | |
| 2701 | Index: java/hwid/crypt/impl/L2Client.java | |
| 2702 | =================================================================== | |
| 2703 | --- java/hwid/crypt/impl/L2Client.java (nonexistent) | |
| 2704 | +++ java/hwid/crypt/impl/L2Client.java (working copy) | |
| 2705 | @@ -0,0 +1,50 @@ | |
| 2706 | +package hwid.crypt.impl; | |
| 2707 | + | |
| 2708 | +import hwid.crypt.ProtectionCrypt; | |
| 2709 | + | |
| 2710 | +public class L2Client implements ProtectionCrypt | |
| 2711 | +{
| |
| 2712 | + private ProtectionCrypt _client; | |
| 2713 | + private byte[] _key; | |
| 2714 | + private byte[] _iv; | |
| 2715 | + | |
| 2716 | + public L2Client() | |
| 2717 | + {
| |
| 2718 | + _key = new byte[16]; | |
| 2719 | + _iv = null; | |
| 2720 | + } | |
| 2721 | + | |
| 2722 | + @Override | |
| 2723 | + public void setup(final byte[] key, final byte[] iv) | |
| 2724 | + {
| |
| 2725 | + System.arraycopy(key, 0, this._key, 0, 16); | |
| 2726 | + _iv = iv; | |
| 2727 | + } | |
| 2728 | + | |
| 2729 | + @Override | |
| 2730 | + public void crypt(final byte[] raw, final int offset, final int size) | |
| 2731 | + {
| |
| 2732 | + if (_iv != null) | |
| 2733 | + {
| |
| 2734 | + (_client = new VMPC()).setup(_key, _iv); | |
| 2735 | + _client.crypt(raw, offset, size); | |
| 2736 | + } | |
| 2737 | + int temp = 0; | |
| 2738 | + int temp2 = 0; | |
| 2739 | + for (int i = 0; i < size; ++i) | |
| 2740 | + {
| |
| 2741 | + temp2 = (raw[offset + i] & 0xFF); | |
| 2742 | + raw[offset + i] = (byte)(temp2 ^ _key[i & 0xF] ^ temp); | |
| 2743 | + temp = temp2; | |
| 2744 | + } | |
| 2745 | + int old = _key[8] & 0xFF; | |
| 2746 | + old |= (_key[9] << 8 & 0xFF00); | |
| 2747 | + old |= (_key[10] << 16 & 0xFF0000); | |
| 2748 | + old |= (_key[11] << 24 & 0xFF000000); | |
| 2749 | + old += size; | |
| 2750 | + _key[8] = (byte)(old & 0xFF); | |
| 2751 | + _key[9] = (byte)(old >> 8 & 0xFF); | |
| 2752 | + _key[10] = (byte)(old >> 16 & 0xFF); | |
| 2753 | + _key[11] = (byte)(old >> 24 & 0xFF); | |
| 2754 | + } | |
| 2755 | +} | |
| 2756 | \ No newline at end of file | |
| 2757 | Index: java/hwid/crypt/impl/L2Server.java | |
| 2758 | =================================================================== | |
| 2759 | --- java/hwid/crypt/impl/L2Server.java (nonexistent) | |
| 2760 | +++ java/hwid/crypt/impl/L2Server.java (working copy) | |
| 2761 | @@ -0,0 +1,49 @@ | |
| 2762 | +package hwid.crypt.impl; | |
| 2763 | + | |
| 2764 | +import hwid.crypt.ProtectionCrypt; | |
| 2765 | + | |
| 2766 | +public class L2Server implements ProtectionCrypt | |
| 2767 | +{
| |
| 2768 | + private byte[] _key; | |
| 2769 | + private byte[] _iv; | |
| 2770 | + private ProtectionCrypt _server; | |
| 2771 | + | |
| 2772 | + public L2Server() | |
| 2773 | + {
| |
| 2774 | + _key = new byte[16]; | |
| 2775 | + _iv = null; | |
| 2776 | + } | |
| 2777 | + | |
| 2778 | + @Override | |
| 2779 | + public void setup(final byte[] key, final byte[] iv) | |
| 2780 | + {
| |
| 2781 | + System.arraycopy(key, 0, this._key, 0, 16); | |
| 2782 | + _iv = iv; | |
| 2783 | + } | |
| 2784 | + | |
| 2785 | + @Override | |
| 2786 | + public void crypt(final byte[] raw, final int offset, final int size) | |
| 2787 | + {
| |
| 2788 | + int temp = 0; | |
| 2789 | + for (int i = 0; i < size; ++i) | |
| 2790 | + {
| |
| 2791 | + final int temp2 = raw[offset + i] & 0xFF; | |
| 2792 | + temp ^= (temp2 ^ _key[i & 0xF]); | |
| 2793 | + raw[offset + i] = (byte)temp; | |
| 2794 | + } | |
| 2795 | + int old = _key[8] & 0xFF; | |
| 2796 | + old |= (_key[9] << 8 & 0xFF00); | |
| 2797 | + old |= (_key[10] << 16 & 0xFF0000); | |
| 2798 | + old |= (_key[11] << 24 & 0xFF000000); | |
| 2799 | + old += size; | |
| 2800 | + _key[8] = (byte)(old & 0xFF); | |
| 2801 | + _key[9] = (byte)(old >> 8 & 0xFF); | |
| 2802 | + _key[10] = (byte)(old >> 16 & 0xFF); | |
| 2803 | + _key[11] = (byte)(old >> 24 & 0xFF); | |
| 2804 | + if (_iv != null) | |
| 2805 | + {
| |
| 2806 | + (_server = new VMPC()).setup(_key, _iv); | |
| 2807 | + _server.crypt(raw, offset, size); | |
| 2808 | + } | |
| 2809 | + } | |
| 2810 | +} | |
| 2811 | \ No newline at end of file | |
| 2812 | Index: java/hwid/crypt/impl/VMPC.java | |
| 2813 | =================================================================== | |
| 2814 | --- java/hwid/crypt/impl/VMPC.java (nonexistent) | |
| 2815 | +++ java/hwid/crypt/impl/VMPC.java (working copy) | |
| 2816 | @@ -0,0 +1,64 @@ | |
| 2817 | +package hwid.crypt.impl; | |
| 2818 | + | |
| 2819 | +import hwid.crypt.ProtectionCrypt; | |
| 2820 | + | |
| 2821 | +public class VMPC implements ProtectionCrypt | |
| 2822 | +{
| |
| 2823 | + private byte _n; | |
| 2824 | + private byte[] _P; | |
| 2825 | + private byte _s; | |
| 2826 | + | |
| 2827 | + public VMPC() | |
| 2828 | + {
| |
| 2829 | + _n = 0; | |
| 2830 | + _P = new byte[256]; | |
| 2831 | + _s = 0; | |
| 2832 | + } | |
| 2833 | + | |
| 2834 | + @Override | |
| 2835 | + public void setup(final byte[] key, final byte[] iv) | |
| 2836 | + {
| |
| 2837 | + _s = 0; | |
| 2838 | + for (int i = 0; i < 256; ++i) | |
| 2839 | + {
| |
| 2840 | + _P[i] = (byte)(i & 0xFF); | |
| 2841 | + } | |
| 2842 | + for (int m = 0; m < 768; ++m) | |
| 2843 | + {
| |
| 2844 | + _s = _P[_s + _P[m & 0xFF] + key[m % 64] & 0xFF]; | |
| 2845 | + final byte temp = _P[m & 0xFF]; | |
| 2846 | + _P[m & 0xFF] = _P[_s & 0xFF]; | |
| 2847 | + _P[_s & 0xFF] = temp; | |
| 2848 | + } | |
| 2849 | + for (int m = 0; m < 768; ++m) | |
| 2850 | + {
| |
| 2851 | + _s = _P[_s + _P[m & 0xFF] + iv[m % 64] & 0xFF]; | |
| 2852 | + final byte temp = _P[m & 0xFF]; | |
| 2853 | + _P[m & 0xFF] = _P[_s & 0xFF]; | |
| 2854 | + _P[_s & 0xFF] = temp; | |
| 2855 | + } | |
| 2856 | + for (int m = 0; m < 768; ++m) | |
| 2857 | + {
| |
| 2858 | + _s = _P[_s + _P[m & 0xFF] + key[m % 64] & 0xFF]; | |
| 2859 | + final byte temp = _P[m & 0xFF]; | |
| 2860 | + _P[m & 0xFF] = _P[_s & 0xFF]; | |
| 2861 | + _P[_s & 0xFF] = temp; | |
| 2862 | + } | |
| 2863 | + _n = 0; | |
| 2864 | + } | |
| 2865 | + | |
| 2866 | + @Override | |
| 2867 | + public void crypt(final byte[] raw, final int offset, final int size) | |
| 2868 | + {
| |
| 2869 | + for (int i = 0; i < size; ++i) | |
| 2870 | + {
| |
| 2871 | + _s = _P[_s + _P[_n & 0xFF] & 0xFF]; | |
| 2872 | + final byte z = _P[_P[_P[_s & 0xFF] & 0xFF] + 1 & 0xFF]; | |
| 2873 | + final byte temp = _P[_n & 0xFF]; | |
| 2874 | + _P[_n & 0xFF] = _P[_s & 0xFF]; | |
| 2875 | + _P[_s & 0xFF] = temp; | |
| 2876 | + _n = (byte)(_n + 1 & 0xFF); | |
| 2877 | + raw[offset + i] ^= z; | |
| 2878 | + } | |
| 2879 | + } | |
| 2880 | +} | |
| 2881 | \ No newline at end of file | |
| 2882 | #P aCis_datapack | |
| 2883 | Index: data/xml/adminCommands.xml | |
| 2884 | =================================================================== | |
| 2885 | --- data/xml/adminCommands.xml (revision 15) | |
| 2886 | +++ data/xml/adminCommands.xml (working copy) | |
| 2887 | @@ -166,4 +166,7 @@ | |
| 2888 | ||
| 2889 | <!-- ZONE --> | |
| 2890 | <aCar name="admin_zone" accessLevel="7" params="[show - all|clear|id]" desc="Show the zone panel, or the zone visually."/> | |
| 2891 | + | |
| 2892 | + <!-- HWID --> | |
| 2893 | + <aCar name="admin_hwid_ban" accessLevel="7" params="" desc=""/> | |
| 2894 | </list> | |
| 2895 | \ No newline at end of file | |
| 2896 | Index: tools/database_installer.sh | |
| 2897 | =================================================================== | |
| 2898 | --- tools/database_installer.sh (revision 15) | |
| 2899 | +++ tools/database_installer.sh (working copy) | |
| 2900 | @@ -121,6 +121,8 @@ | |
| 2901 | $MYG < ../sql/grandboss_list.sql &> /dev/null | |
| 2902 | $MYG < ../sql/heroes_diary.sql &> /dev/null | |
| 2903 | $MYG < ../sql/heroes.sql &> /dev/null | |
| 2904 | +$MYG < ../sql/hwid_bans.sql &> /dev/null | |
| 2905 | +$MYG < ../sql/hwid_info.sql &> /dev/null | |
| 2906 | $MYG < ../sql/items.sql &> /dev/null | |
| 2907 | $MYG < ../sql/items_on_ground.sql &> /dev/null | |
| 2908 | $MYG < ../sql/mdt_bets.sql &> /dev/null | |
| 2909 | Index: sql/hwid_info.sql | |
| 2910 | =================================================================== | |
| 2911 | --- sql/hwid_info.sql (nonexistent) | |
| 2912 | +++ sql/hwid_info.sql (working copy) | |
| 2913 | @@ -0,0 +1,7 @@ | |
| 2914 | +CREATE TABLE IF NOT EXISTS `hwid_info` ( | |
| 2915 | + `HWID` varchar(32) NOT NULL DEFAULT '', | |
| 2916 | + `Account` varchar(45) NOT NULL DEFAULT '', | |
| 2917 | + `PlayerID` int(10) unsigned NOT NULL DEFAULT '0', | |
| 2918 | + `LockType` enum('PLAYER_LOCK','ACCOUNT_LOCK','NONE') NOT NULL DEFAULT 'NONE',
| |
| 2919 | + PRIMARY KEY (`HWID`) | |
| 2920 | +) ENGINE=InnoDB DEFAULT CHARSET=latin1; | |
| 2921 | \ No newline at end of file | |
| 2922 | Index: sql/hwid_bans.sql | |
| 2923 | =================================================================== | |
| 2924 | --- sql/hwid_bans.sql (nonexistent) | |
| 2925 | +++ sql/hwid_bans.sql (working copy) | |
| 2926 | @@ -0,0 +1,7 @@ | |
| 2927 | +CREATE TABLE IF NOT EXISTS `hwid_bans` ( | |
| 2928 | + `HWID` varchar(32) DEFAULT NULL, | |
| 2929 | + `HWIDSecond` varchar(32) DEFAULT NULL, | |
| 2930 | + `expiretime` int(11) NOT NULL DEFAULT '0', | |
| 2931 | + `comments` varchar(255) DEFAULT '', | |
| 2932 | + UNIQUE KEY `HWID` (`HWID`) | |
| 2933 | +) ENGINE=InnoDB DEFAULT CHARSET=latin1; | |
| 2934 | \ No newline at end of file | |
| 2935 | Index: tools/database_installer.bat | |
| 2936 | =================================================================== | |
| 2937 | --- tools/database_installer.bat (revision 15) | |
| 2938 | +++ tools/database_installer.bat (working copy) | |
| 2939 | @@ -101,6 +101,8 @@ | |
| 2940 | %mysqlPath% -h %gshost% -u %gsuser% --password=%gspass% -D %gsdb% < ../sql/grandboss_list.sql | |
| 2941 | %mysqlPath% -h %gshost% -u %gsuser% --password=%gspass% -D %gsdb% < ../sql/heroes_diary.sql | |
| 2942 | %mysqlPath% -h %gshost% -u %gsuser% --password=%gspass% -D %gsdb% < ../sql/heroes.sql | |
| 2943 | +%mysqlPath% -h %gshost% -u %gsuser% --password=%gspass% -D %gsdb% < ../sql/hwid_bans.sql | |
| 2944 | +%mysqlPath% -h %gshost% -u %gsuser% --password=%gspass% -D %gsdb% < ../sql/hwid_info.sql | |
| 2945 | %mysqlPath% -h %gshost% -u %gsuser% --password=%gspass% -D %gsdb% < ../sql/items.sql | |
| 2946 | %mysqlPath% -h %gshost% -u %gsuser% --password=%gspass% -D %gsdb% < ../sql/items_on_ground.sql | |
| 2947 | %mysqlPath% -h %gshost% -u %gsuser% --password=%gspass% -D %gsdb% < ../sql/mdt_bets.sql | |
| 2948 | Index: tools/full_install.sql | |
| 2949 | =================================================================== | |
| 2950 | --- tools/full_install.sql (revision 15) | |
| 2951 | +++ tools/full_install.sql (working copy) | |
| 2952 | @@ -44,6 +44,8 @@ | |
| 2953 | DROP TABLE IF EXISTS grandboss_list; | |
| 2954 | DROP TABLE IF EXISTS heroes_diary; | |
| 2955 | DROP TABLE IF EXISTS heroes; | |
| 2956 | +DROP TABLE IF EXISTS hwid_bans; | |
| 2957 | +DROP TABLE IF EXISTS hwid_info; | |
| 2958 | DROP TABLE IF EXISTS items; | |
| 2959 | DROP TABLE IF EXISTS items_on_ground; | |
| 2960 | DROP TABLE IF EXISTS mdt_bets; | |
| 2961 |