Skip to content
This repository has been archived by the owner on Dec 4, 2020. It is now read-only.

Commit

Permalink
PacketGuard: Allow various new packets in CS
Browse files Browse the repository at this point in the history
  • Loading branch information
zach2good committed Oct 10, 2020
1 parent 6b3f9aa commit c2aa517
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/map/map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -606,14 +606,13 @@ int32 parse(int8* buff, size_t* buffsize, sockaddr_in* from, map_session_data_t*

if (map_config.packetguard_enabled && PacketGuard::IsRateLimitedPacket(PChar, SmallPD_Type))
{
ShowError(CL_RED "Rate-limiting packet: Player: %s - Packet: %03hX\n" CL_RESET, PChar->GetName(), SmallPD_Type);
ShowExploit(CL_RED "[PacketGuard] Rate-limiting packet: Player: %s - Packet: %03hX\n" CL_RESET, PChar->GetName(), SmallPD_Type);
continue; // skip this packet
}

if (map_config.packetguard_enabled && !PacketGuard::PacketIsValidForPlayerState(PChar, SmallPD_Type))
{
// TODO: Log exploit
ShowError(CL_RED "Caught mismatch between player substate and recieved packet: Player: %s - Packet: %03hX\n" CL_RESET, PChar->GetName(), SmallPD_Type);
ShowExploit(CL_RED "[PacketGuard] Caught mismatch between player substate and recieved packet: Player: %s - Packet: %03hX\n" CL_RESET, PChar->GetName(), SmallPD_Type);
// TODO: Plug in optional jailutils usage
continue; // skip this packet
}
Expand Down
12 changes: 12 additions & 0 deletions src/map/packet_guard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,28 @@ void Init()

// In Cutscene
allowList[SUBSTATE_IN_CS][0x00A] = true; // Log In To Zone
allowList[SUBSTATE_IN_CS][0x00C] = true; // Event Update (String Update)
allowList[SUBSTATE_IN_CS][0x00D] = true; // Player Leaving Zone(Dezone)
allowList[SUBSTATE_IN_CS][0x00F] = true; // Player Information Request
allowList[SUBSTATE_IN_CS][0x011] = true; // Player Zone Transition Confirmation
allowList[SUBSTATE_IN_CS][0x015] = true; // Player Sync
allowList[SUBSTATE_IN_CS][0x016] = true; // Entity Information Request
allowList[SUBSTATE_IN_CS][0x01A] = true; // Player Action
allowList[SUBSTATE_IN_CS][0x03A] = true; // Sort Inventory
allowList[SUBSTATE_IN_CS][0x053] = true; // LockStyleSet
allowList[SUBSTATE_IN_CS][0x05A] = true; // Map Update (Conquest, Besieged, Campaign)
allowList[SUBSTATE_IN_CS][0x05B] = true; // Event Update (Completion or Update)
allowList[SUBSTATE_IN_CS][0x05C] = true; // Event Update (Update Player Position)
allowList[SUBSTATE_IN_CS][0x061] = true; // Full Char Update
allowList[SUBSTATE_IN_CS][0x0B5] = true; // Chat Message
allowList[SUBSTATE_IN_CS][0x0B6] = true; // Tell Message
allowList[SUBSTATE_IN_CS][0x0DB] = true; // Set Preferred Language
allowList[SUBSTATE_IN_CS][0x0E0] = true; // Set Search Message
allowList[SUBSTATE_IN_CS][0x0F2] = true; // Update Player Zone Boundary
allowList[SUBSTATE_IN_CS][0x112] = true; // Roe Quest Log Request
allowList[SUBSTATE_IN_CS][0x114] = true; // Map Marker Request
allowList[SUBSTATE_IN_CS][0x118] = true; // Not Impl
allowList[SUBSTATE_IN_CS][0x11B] = true; // Not Impl
}

bool PacketIsValidForPlayerState(CCharEntity* PChar, uint16 SmallPD_Type)
Expand Down

0 comments on commit c2aa517

Please sign in to comment.