Jump to content

[Share]Funny flood fix!?


xAddytzu

Recommended Posts

Oh come on you are not serious. Are you gonna floodprotect the movebackwardtolocation? Players use it ALL the -beep-ing time.

 

Floodprotecting it is the most stupid thing i've ever heard.. Imo should be locked.

You are wrong..., Post a different fix.

 

@Addy, actually this seems like LAG :), so i wouldn't reccomend it. Nevertheless, you can add a different fix ( to block this packets, I am working on it ) :D

Link to comment
Share on other sites

New working code ;)... Thx xAddytzu for idea...

 

 

Index: /trunk/L2J/java/net/sf/l2j/gameserver/network/clientpackets/MoveBackwardToLocation.java
===================================================================
--- /trunk/L2J/java/net/sf/l2j/gameserver/network/clientpackets/MoveBackwardToLocation.java (revision 9)
+++ /trunk/L2J/java/net/sf/l2j/gameserver/network/clientpackets/MoveBackwardToLocation.java (revision 52)
@@ -25,4 +25,5 @@
import net.sf.l2j.gameserver.ai.CtrlIntention;
import net.sf.l2j.gameserver.model.L2CharPosition;
+import net.sf.l2j.gameserver.model.L2Object;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.network.SystemMessageId;
@@ -31,4 +32,5 @@
import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
import net.sf.l2j.gameserver.templates.L2WeaponType;
+import net.sf.l2j.gameserver.util.FloodProtector;
import net.sf.l2j.gameserver.util.IllegalPlayerAction;
import net.sf.l2j.gameserver.util.Util;
@@ -100,4 +102,8 @@
		if (activeChar == null)
			return;
+		
+		L2Object player = null;
+		if (!FloodProtector.getInstance().tryPerformAction(player.getObjectId(), FloodProtector.PROTECTED_PACKETS))
+			return;

		_curX = activeChar.getX();
Index: /trunk/L2J/java/net/sf/l2j/gameserver/util/FloodProtector.java
===================================================================
--- /trunk/L2J/java/net/sf/l2j/gameserver/util/FloodProtector.java (revision 31)
+++ /trunk/L2J/java/net/sf/l2j/gameserver/util/FloodProtector.java (revision 52)
@@ -34,4 +34,5 @@
	private static final Logger _log = Logger.getLogger(FloodProtector.class.getName());
	private static FloodProtector _instance;
+

	public static final FloodProtector getInstance()
@@ -76,6 +77,7 @@
	public static final int PROTECTED_GIVEITEMTOPET = 13;
	public static final int PROTECTED_BANKING_SYSTEM = 14;	
+	public static final int PROTECTED_PACKETS = 15;
public static final int PROTECTED_UNKNOWNPACKET = 16;
public static final int PROTECTED_BYPASS        = 17;

	// =========================================================

Link to comment
Share on other sites

New working code ;)... Thx xAddytzu for idea...

 

 

Index: /trunk/L2J/java/net/sf/l2j/gameserver/network/clientpackets/MoveBackwardToLocation.java
===================================================================
--- /trunk/L2J/java/net/sf/l2j/gameserver/network/clientpackets/MoveBackwardToLocation.java (revision 9)
+++ /trunk/L2J/java/net/sf/l2j/gameserver/network/clientpackets/MoveBackwardToLocation.java (revision 52)
@@ -25,4 +25,5 @@
import net.sf.l2j.gameserver.ai.CtrlIntention;
import net.sf.l2j.gameserver.model.L2CharPosition;
+import net.sf.l2j.gameserver.model.L2Object;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.network.SystemMessageId;
@@ -31,4 +32,5 @@
import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
import net.sf.l2j.gameserver.templates.L2WeaponType;
+import net.sf.l2j.gameserver.util.FloodProtector;
import net.sf.l2j.gameserver.util.IllegalPlayerAction;
import net.sf.l2j.gameserver.util.Util;
@@ -100,4 +102,8 @@
		if (activeChar == null)
			return;
+		
+		L2Object player = null;
+		if (!FloodProtector.getInstance().tryPerformAction(player.getObjectId(), FloodProtector.PROTECTED_PACKETS))
+			return;

		_curX = activeChar.getX();
Index: /trunk/L2J/java/net/sf/l2j/gameserver/util/FloodProtector.java
===================================================================
--- /trunk/L2J/java/net/sf/l2j/gameserver/util/FloodProtector.java (revision 31)
+++ /trunk/L2J/java/net/sf/l2j/gameserver/util/FloodProtector.java (revision 52)
@@ -34,4 +34,5 @@
	private static final Logger _log = Logger.getLogger(FloodProtector.class.getName());
	private static FloodProtector _instance;
+

	public static final FloodProtector getInstance()
@@ -76,6 +77,7 @@
	public static final int PROTECTED_GIVEITEMTOPET = 13;
	public static final int PROTECTED_BANKING_SYSTEM = 14;	
+	public static final int PROTECTED_PACKETS = 15;
public static final int PROTECTED_UNKNOWNPACKET = 16;
public static final int PROTECTED_BYPASS        = 17;

	// =========================================================

this will really work?

Link to comment
Share on other sites

New working code ;)... Thx xAddytzu for idea...

 

 

Index: /trunk/L2J/java/net/sf/l2j/gameserver/network/clientpackets/MoveBackwardToLocation.java
===================================================================
--- /trunk/L2J/java/net/sf/l2j/gameserver/network/clientpackets/MoveBackwardToLocation.java (revision 9)
+++ /trunk/L2J/java/net/sf/l2j/gameserver/network/clientpackets/MoveBackwardToLocation.java (revision 52)
@@ -25,4 +25,5 @@
import net.sf.l2j.gameserver.ai.CtrlIntention;
import net.sf.l2j.gameserver.model.L2CharPosition;
+import net.sf.l2j.gameserver.model.L2Object;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.network.SystemMessageId;
@@ -31,4 +32,5 @@
import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
import net.sf.l2j.gameserver.templates.L2WeaponType;
+import net.sf.l2j.gameserver.util.FloodProtector;
import net.sf.l2j.gameserver.util.IllegalPlayerAction;
import net.sf.l2j.gameserver.util.Util;
@@ -100,4 +102,8 @@
		if (activeChar == null)
			return;
+		
+		L2Object player = null;
+		if (!FloodProtector.getInstance().tryPerformAction(player.getObjectId(), FloodProtector.PROTECTED_PACKETS))
+			return;

		_curX = activeChar.getX();
Index: /trunk/L2J/java/net/sf/l2j/gameserver/util/FloodProtector.java
===================================================================
--- /trunk/L2J/java/net/sf/l2j/gameserver/util/FloodProtector.java (revision 31)
+++ /trunk/L2J/java/net/sf/l2j/gameserver/util/FloodProtector.java (revision 52)
@@ -34,4 +34,5 @@
	private static final Logger _log = Logger.getLogger(FloodProtector.class.getName());
	private static FloodProtector _instance;
+

	public static final FloodProtector getInstance()
@@ -76,6 +77,7 @@
	public static final int PROTECTED_GIVEITEMTOPET = 13;
	public static final int PROTECTED_BANKING_SYSTEM = 14;	
+	public static final int PROTECTED_PACKETS = 15;
public static final int PROTECTED_UNKNOWNPACKET = 16;
public static final int PROTECTED_BYPASS        = 17;

	// =========================================================

 

Still

 

Oh come on you are not serious. Are you gonna floodprotect the movebackwardtolocation? Players use it ALL the -beep-ing time.

 

Floodprotecting it is the most stupid thing i've ever heard.. Imo should be locked.

Link to comment
Share on other sites

http://www.maxcheaters.com/forum/index.php?topic=124395.0;msg=872797

Damn dude this topic is useless... Sorry addy but this is quite a braind dead thing to do... damn....

 

Link to comment
Share on other sites

I have one idea, but not tested, just written...

 

Index: C:/Workspace/L2_GameServer_It/java/config/server.properties
===================================================================
--- C:/Workspace/L2_GameServer_It/java/config/server.properties	(revision 1025)
+++ C:/Workspace/L2_GameServer_It/java/config/server.properties	(working copy)
@@ -69,6 +69,16 @@
# Define how many players are allowed to play simultaneously on your server.
MaximumOnlineUsers=100

+# Activate Protection for knownPacket flooding
+MaxPacketProtection = False
+# How much known packets before punishment.
+# If the player send more than 100 knownPackets per second, the player get punished.
+KnownPacketsBeforeBan = 100
+# Punishments
+# 1 - broadcast warning to gms only
+# 2 - kick player (default)
+# 3 - kick & ban player (Accesslevel -99)
+KnownPacketsPunishment = 2

# Minimum and maximum protocol revision that server allow to connect.
# You must keep MinProtocolRevision <= MaxProtocolRevision.
Index: C:/Workspace/L2_GameServer_It/java/net/sf/l2j/Config.java
===================================================================
--- C:/Workspace/L2_GameServer_It/java/net/sf/l2j/Config.java	(revision 1025)
+++ C:/Workspace/L2_GameServer_It/java/net/sf/l2j/Config.java	(working copy)
@@ -78,6 +78,10 @@
     /** Maximum number of players allowed to play simultaneously on server */
     public static int   MAXIMUM_ONLINE_USERS;
     
+    public static boolean ENABLE_MAX_PACKET_PROTECTION;
+    public static int MAX_KNOWN_PACKETS;
+    public static int KNOWN_PACKETS_PUNiSHMENT;
+    
     // Setting for serverList
     /** Displays [] in front of server name ? */
     public static boolean SERVER_LIST_BRACKET;
@@ -1120,6 +1124,10 @@

                 MAX_CHARACTERS_NUMBER_PER_ACCOUNT = Integer.parseInt(serverSettings.getProperty("CharMaxNumber", "0"));
                 MAXIMUM_ONLINE_USERS        = Integer.parseInt(serverSettings.getProperty("MaximumOnlineUsers", "100"));
+                
+                ENABLE_MAX_PACKET_PROTECTION = Boolean.parseBoolean(serverSettings.getProperty("MaxPacketProtection", "false"));
+                MAX_KNOWN_PACKETS = Integer.parseInt(serverSettings.getProperty("KnownPacketsBeforeBan", "5"));
+                KNOWN_PACKETS_PUNiSHMENT = Integer.parseInt(serverSettings.getProperty("KnownPacketsPunishment", "2"));
                
                 MIN_PROTOCOL_REVISION   = Integer.parseInt(serverSettings.getProperty("MinProtocolRevision", "660"));
                 MAX_PROTOCOL_REVISION   = Integer.parseInt(serverSettings.getProperty("MaxProtocolRevision", "665"));
@@ -2082,6 +2090,10 @@
         else if (pName.equalsIgnoreCase("AutoDeleteInvalidQuestData")) AUTODELETE_INVALID_QUEST_DATA = Boolean.valueOf(pValue);

         else if (pName.equalsIgnoreCase("MaximumOnlineUsers")) MAXIMUM_ONLINE_USERS = Integer.parseInt(pValue);
+        
+        else if (pName.equalsIgnoreCase("MaxPacketProtection")) ENABLE_MAX_PACKET_PROTECTION = Boolean.parseBoolean(pValue);
+        else if (pName.equalsIgnoreCase("KnownPacketsBeforeBan")) MAX_KNOWN_PACKETS = Integer.parseInt(pValue);
+        else if (pName.equalsIgnoreCase("KnownPacketsPunishment")) KNOWN_PACKETS_PUNiSHMENT = Integer.parseInt(pValue);

         else if (pName.equalsIgnoreCase("ZoneTown")) ZONE_TOWN = Integer.parseInt(pValue);

Index: C:/Workspace/L2_GameServer_It/java/net/sf/l2j/gameserver/network/L2GameClient.java
===================================================================
--- C:/Workspace/L2_GameServer_It/java/net/sf/l2j/gameserver/network/L2GameClient.java	(revision 1025)
+++ C:/Workspace/L2_GameServer_It/java/net/sf/l2j/gameserver/network/L2GameClient.java	(working copy)
@@ -41,6 +41,7 @@
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.model.entity.L2Event;
import net.sf.l2j.gameserver.serverpackets.L2GameServerPacket;
+import net.sf.l2j.gameserver.util.FloodProtector;
import net.sf.l2j.util.EventData;

import com.l2jserver.mmocore.network.MMOClient;
@@ -84,6 +85,9 @@
	// Flood protection
	public byte packetsSentInSec = 0;
	public int packetsSentStartTick = 0;
+	 
+    // KnownPacket protection
+    private int knownPacketCount = 100;

	public L2GameClient(MMOConnection<L2GameClient> con)
	{
@@ -489,6 +493,26 @@
     	}
     }
     
+    public boolean checkknownPackets()
+	{
+		if(this.getActiveChar() != null && 
+				!FloodProtector.getInstance().tryPerformAction(this.getActiveChar().getObjectId(), FloodProtector.PROTECTED_KNOWNPACKET))
+		{
+			knownPacketCount++;
+			if (knownPacketCount >= Config.MAX_KNOWN_PACKETS)
+			{
+				return true;
+			}
+			else
+				return false;
+		}
+		else
+		{
+			knownPacketCount = 0;
+			return false;
+		}
+	}
+    
     /**
      * Produces the best possible string representation of this client.
      */
Index: C:/Workspace/L2_GameServer_It/java/net/sf/l2j/gameserver/network/L2GamePacketHandler.java
===================================================================
--- C:/Workspace/L2_GameServer_It/java/net/sf/l2j/gameserver/network/L2GamePacketHandler.java	(revision 1025)
+++ C:/Workspace/L2_GameServer_It/java/net/sf/l2j/gameserver/network/L2GamePacketHandler.java	(working copy)
@@ -18,10 +18,13 @@
package net.sf.l2j.gameserver.network;

import java.nio.ByteBuffer;
+import java.sql.Time;
import java.util.concurrent.RejectedExecutionException;
import java.util.logging.Logger;

import net.sf.l2j.Config;
+import net.sf.l2j.gameserver.GmListTable;
+import net.sf.l2j.gameserver.LoginServerThread;
import net.sf.l2j.gameserver.ThreadPoolManager;
import net.sf.l2j.gameserver.clientpackets.*;
import net.sf.l2j.gameserver.network.L2GameClient.GameClientState;
@@ -811,6 +814,8 @@
      	byte[] array = new byte[size];
      	buf.get(array);
      	_log.warning(Util.printData(array, size));
+     	if (Config.ENABLE_MAX_PACKET_PROTECTION)
+     		knownPacketProtection(client);
	}

	private void printDebugDoubleOpcode(int opcode, int id2, ByteBuffer buf, GameClientState state, L2GameClient client)
@@ -820,7 +825,50 @@
      	byte[] array = new byte[size]; 
      	buf.get(array);
      	_log.warning(Util.printData(array, size));
+     	if (Config.ENABLE_MAX_PACKET_PROTECTION)
+     		knownPacketProtection(client);
	}
+	
+	private void knownPacketProtection(L2GameClient client)
+	{
+		if(client.getActiveChar() != null && client.checkknownPackets())
+		{
+			punish(client);
+			return;
+		}
+	}
+	
+	private void punish(L2GameClient client)
+	{
+		switch(Config.KNOWN_PACKETS_PUNiSHMENT)
+		{
+			case(1):
+				if (client.getActiveChar() != null)
+				{
+					GmListTable.broadcastMessageToGMs("Player " + client.getActiveChar().toString() + " flooding known packets.");
+				}
+				break;
+			case(2):
+				_log.warning("PacketProtection: " + client.toString() + " got kicked due flooding of known packets");
+				if (client.getActiveChar() != null) 
+				{
+					GmListTable.broadcastMessageToGMs("Player " + client.getActiveChar().toString() + " flooding known packets and got kicked.");
+					client.getActiveChar().sendMessage("You are will be kicked for known packet flooding, GM informed.");
+					client.getActiveChar().closeNetConnection();
+				}
+				break;
+			case(3):
+				_log.warning("PacketProtection: " + client.toString() + " got banned due flooding of known packets");
+				LoginServerThread.getInstance().sendAccessLevel(client.getAccountName(), -99);
+				if(client.getActiveChar() != null)
+				{
+					GmListTable.broadcastMessageToGMs("Player " + client.getActiveChar().toString() + " flooding known packets and got banned.");
+					client.getActiveChar().sendMessage("You are banned for known packet flooding, GM informed.");
+					client.getActiveChar().closeNetConnection();
+				}
+				break;
+		}
+	}

	// impl
	public L2GameClient create(MMOConnection<L2GameClient> con)
Index: C:/Workspace/L2_GameServer_It/java/net/sf/l2j/gameserver/util/FloodProtector.java
===================================================================
--- C:/Workspace/L2_GameServer_It/java/net/sf/l2j/gameserver/util/FloodProtector.java	(revision 1025)
+++ C:/Workspace/L2_GameServer_It/java/net/sf/l2j/gameserver/util/FloodProtector.java	(working copy)
@@ -50,15 +50,16 @@

	// =========================================================
	// Enum
-	private static final int PROTECTEDACTIONSIZE = 3;
+	private static final int PROTECTEDACTIONSIZE = 4;

	// reuse delays for protected actions (in game ticks 1 tick = 100ms)
-	private static final int[] REUSEDELAY = new int[]{ 4, 42, 42 };
+	private static final int[] REUSEDELAY = new int[]{ 4, 42, 42, 15 };

	// protected actions
	public static final int PROTECTED_USEITEM	= 0;
	public static final int PROTECTED_ROLLDICE	= 1;
	public static final int PROTECTED_FIREWORK	= 2;
+	public static final int PROTECTED_KNOWNPACKET = 100;

	// =========================================================
	// Constructor

Link to comment
Share on other sites

:D, players send to server max. +/- 100 packets for second, when they send more - they want lag server!!!

 

And name of protection? Its really irrelevant.

 

Important its, that works ;).

 

