End login process for filtered IPs

This commit is contained in:
md_5 2013-04-25 09:58:55 +10:00
parent 206d24fadd
commit 70436044aa
4 changed files with 18 additions and 16 deletions

View File

@ -1,26 +1,26 @@
From 5877b5f20080c1630241b6ab62c94bc6dfa7a44a Mon Sep 17 00:00:00 2001 From dc11955b66495dc0dc88e9e1775ef3de1ed3c06e Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au> From: md_5 <md_5@live.com.au>
Date: Tue, 23 Apr 2013 11:22:07 +1000 Date: Tue, 23 Apr 2013 11:22:07 +1000
Subject: [PATCH] Proxy IP Filter Subject: [PATCH] Proxy IP Filter
diff --git a/src/main/java/net/minecraft/server/ThreadLoginVerifier.java b/src/main/java/net/minecraft/server/ThreadLoginVerifier.java diff --git a/src/main/java/net/minecraft/server/ThreadLoginVerifier.java b/src/main/java/net/minecraft/server/ThreadLoginVerifier.java
index 0686ba0..9ed3db5 100644 index 0686ba0..fcd4136 100644
--- a/src/main/java/net/minecraft/server/ThreadLoginVerifier.java --- a/src/main/java/net/minecraft/server/ThreadLoginVerifier.java
+++ b/src/main/java/net/minecraft/server/ThreadLoginVerifier.java +++ b/src/main/java/net/minecraft/server/ThreadLoginVerifier.java
@@ -28,6 +28,7 @@ class ThreadLoginVerifier extends Thread { @@ -28,6 +28,7 @@ class ThreadLoginVerifier extends Thread {
public void run() { public void run() {
try { try {
+ org.bukkit.craftbukkit.Spigot.filterIp(pendingConnection); // Spigot + if (org.bukkit.craftbukkit.Spigot.filterIp(pendingConnection)) return; // Spigot
String s = (new BigInteger(MinecraftEncryption.a(PendingConnection.a(this.pendingConnection), PendingConnection.b(this.pendingConnection).F().getPublic(), PendingConnection.c(this.pendingConnection)))).toString(16); String s = (new BigInteger(MinecraftEncryption.a(PendingConnection.a(this.pendingConnection), PendingConnection.b(this.pendingConnection).F().getPublic(), PendingConnection.c(this.pendingConnection)))).toString(16);
URL url = new URL("http://session.minecraft.net/game/checkserver.jsp?user=" + URLEncoder.encode(PendingConnection.d(this.pendingConnection), "UTF-8") + "&serverId=" + URLEncoder.encode(s, "UTF-8")); URL url = new URL("http://session.minecraft.net/game/checkserver.jsp?user=" + URLEncoder.encode(PendingConnection.d(this.pendingConnection), "UTF-8") + "&serverId=" + URLEncoder.encode(s, "UTF-8"));
BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(url.openStream())); BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(url.openStream()));
diff --git a/src/main/java/org/bukkit/craftbukkit/Spigot.java b/src/main/java/org/bukkit/craftbukkit/Spigot.java diff --git a/src/main/java/org/bukkit/craftbukkit/Spigot.java b/src/main/java/org/bukkit/craftbukkit/Spigot.java
index 2cd806e..82dc5c8 100644 index 2cd806e..fd90979 100644
--- a/src/main/java/org/bukkit/craftbukkit/Spigot.java --- a/src/main/java/org/bukkit/craftbukkit/Spigot.java
+++ b/src/main/java/org/bukkit/craftbukkit/Spigot.java +++ b/src/main/java/org/bukkit/craftbukkit/Spigot.java
@@ -1,19 +1,47 @@ @@ -1,19 +1,49 @@
package org.bukkit.craftbukkit; package org.bukkit.craftbukkit;
+import java.net.InetAddress; +import java.net.InetAddress;
@ -45,7 +45,7 @@ index 2cd806e..82dc5c8 100644
} }
} }
+ +
+ public static void filterIp(PendingConnection con) { + public static boolean filterIp(PendingConnection con) {
+ if (filterIps) { + if (filterIps) {
+ try { + try {
+ InetAddress address = con.getSocket().getInetAddress(); + InetAddress address = con.getSocket().getInetAddress();
@ -61,11 +61,13 @@ index 2cd806e..82dc5c8 100644
+ lookup.append("xbl.spamhaus.org."); + lookup.append("xbl.spamhaus.org.");
+ if (InetAddress.getByName(lookup.toString()) != null) { + if (InetAddress.getByName(lookup.toString()) != null) {
+ con.disconnect("Your IP address (" + ip + ") is flagged as unsafe by spamhaus.org/xbl"); + con.disconnect("Your IP address (" + ip + ") is flagged as unsafe by spamhaus.org/xbl");
+ return true;
+ } + }
+ } + }
+ } catch (Exception ex) { + } catch (Exception ex) {
+ } + }
+ } + }
+ return false;
+ } + }
} }
diff --git a/src/main/resources/configurations/bukkit.yml b/src/main/resources/configurations/bukkit.yml diff --git a/src/main/resources/configurations/bukkit.yml b/src/main/resources/configurations/bukkit.yml

View File

