我用Java编写了一个数据包嗅探器,它工作得很完美,但现在我有一个带整数的文本文件,我不知道如何解码它们。 我已经尝试过使用它:Minecraft Protocol,但我仍然无法对数据包进行解码...
输出:
[Client] 15
[Client] 0
[Client] 47
[Client] 9
[Client] 108
[Client] 111
[Client] 99
[Client] 97
[Client] 108
[Client] 104
[Client] 111
[Client] 115
[Client] 116
[Client] 30
[Client] 97
[Client] 1
[Client] 1
[Client] 0
[Server] 118
[Server] 0
[Server] 116
[Server] 123
[Server] 34
[Server] 100
[Server] 101
[Server] 115
[Server] 99
[Server] 114
[Server] 105
[Server] 112
[Server] 116
[Server] 105
[Server] 111
[Server] 110
[Server] 34
[Server] 58
[Server] 34
[Server] 65
[Server] 32
[Server] 77
[Server] 105
[Server] 110
[Server] 101
[Server] 99
[Server] 114
[Server] 97
[Server] 102
[Server] 116
[Server] 32
[Server] 83
[Server] 101
[Server] 114
[Server] 118
[Server] 101
[Server] 114
[Server] 34
[Server] 44
[Server] 34
[Server] 112
[Server] 108
[Server] 97
[Server] 121
[Server] 101
[Server] 114
[Server] 115
[Server] 34
[Server] 58
[Server] 123
[Server] 34
[Server] 109
[Server] 97
[Server] 120
[Server] 34
[Server] 58
[Server] 50
[Server] 48
[Server] 44
[Server] 34
[Server] 111
[Server] 110
[Server] 108
[Server] 105
[Server] 110
[Server] 101
[Server] 34
[Server] 58
[Server] 48
[Server] 125
[Server] 44
[Server] 34
[Server] 118
[Server] 101
[Server] 114
[Server] 115
[Server] 105
[Server] 111
[Server] 110
[Server] 34
[Server] 58
[Server] 123
[Server] 34
[Server] 110
[Server] 97
[Server] 109
[Server] 101
[Server] 34
[Server] 58
[Server] 34
[Server] 83
[Server] 112
[Server] 105
[Server] 103
[Server] 111
[Server] 116
[Server] 32
[Server] 49
[Server] 46
[Server] 56
[Server] 46
[Server] 55
[Server] 34
[Server] 44
[Server] 34
[Server] 112
[Server] 114
[Server] 111
[Server] 116
[Server] 111
[Server] 99
[Server] 111
[Server] 108
[Server] 34
[Server] 58
[Server] 52
[Server] 55
[Server] 125
[Server] 125
[Client] 9
[Client] 1
[Client] 0
[Client] 0
[Client] 0
[Client] 0
[Client] 10
[Client] 158
[Client] 220
[Client] 203
[Server] 9
[Server] 1
[Server] 0
[Server] 0
[Server] 0
[Server] 0
[Server] 10
[Server] 158
[Server] 220
[Server] 203
[Server] -1
[Client] -1
如果有人有答案,我会非常感激。
答案 0 :(得分:3)
似乎没有整数高于255,所以这是每行输出一个字节。您看到的数据包可能会被压缩,但如果没有看到您的Minecraft用户/服务器的配置,则无法说出来。如果它们实际上是压缩的 - 您将需要解压缩它们才能分析它们。
为了帮助您解码,我强烈推荐Wireshark。下载并重新运行您的网络捕获。然后将解码后的输出与程序的输出进行比较。 Wireshark将在数据包中给出每个数据成员的含义。
编辑:解码的哪个部分不清楚?在编程模式下使用笔和纸和窗口计算器这里是第一个数据包的解码:15 - Varint - length of the packet
0 - Varint - packet ID - Handshake
47 - VarInt - protocol version
Following bytes are length prefixed server address in UTF-8:
9 - Lenght
108 - l
111 - o
99 - c
97 - a
108 - l
104 - h
111 - o
115 - s
116 - t
Following 2 bytes are server port in unsigned short format (I guess 7777)
30
97
1 - Varint - Next state
最后2个字节对我来说不清楚。
简而言之 - 对于每个数据包: