mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-02 10:53:44 +00:00
feat(capture): record whole packets of an account, a character or everything on every server
Staff arm a packet capture on the dashboard; master passes MESSAGE_CAPTURE_CONTROL ARM to every world, auth and chat and arms its own. Each server's PacketCapture tap (dServer receive, and a send hook in RakPeer::Send so replica constructions are seen too) records into one preallocated chunk per server and ships sealed chunks through master on the main loop when capture_flush_bytes or capture_flush_interval_ms is reached; past capture_buffer_max_mb the oldest chunks are dropped and the dashboard records a gap. Nothing is armed: one flag check. - targets: an account (from its login; packets before the login are kept per connection and added once auth or the world knows whose they are), a character (from when it is picked), or everything; up to 8 at once (a bit each in the record mask) - worlds and auth record their clients' packets and the master link messages of a captured player (session keys by name, zone transfers by request, player added/removed, migration); chat finds the player in each packet; master records server traffic for everything - secrets are never recorded: structs that carry them (login request, login response user key, world validation session key, session key messages between servers) are read, blanked and written again before recording; auth keeps only the handshake and login - PacketDecoder: a registry by service and message id names every packet and decodes the registered structs; CaptureBundle is the file format (DLUBNDL1, metadata, records); CaptureTools orders records on one timeline, pulls movement out, makes bundles portable or anonymous and diffs replays - the dashboard keeps packet captures in message_capture_sessions (capture_kind 1) and their packets in a file under capture_dir, one write per batch; arming is audited - MESSAGE_CAPTURE_CONTROL/DATA only gain appended enum values and trailing fields Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
8
thirdparty/raknet/Source/RakPeer.cpp
vendored
8
thirdparty/raknet/Source/RakPeer.cpp
vendored
@@ -975,6 +975,8 @@ bool RakPeer::GetConnectionList( SystemAddress *remoteSystems, unsigned short *n
|
||||
// Returns:
|
||||
// False if we are not connected to the specified recipient. True otherwise
|
||||
// --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
RakPeerSendHook g_RakPeerSendHook = 0;
|
||||
|
||||
bool RakPeer::Send( const char *data, const int length, PacketPriority priority, PacketReliability reliability, char orderingChannel, SystemAddress systemAddress, bool broadcast )
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
@@ -990,6 +992,9 @@ bool RakPeer::Send( const char *data, const int length, PacketPriority priority,
|
||||
if ( broadcast == false && systemAddress == UNASSIGNED_SYSTEM_ADDRESS )
|
||||
return false;
|
||||
|
||||
if (g_RakPeerSendHook)
|
||||
g_RakPeerSendHook(this, (const unsigned char*)data, BYTES_TO_BITS(length), systemAddress, broadcast);
|
||||
|
||||
if (broadcast==false && router && IsConnected(systemAddress)==false)
|
||||
{
|
||||
return router->Send(data, BYTES_TO_BITS(length), priority, reliability, orderingChannel, systemAddress);
|
||||
@@ -1017,6 +1022,9 @@ bool RakPeer::Send( const RakNet::BitStream * bitStream, PacketPriority priority
|
||||
if ( broadcast == false && systemAddress == UNASSIGNED_SYSTEM_ADDRESS )
|
||||
return false;
|
||||
|
||||
if (g_RakPeerSendHook)
|
||||
g_RakPeerSendHook(this, bitStream->GetData(), bitStream->GetNumberOfBitsUsed(), systemAddress, broadcast);
|
||||
|
||||
if (broadcast==false && router && IsConnected(systemAddress)==false)
|
||||
{
|
||||
return router->Send((const char*)bitStream->GetData(), bitStream->GetNumberOfBitsUsed(), priority, reliability, orderingChannel, systemAddress);
|
||||
|
||||
5
thirdparty/raknet/Source/RakPeer.h
vendored
5
thirdparty/raknet/Source/RakPeer.h
vendored
@@ -42,6 +42,11 @@ int RAK_DLL_EXPORT SystemAddressAndIndexComp( const SystemAddress &key, const Sy
|
||||
/// The primary interface for RakNet, RakPeer contains all major functions for the library.
|
||||
/// See the individual functions for what the class can do.
|
||||
/// \brief The main interface for network communications
|
||||
/// DLU addition: called on the caller's thread for every packet the application sends with Send (not RakNet's own
|
||||
/// connection messages), before it is queued. The server's packet capture sets it only while a capture is armed.
|
||||
typedef void (*RakPeerSendHook)(RakPeerInterface* peer, const unsigned char* data, BitSize_t bits, SystemAddress systemAddress, bool broadcast);
|
||||
extern RakPeerSendHook g_RakPeerSendHook;
|
||||
|
||||
class RAK_DLL_EXPORT RakPeer : public RakPeerInterface
|
||||
{
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user