mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
Merge pull request #2569 from spjspj/master
spjspj - First step to ban based on IP.2
This commit is contained in:
commit
93b5fe7fe2
1 changed files with 13 additions and 0 deletions
|
@ -36,7 +36,9 @@ package mage.server.console;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.CancellationException;
|
import java.util.concurrent.CancellationException;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
|
@ -538,6 +540,7 @@ class UpdateUsersTask extends SwingWorker<Void, List<UserView>> {
|
||||||
private List<UserView> previousUsers;
|
private List<UserView> previousUsers;
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(UpdateUsersTask.class);
|
private static final Logger logger = Logger.getLogger(UpdateUsersTask.class);
|
||||||
|
Map<String, String> peopleIps = new HashMap<>();
|
||||||
|
|
||||||
UpdateUsersTask(Session session, ConsolePanel panel) {
|
UpdateUsersTask(Session session, ConsolePanel panel) {
|
||||||
this.session = session;
|
this.session = session;
|
||||||
|
@ -572,6 +575,16 @@ class UpdateUsersTask extends SwingWorker<Void, List<UserView>> {
|
||||||
for (UserView u2 : usersToCheck) {
|
for (UserView u2 : usersToCheck) {
|
||||||
if (u1.getUserName().equals(u2.getUserName())) {
|
if (u1.getUserName().equals(u2.getUserName())) {
|
||||||
found = true;
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue