First comes a VarInt of the packet's length (in bytes). Then there is the 1 byte packet ID, and finally the payload.
First of all, a handshake packet must be sent:
| Field | Example | Field Type | Length |
| #define PITCH_B0 31 | |
| #define PITCH_C1 33 | |
| #define PITCH_CS1 35 | |
| #define PITCH_D1 37 | |
| #define PITCH_DS1 39 | |
| #define PITCH_E1 41 | |
| #define PITCH_F1 44 | |
| #define PITCH_FS1 46 | |
| #define PITCH_G1 49 | |
| #define PITCH_GS1 52 |
| AUS Central Standard Time | 001 | Australia/Darwin | |
|---|---|---|---|
| AUS Central Standard Time | AU | Australia/Darwin | |
| AUS Eastern Standard Time | 001 | Australia/Sydney | |
| AUS Eastern Standard Time | AU | Australia/Sydney Australia/Melbourne | |
| Afghanistan Standard Time | 001 | Asia/Kabul | |
| Afghanistan Standard Time | AF | Asia/Kabul | |
| Alaskan Standard Time | 001 | America/Anchorage | |
| Alaskan Standard Time | US | America/Anchorage America/Juneau America/Metlakatla America/Nome America/Sitka America/Yakutat | |
| Aleutian Standard Time | 001 | America/Adak | |
| Aleutian Standard Time | US | America/Adak |
| """ | |
| zlib License | |
| (C) 2016 jython234 | |
| This software is provided 'as-is', without any express or implied | |
| warranty. In no event will the authors be held liable for any damages | |
| arising from the use of this software. | |
| Permission is granted to anyone to use this software for any purpose, |
| /* | |
| * Copyright (C) 2015 jython234 | |
| */ | |
| CustomPacket cp = new CustomPacket(); | |
| cp.decode(rawBuffer); //The rawbuffer is the raw datagram packet's buffer you have recieved. | |
| System.out.println(cp.sequenceNumber); //Access the sequence number to check if you missed any packets from the client | |
| for(CustomPacket.InternalPacket ip : cp.packets){ // Loop thru all the decoded packets | |
| //Access messageIndex, buffer, etc | |
| System.out.println(Arrays.toString(ip.buffer)); //The decoded packet buffer (ClientConnect, Ping, etc) |
| -- JuiceNet Base Protocol Dissector -- | |
| -- By: jython234 (https://github.com/jython234) -- | |
| -- Copyright (C) 2015 -- | |
| jnb_proto = Proto("JNB", "JuiceNet Base Protocol") | |
| local bit = require("bit") | |
| local subtree | |
| function jnb_proto.dissector (buffer,pinfo,tree) | |
| -- Dissect packets here -- | |
| pinfo.cols.protocol = "JNB" |