@ -1,4 +1,4 @@
From 652752f24fa214ce92cdb698689df4d5dc7b1e6c Mon Sep 17 00:00:00 2001 From 9a7f45b5e5392a7557ad47a1f185b46e5e78f06f Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Sun, 3 Feb 2013 05:10:21 -0500 Date: Sun, 3 Feb 2013 05:10:21 -0500
Subject: [PATCH] Entity Activation Range Subject: [PATCH] Entity Activation Range
@ -98,7 +98,7 @@ index 51816e4..7e10318 100644
entity.V = entity.locY; entity.V = entity.locY;
entity.W = entity.locZ; entity.W = entity.locZ;
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 77078a1..6a0f02c 100644 index 7d05a77..94cb855 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -103,9 +103,15 @@ public class CraftWorld implements World { @@ -103,9 +103,15 @@ public class CraftWorld implements World {
@ -148,7 +148,7 @@ index 77078a1..6a0f02c 100644
public Block getBlockAt(int x, int y, int z) { public Block getBlockAt(int x, int y, int z) {
diff --git a/src/main/java/org/bukkit/craftbukkit/Spigot.java b/src/main/java/org/bukkit/craftbukkit/Spigot.java diff --git a/src/main/java/org/bukkit/craftbukkit/Spigot.java b/src/main/java/org/bukkit/craftbukkit/Spigot.java
index 58361fa..61cd44d 100644 index c4eea4d..4c8d1a8 100644
--- a/src/main/java/org/bukkit/craftbukkit/Spigot.java --- a/src/main/java/org/bukkit/craftbukkit/Spigot.java
+++ b/src/main/java/org/bukkit/craftbukkit/Spigot.java +++ b/src/main/java/org/bukkit/craftbukkit/Spigot.java
@@ -1,12 +1,43 @@ @@ -1,12 +1,43 @@
@ -424,7 +424,7 @@ index 58361fa..61cd44d 100644
+ return isActive; + return isActive;
} }
public static void filterIp(PendingConnection con) { public static boolean filterIp(PendingConnection con) {
diff --git a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java b/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java diff --git a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java b/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java
index bbb6368..d8f73ad 100644 index bbb6368..d8f73ad 100644
--- a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java --- a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java

View File

@ -1,4 +1,4 @@
From e21977783b759a07c1962b262c1b879a5e118e61 Mon Sep 17 00:00:00 2001 From fd5bdc0f0338a9148e0345765345932aab507a74 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au> From: md_5 <md_5@live.com.au>
Date: Sat, 23 Feb 2013 12:33:20 +1100 Date: Sat, 23 Feb 2013 12:33:20 +1100
Subject: [PATCH] Watchdog Thread. Subject: [PATCH] Watchdog Thread.
@ -25,7 +25,7 @@ index 0205822..65a4e9f 100644
this.isStopped = true; this.isStopped = true;
} catch (Throwable throwable1) { } catch (Throwable throwable1) {
diff --git a/src/main/java/org/bukkit/craftbukkit/Spigot.java b/src/main/java/org/bukkit/craftbukkit/Spigot.java diff --git a/src/main/java/org/bukkit/craftbukkit/Spigot.java b/src/main/java/org/bukkit/craftbukkit/Spigot.java
index 88c2383..c8d1110 100644 index 90237d4..3b29fea 100644
--- a/src/main/java/org/bukkit/craftbukkit/Spigot.java --- a/src/main/java/org/bukkit/craftbukkit/Spigot.java
+++ b/src/main/java/org/bukkit/craftbukkit/Spigot.java +++ b/src/main/java/org/bukkit/craftbukkit/Spigot.java
@@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
@ -149,7 +149,7 @@ index 88c2383..c8d1110 100644
+ } + }
+ } + }
+ +
public static void filterIp(PendingConnection con) { public static boolean filterIp(PendingConnection con) {
if (filterIps) { if (filterIps) {
try { try {
diff --git a/src/main/java/org/spigotmc/RestartCommand.java b/src/main/java/org/spigotmc/RestartCommand.java diff --git a/src/main/java/org/spigotmc/RestartCommand.java b/src/main/java/org/spigotmc/RestartCommand.java

View File

@ -1,4 +1,4 @@
From fa94cec348e0cfc5b654ccde91839f80bd52f3f2 Mon Sep 17 00:00:00 2001 From 97e803109d5c03dd4d13e357b576da42dac7e10d Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Wed, 20 Feb 2013 11:58:47 -0500 Date: Wed, 20 Feb 2013 11:58:47 -0500
Subject: [PATCH] Entity Tracking Ranges Subject: [PATCH] Entity Tracking Ranges
@ -78,7 +78,7 @@ index 94cb855..fe7b8b0 100644
public Block getBlockAt(int x, int y, int z) { public Block getBlockAt(int x, int y, int z) {
diff --git a/src/main/java/org/bukkit/craftbukkit/Spigot.java b/src/main/java/org/bukkit/craftbukkit/Spigot.java diff --git a/src/main/java/org/bukkit/craftbukkit/Spigot.java b/src/main/java/org/bukkit/craftbukkit/Spigot.java
index c8d1110..1117309 100644 index 3b29fea..afa0f04 100644
--- a/src/main/java/org/bukkit/craftbukkit/Spigot.java --- a/src/main/java/org/bukkit/craftbukkit/Spigot.java
+++ b/src/main/java/org/bukkit/craftbukkit/Spigot.java +++ b/src/main/java/org/bukkit/craftbukkit/Spigot.java
@@ -16,12 +16,16 @@ import net.minecraft.server.EntityComplexPart; @@ -16,12 +16,16 @@ import net.minecraft.server.EntityComplexPart;
@ -128,7 +128,7 @@ index c8d1110..1117309 100644
+ return Math.min(world.maxTrackingRange, range); + return Math.min(world.maxTrackingRange, range);
+ } + }
+ +
public static void filterIp(PendingConnection con) { public static boolean filterIp(PendingConnection con) {
if (filterIps) { if (filterIps) {
try { try {
diff --git a/src/main/resources/configurations/bukkit.yml b/src/main/resources/configurations/bukkit.yml diff --git a/src/main/resources/configurations/bukkit.yml b/src/main/resources/configurations/bukkit.yml