Block ips? (cancel ping event?)

Discussion in 'BungeeCord Plugin Development' started by HydroTekZ, May 22, 2015.

  1. How can I refuse to respond to a chosen IP address? I think I know how is DDoS attacking my server and I want to block their IP address as a try to make them stop. I basically want them to think the server is offline, "Can't connect to server.". The ping/latency need to be "(no connection)" also.
     
  2. PhanaticD

    Patron

    block it in your systems firewall
     
  3. Just drop the IPs via IPTables as Phanatic said.

    iptables -A INPUT -s 1.2.3.4 -j DROP
     
  4. @PhanaticD and @redfrosting, I don't have control of the OS. I have very limited permissions, so I need and only want to use BungeeCord to block them out. There is actually a reason I posted the thread at BungeeCord Plugin Development forum.
     
  5. Use the onPlayerHandshake
     
  6. ProxyPingEvent
     
  7. Yeah, I know that event exist. How do I cancel the response? Do you think this will work?
    Code (Text):
    event.setResponse(null);
     
  8. That seems to work (MOTD shows "Can't connect...") but it throws an NPE so you'll have to figure that out.

    You'll also have to cancel the preLoginEvent if you don't want them to be able to join the server either, since they can still join.
     
  9. Bump. How do you recommend handling the NPE?
     
  10. I don't think this is possible without blocking the IP addresses (via firewall), even if you edited the MOTD, people can still tell if your server is online or not.
     
  11. It's Java, ain't everything possible?

    Anyways, bump!
     
  12. :D Or you could create a separate program that listens for packet requests if there are too many in a minute block that nasty IP >:O