Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PacketCore

A Bukkit/Spigot plugin for working with Minecraft traffic as raw bytes. Runs on Spigot and Paper, Folia included, on 1.21.x through 26.x

The idea

Most packet plugins decode, PacketCore doesn't A handler gets injected into each player's netty channel just before the packet decoder, so traffic passes through untouched. Reading a packet doesn't copy it, and nothing gets decoded unless something asks for it PacketEvents and ProtocolLib are soft deps, when present their channel access is used instead of the built-in reflection

What it does

  • pipe - list, add, remove, replace netty handlers on a live connection
  • opt - read and write channel options (TCP_NODELAY, SO_SNDBUF, AUTO_READ, ...)
  • rec / replay - capture raw frames to files, feed them back
  • diff - compare two recordings byte by byte
  • inspect - stream hex of everything a connection sends and receives
  • fuzz - throw random packets at a connection
  • bytes - inject raw hex into a connection

Commands

/packetcore pipe <player> [list|add <name>|remove <name>|replace <name> <newname>]
/packetcore opt <player> <get|set> <option> [value]
/packetcore rec <player> <on|off|save> [name]
/packetcore replay <player> <file> [in|out]
/packetcore diff <fileA> <fileB>
/packetcore inspect <player> <on|off>
/packetcore fuzz <player> <count> [len]
/packetcore bytes <player> <hex>

/pkt is an alias. All of it needs packetcore.admin, which ops get by default.

As a library

Other plugins hook the bus:

PacketCore core = PacketCore.get();

core.bus().add(new Listen() {
    @Override
    public Edit onOutbound(UUID id, View v) {
        byte[] b = v.bytes();
        b[0] ^= 0xff;
        return Edit.bytes(b);
    }
});

Listeners get a View a zerocopy window over the raw buffer with lazy accessors (get, varint, hex). Returning Edit.DROP kills the packet, Edit.bytes(...) swaps in new payload bytes, Edit.PASS leaves it alone

Recording files

Frames land in plugins/PacketCore/recordings as .pkrc files: a PKRC header with version byte, then per frame a direction byte, 4-byte length, 8-byte nanosecond timestamp, and the payload. Saves happen off the main thread

Build

gradlew build on JDK 21, jar in build/libs/PacketCore.jar. spigot-api and netty are compileOnly, the server provides both, so nothing is shaded. publishToMavenLocal pushes the jar plus sources and a pom for use as a compile dependency

About

Packet manipulation

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages