From 74d61a668c1b4fd7805af280492f1a3bf1b3e4ee Mon Sep 17 00:00:00 2001 From: spjspj Date: Sun, 6 Nov 2016 23:27:18 +1100 Subject: [PATCH] spjspj - First step to ban based on IP.2 --- .../main/java/mage/server/console/ConsolePanel.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Mage.Server.Console/src/main/java/mage/server/console/ConsolePanel.java b/Mage.Server.Console/src/main/java/mage/server/console/ConsolePanel.java index c69bc5f055..913fe1c89e 100644 --- a/Mage.Server.Console/src/main/java/mage/server/console/ConsolePanel.java +++ b/Mage.Server.Console/src/main/java/mage/server/console/ConsolePanel.java @@ -36,7 +36,9 @@ package mage.server.console; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Collection; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.UUID; import java.util.concurrent.CancellationException; import java.util.concurrent.ExecutionException; @@ -538,6 +540,7 @@ class UpdateUsersTask extends SwingWorker> { private List previousUsers; private static final Logger logger = Logger.getLogger(UpdateUsersTask.class); + Map peopleIps = new HashMap<>(); UpdateUsersTask(Session session, ConsolePanel panel) { this.session = session; @@ -572,6 +575,16 @@ class UpdateUsersTask extends SwingWorker> { for (UserView u2 : usersToCheck) { if (u1.getUserName().equals(u2.getUserName())) { found = true; + String s = u1.getUserName() + "," + u1.getHost(); + if (peopleIps.get(s) == null) { + logger.warn("Found new user: " + u1.getUserName() + "," + u1.getHost()); + peopleIps.put(s, "1"); + } + s = u2.getUserName() + "," + u2.getHost(); + if (peopleIps.get(s) == null) { + logger.warn("Found new user: " + u1.getUserName() + "," + u1.getHost()); + peopleIps.put(s, "1"); + } break; } }