Keep smile guys  :P.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.




  • Posts

    • Thank you 😊👍 working great! 
    • MidnightSell team WTB/WTS GOLD TWW EU/US all servers Cataclysm all servers Payment Visa/Master/Btc/Eth/Trc-20/Erc-20 (all payments within 10 min) For all question pls dm Discord https://discord.gg/h8AN57qJjK Or Telegram @MidnightSell
    • GOSTEI MUITO DO VIASUAL DO SERVE COMO POSSO ADQUIRI ESSA REV PACK   
    • Helly everyone . I use L2jmobius interlude , i did everything , installed the db compiled the Build in eclipse Gameserver seems to lead OK , but it fails to connect to loginserver When i click to start the loginserver it says  "Loginserver terminated abnormally" This is wheat gameserver shows me :    [05/10 17:25:12] LoginServerThread: Connecting to login on 127.0.0.1:9014 [05/10 17:25:12] LoginServerThread: LoginServer not available, trying to reconnect... [05/10 17:25:17] LoginServerThread: Connecting to login on 127.0.0.1:9014 [05/10 17:25:17] LoginServerThread: LoginServer not available, trying to reconnect... [05/10 17:25:22] LoginServerThread: Connecting to login on 127.0.0.1:9014 [05/10 17:25:22] LoginServerThread: LoginServer not available, trying to reconnect...   And This is my login config file:   # --------------------------------------------------------------------------- # Login Server Settings # --------------------------------------------------------------------------- # This is the server configuration file. Here you can set up the connection information for your server. # This was written with the assumption that you are behind a router. # Dumbed Down Definitions... # LAN (LOCAL area network) - typically consists of computers connected to the same router as you. # WAN (WIDE area network) - typically consists of computers OUTSIDE of your router (ie. the internet). # x.x.x.x - Format of an IP address. Do not include the x'es into settings. Must be real numbers. # --------------------------------------------------------------------------- # Networking # --------------------------------------------------------------------------- # Bind ip of the LoginServer, use 0.0.0.0 to bind on all available IPs # WARNING: <u><b><font color="red">Please don't change default IPs here if you don't know what are you doing!</font></b></u> # WARNING: <u><b><font color="red">External/Internal IPs are now inside "ipconfig.xml" file.</font></b></u> # Default: 0.0.0.0 LoginserverHostname = 0.0.0.0 # Default: 2106 LoginserverPort = 2106 # The address on which login will listen for GameServers, use * to bind on all available IPs # WARNING: <u><b><font color="red">Please don't change default IPs here if you don't know what are you doing!</font></b></u> # WARNING: <u><b><font color="red">External/Internal IPs are now inside "ipconfig.xml" file.</font></b></u> # Default: 127.0.0.1 LoginHostname = 127.0.0.1 # The port on which login will listen for GameServers # Default: 9014 LoginPort = 9014 # --------------------------------------------------------------------------- # Database # --------------------------------------------------------------------------- # Specify the JDBC driver class for your database. # Default: org.mariadb.jdbc.Driver Driver = org.mariadb.jdbc.Driver # Database URL # Default: jdbc:mariadb://localhost/l2jmobiusinterlude?useUnicode=true&characterEncoding=utf-8&useSSL=false&connectTimeout=10000&interactiveClient=true&sessionVariables=wait_timeout=600,interactive_timeout=600&autoReconnect=true URL = jdbc:mariadb://localhost/l2jmobiusinterlude?useUnicode=true&characterEncoding=utf-8&useSSL=false&connectTimeout=10000&interactiveClient=true&sessionVariables=wait_timeout=600,interactive_timeout=600&autoReconnect=true # Database user info. Default is "root" but it's not recommended. Login = root # Database user password, leave empty for no password. Password = root # Maximum number of database connections to maintain in the pool. # Default: 5 MaximumDatabaseConnections = 5 # Determine whether database connections should be tested for availability. # Default: False TestDatabaseConnections = False # --------------------------------------------------------------------------- # Automatic Database Backup Settings # --------------------------------------------------------------------------- # Generate database backups when server restarts or shuts down.  BackupDatabase = False # Path to MySQL bin folder. Only necessary on Windows. MySqlBinLocation = C:/xampp/mysql/bin/ # Path where MySQL backups are stored. BackupPath = ../backup/ # Maximum number of days that backups will be kept. # Old files in backup folder will be deleted. # Set to 0 to disable. BackupDays = 30 # --------------------------------------------------------------------------- # Thread Configuration # --------------------------------------------------------------------------- # Defines the number of threads in the scheduled thread pool. # If set to -1, this will be determined by available processors divided by 2. ScheduledThreadPoolSize = 2 # Defines the number of threads in the instant thread pool. # If set to -1, this will be determined by available processors divided by 2. InstantThreadPoolSize = 2 # --------------------------------------------------------------------------- # Security # --------------------------------------------------------------------------- # How many times you can provide an invalid account/pass before the IP gets banned. # Default: 5 LoginTryBeforeBan = 5 # Time you won't be able to login back again after LoginTryBeforeBan tries to login. # Default: 900 (15 minutes) LoginBlockAfterBan = 900 # If set to True any GameServer can register on your login's free slots # Default: True AcceptNewGameServer = True # Flood Protection. All values are in milliseconds. # Default: True EnableFloodProtection = True # Default: 15 FastConnectionLimit = 15 # Default: 700 NormalConnectionTime = 700 # Default: 350 FastConnectionTime = 350 # Default: 50 MaxConnectionPerIP = 50 # --------------------------------------------------------------------------- # Misc Login Settings # --------------------------------------------------------------------------- # If False, the license (after the login) will not be shown. # Default: True ShowLicence = True # Default: True AutoCreateAccounts = True # Datapack root directory. # Defaults to current directory from which the server is started. DatapackRoot = . # --------------------------------------------------------------------------- # Scheduled Login Restart # --------------------------------------------------------------------------- # Enable disable scheduled login restart. # Default: False LoginRestartSchedule = False # Time in hours. # Default: 24 LoginRestartTime = 24    
  • Topics

×
×
  • Create New...