Jump to content

Recommended Posts

Posted

Unknown Packets Protection Spam. ( This diff is for Interlude L2J but with some modifications can be inserted in Gracia Final or Gracia pt2 etc )

 

Your server will have protections from PHX Spammers, sending unknown packets.

 

Diff file:

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 unknownPacket flooding
+PacketProtection = False
+# How much unknown packets before punishment.
+# If the player send more than 5 unknownPackets per second, the player get punished.
+UnknownPacketsBeforeBan = 5
+# Punishments
+# 1 - broadcast warning to gms only
+# 2 - kick player (default)
+# 3 - kick & ban player (Accesslevel -99)
+UnknownPacketsPunishment = 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_PACKET_PROTECTION;
+    public static int MAX_UNKNOWN_PACKETS;
+    public static int UNKNOWN_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_PACKET_PROTECTION = Boolean.parseBoolean(serverSettings.getProperty("PacketProtection", "false"));
+                MAX_UNKNOWN_PACKETS = Integer.parseInt(serverSettings.getProperty("UnknownPacketsBeforeBan", "5"));
+                UNKNOWN_PACKETS_PUNiSHMENT = Integer.parseInt(serverSettings.getProperty("UnknownPacketsPunishment", "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("PacketProtection")) ENABLE_PACKET_PROTECTION = Boolean.parseBoolean(pValue);
+        else if (pName.equalsIgnoreCase("UnknownPacketsBeforeBan")) MAX_UNKNOWN_PACKETS = Integer.parseInt(pValue);
+        else if (pName.equalsIgnoreCase("UnknownPacketsPunishment")) UNKNOWN_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;
+	 
+    // UnknownPacket protection
+    private int unknownPacketCount = 0;

	public L2GameClient(MMOConnection<L2GameClient> con)
	{
@@ -489,6 +493,26 @@
    	}
    }
    
+    public boolean checkUnknownPackets()
+	{
+		if(this.getActiveChar() != null && 
+				!FloodProtector.getInstance().tryPerformAction(this.getActiveChar().getObjectId(), FloodProtector.PROTECTED_UNKNOWNPACKET))
+		{
+			unknownPacketCount++;
+			if (unknownPacketCount >= Config.MAX_UNKNOWN_PACKETS)
+			{
+				return true;
+			}
+			else
+				return false;
+		}
+		else
+		{
+			unknownPacketCount = 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_PACKET_PROTECTION)
+     		unknownPacketProtection(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_PACKET_PROTECTION)
+     		unknownPacketProtection(client);
	}
+	
+	private void unknownPacketProtection(L2GameClient client)
+	{
+		if(client.getActiveChar() != null && client.checkUnknownPackets())
+		{
+			punish(client);
+			return;
+		}
+	}
+	
+	private void punish(L2GameClient client)
+	{
+		switch(Config.UNKNOWN_PACKETS_PUNiSHMENT)
+		{
+			case(1):
+				if (client.getActiveChar() != null)
+				{
+					GmListTable.broadcastMessageToGMs("Player " + client.getActiveChar().toString() + " flooding unknown packets.");
+				}
+				break;
+			case(2):
+				_log.warning("PacketProtection: " + client.toString() + " got kicked due flooding of unknown packets");
+				if (client.getActiveChar() != null) 
+				{
+					GmListTable.broadcastMessageToGMs("Player " + client.getActiveChar().toString() + " flooding unknown packets and got kicked.");
+					client.getActiveChar().sendMessage("You are will be kicked for unknown packet flooding, GM informed.");
+					client.getActiveChar().closeNetConnection();
+				}
+				break;
+			case(3):
+				_log.warning("PacketProtection: " + client.toString() + " got banned due flooding of unknown packets");
+				LoginServerThread.getInstance().sendAccessLevel(client.getAccountName(), -99);
+				if(client.getActiveChar() != null)
+				{
+					GmListTable.broadcastMessageToGMs("Player " + client.getActiveChar().toString() + " flooding unknown packets and got banned.");
+					client.getActiveChar().sendMessage("You are banned for unknown 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_UNKNOWNPACKET = 3;

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

 

Note: this is not 100% Mine, i just make some modifications to make it work on Interlude. Thank you.

 

So, Credits: L2JForum,

Posted

It doesn't exists in any Chronicle of L2J, not in c4, c5, c6, Kamael nowhere.

 

ok than flood with unknown packet a gracia server dumbass its dont exists in it for a reason...

Posted

Maybe in Gracia Final

Watch your language.

my language? please first read what u write and then post it plx ! my language is fine :) i just sayd to intrepid to stop cause ur gonna cry like a baby ;)
Posted

Ohh plz dont start flame,so with this you will have full protect from Phx, i dont know why but i cant trust it...

Posted

Ohh plz dont start flame,so with this you will have full protect from Phx, i dont know why but i cant trust it...

 

no thats not true ONLY if you use INTERLUDE you have with that protection againt 1 exploit with the unknown packet flood thats all

Guest
This topic is now closed to further replies.


  • Posts

    • Do you want stability? Lagless and bugless game? Instant support? Daily PVP? Long-Term playing? You are in the right place, time to start! Lineage2 X70 Interlude NEW Season 2025 February 8th 13:00 UTC+2 Greece/Lithuania: 13:00 UTC+2 Poland/Norway: 12:00 UTC+1 United Kingdom: 11:00 UTC+0 Brazil/Argentina: 8:00 UTC-3 Opening Bonus First 100 players after third class changing will automaticly get Premium Coin award in their inventory. All new players spawn in town of Gludio! All players start from 25 LvL with starter pack (adenas and equipment)! RATES XP: x70 | SP: x70 Party XP/ SP: x1.2 Adenas drop rate: x30 Drop Items: x25 | Spoil: x25 Drop SealStones rate: x1.2 Drop Manor rate: x1 Drop Quest rate: x5 | Reward rates: x2 (NOT FOR ALL) Raid Boss Drop: x10 Raid Boss Adenas Drop: x3 Grand Boss Drop: x1 Grand Boss Adenas Drop: x2 Information NPC Buffer 32 Buffs | 4 Debuffs PET Buffer for all classes [Except Necromancer] Scheme buffer: 3 Profiles. Buffs time: 2 Hours | Summons buffs - 60min. Global Gatekeeper. GM SHOP till weapon / armor / jewel B grade. Caradine letter 3rd part in GM Shop. Offline shop: SELL , PRIVATE CREATION , PACKAGE SALE from 35 LvL ! Mana potions: 500MP/2s. Spawn Protection: 20 Seconds. EVENTS Manager [TVT/DM]. Max Clients for one PC: 5 Rift | 4S Players: 3 Maximum inventory slots: 240 Maximum inventory slots for Dwarf: 250 Custom drop list: - Raid Boss Horus, Ember, Brakki, Nakondas: 1 VIP COIN (25%) | Korim (50%). - Raid Boss Apepi, Shacram, Atraiban, Korim: 1 BEWS (25%). - Raid Boss Glaki, Olkuth: 1-2 BEAS (40%). - Raid Boss Golkonda, Galaxia: 1-3 BEAS (60%). - Raid Boss Shyeed: 1-3 BEWS (30%) | 1-7 BEAS (40%) | 1-5 TOP LS 76 (50%). - Raid Boss Shuriel: 1-7 TOP LS 76 (50%) | 1-4 BEAS (60%). - Raid Boss Ashakiel: 1-2 BEWS (30%) | 1-7 TOP LS 76 (50%) | 1-4 BEAS (75%). - Raid Boss Antharas Priest Cloe: 1-3 BEWS (30%) | 1-7 TOP LS 76 (70%). ------------------------------------------------ - Hestia: Demon Splinters / Forgotten Blande (10%). - Ember: Arcana Mace / Draconic Bow (10%). - Galaxia: Angel Slayer / Heaven's Divider (10%). 1. Baium Lair and TOI 13/14 are PVP zones. 2. Valakas PVP zone near NPC "Klein" and inside Valakas room. 3. Antharas Lair and near "Heart Of Warding" are PVP zones. 4. Frintezza PVP zone is in first Imperial Tomb room. 5. Queen Ant PVP zone after the bridge and near Boss. 6. Zaken ship deck and rooms - PVP area. How to connect STEP BY STEP: 1. Install clear Lineage2 Interlude client 2. Download our patch, delete old system folder and add our 3. Delete, turn off anti virus or add our system folder to anti virus exceptions 4. Run l2.exe from Lineage2/system 5. Enter data on login window and enjoy the game! * You have to remove, turn off or use exceptions of antivirus because of our security protection. It is not a virus. * If you have connection issues with Windows 8 or 10, press right mouse button on l2.exe icon, press Properties, choose compatibility and unmark compatibility mode. Take your friends, clan, alliance, enemys, sharp your swords, clean your armors and meet your destiny at 2025 February 8th 13:00 UTC+2! WWW.L2BLAZE.NET INTERLUDE Empire X70 New Season: 2025 February 8th 13:00 UTC+2! WEBSITE: http://WWW.L2BLAZE.NET
    • Hello all,  i use L2jAcis 409 and i have problem with oly cycle, everyday is a different oly cycle and oly won't finish at the end of the month...almost 50 cycles and no end. I see oly matches in db but no points and after a day pass with /olympiadstat no points... Any help welcome, thank you.
    • Bump NEW USER IN TELEGRAM AND DISCORD IS "mileanum"  NEW USER IN TELEGRAM AND DISCORD IS "mileanum"  NEW USER IN TELEGRAM AND DISCORD IS "mileanum" NEW USER IN TELEGRAM AND DISCORD IS "mileanum" 
  • Topics

×
×
  • Create New...