Server Login Response Success Packet done

This commit is contained in:
liujiahua123123 2019-08-18 20:33:05 +08:00
parent dc3d8063b7
commit 74ca633b7d
2 changed files with 35 additions and 5 deletions

View File

@ -1,9 +1,7 @@
package net.mamoe.mirai.network.packet.server.login
import net.mamoe.mirai.network.Protocol
import net.mamoe.mirai.network.packet.server.ServerPacket
import net.mamoe.mirai.network.packet.server.dataInputStream
import net.mamoe.mirai.network.packet.server.readVarString
import net.mamoe.mirai.network.packet.server.*
import net.mamoe.mirai.util.TEACryptor
import net.mamoe.mirai.util.hexToBytes
import net.mamoe.mirai.util.hexToShort
@ -27,7 +25,8 @@ class ServerLoginResponseSuccessPacket(input: DataInputStream, val packetDataLen
@ExperimentalUnsignedTypes
override fun decode() {
/**
* Version 1 @Deprecated
this.input.skip(7)//8
encryptionKey = this.input.readNBytes(16)//24
@ -88,6 +87,33 @@ class ServerLoginResponseSuccessPacket(input: DataInputStream, val packetDataLen
age = HexToDec(取文本中间(data, 取文本长度(data) - 82, 5))
gender = 取文本中间(data, 取文本长度(data) - 94, 2)
*/
* **/
/** version 2 */
this.input.skip(7)//8
this.encryptionKey = this.input.readNBytes(16)//24
this.input.skip(2)//26
this.token38 = this.input.readNBytes(56)//82
this.input.skip(60L)//142
val msgLength = when (this.input.readNBytes(2).toUByteArray().toHexString()) {
"01 07" -> 0
"00 33" -> 28
"01 10" -> 64
else -> throw IllegalStateException()
}
this._0828_rec_decr_key = this.input.readNBytes(171 + msgLength,16)
this.token88 = this.input.readNBytes(189 + msgLength,136)
val nickLength = this.input.goto(624 + msgLength).readByte().toInt()
this.nick = this.input.readVarString(nickLength)
this.age = this.input.goto(packetDataLength - 28).readShort()
this.gender = this.input.goto(packetDataLength - 32).readByte().toInt()
}
}

View File

@ -17,7 +17,7 @@ fun main(){
// val packet = ClientPasswordSubmissionPacket(1994701021,"xiaoqqq",)
val data = "00 01 09 00 70 00 01 B8 51 6F CD 6A 1B 27 7B 76 41 68 F3 BA 33 7F 73 00 38 35 3E 7C 76 37 D4 AD A1 2C E0 C7 23 9A 44 0D 2C 38 53 9F 94 80 E1 20 B9 2F F5 9F 80 3A 8C CB F6 1E 54 3D 09 12 B9 6A FA DB E3 02 63 A9 E1 5A 2C EE 02 39 10 AF 4B 3F 74 00 20 BF AC F4 D7 4F BD 5A 33 1E 08 3E BE D0 E7 61 79 F4 79 14 9D C9 24 67 01 67 AB 7B 23 94 E8 42 A7 00 00 01 03 00 14 00 01 00 10 60 C9 5D A7 45 70 04 7F 21 7D 84 50 5C 66 A5 C6 01 10 00 3C 00 01 00 38 8A 51 0A CC 9D D6 AC A6 BA BA 32 0E 4E E8 04 28 F9 33 E3 2A D5 0A 99 13 14 C0 DE DA 3C 01 B6 CB 58 5C 5F E0 4B 0C C4 1C 1F 28 36 DC 6A B0 6E CE AF 0B D1 17 AD 4B C3 BD 01 07 01 D3 00 01 00 16 00 00 00 01 00 00 00 64 00 00 0D CE 00 09 3A 80 00 00 00 3C 00 02 67 35 45 62 5B 35 2C 46 7D 47 48 5F 52 70 5F 38 00 88 00 04 5D 59 1F DD B7 5F F8 D4 00 00 00 00 00 78 4A 9E EB 20 77 9C D0 02 98 85 9A 48 EA 05 11 AC F4 25 4C 7C 1F E2 18 CD 78 EF 22 07 8D FD E8 51 23 29 CF 64 97 DC E2 1B 3E 99 00 54 37 F8 35 8F 70 0A CB 7C CD 74 6C 9C 3D 81 32 C6 9B 8A B4 16 D2 41 0D B3 27 CC C7 F9 07 71 EB 6D FD 75 2F 95 75 31 21 D5 22 39 16 FA F6 14 3C 10 81 20 21 E4 31 D2 A3 A4 49 EB EC DA AC 38 0C 27 C9 3F 8A A4 0C 32 58 56 E4 70 47 AB 6A 3E 28 57 2E 55 45 24 56 69 69 43 51 27 2C 71 00 78 00 01 5D 59 1F DD 00 70 98 9E 49 87 39 20 2A 9E 75 28 3D D5 05 9C AF 0F 60 BC 95 2E B9 CF 86 E6 C6 54 FD E7 CF EA 1E 1A 2E E2 99 DE EB CC FF 39 11 6E 5C 8C 17 E0 E4 7E DD 55 CF 09 F7 EA 1A 9E AF CB BC 36 E0 B8 7A 9E 47 34 68 61 E9 1E A0 29 AE 17 A2 EA A6 72 3D 5D 6B 8A 22 A2 1C 24 B8 B2 A0 00 56 11 A9 12 B3 31 D6 3A 2D 5A C0 21 D2 52 56 14 C1 8F EE D9 2B C3 00 83 01 66 33 7A 39 39 32 79 40 49 37 42 4B 62 5E 7B 68 00 70 00 01 5D 59 1F DD 00 68 04 49 23 69 F2 FC C3 81 DC F1 D8 E6 AE E7 69 C9 78 EB EB 90 B1 B4 42 DC DD 1D EF 87 30 72 36 20 1E B6 89 5B AF A5 88 25 60 B7 E3 66 30 D4 0A E5 D9 FA 74 2C 18 E2 26 6C DC F7 42 38 21 23 25 08 57 45 2F 4B BF BF 83 9F CA C5 04 5C 7A 97 8C 4B 1B 6F F7 EE A7 5D 4C 94 B2 CF F6 8D 32 00 21 46 9B C6 9D C5 4B 75 32 19 5E 3D 51 32 3A 79 55 71 25 5F 4B 6B 4A 6E 5D 27 01 08 00 29 00 01 00 25 00 1D 02 5B 14 28 E0 B9 91 E2 80 A2 CC 80 CF 89 E2 80 A2 CC 81 E0 B9 91 29 02 13 80 02 00 05 00 04 00 00 00 01 01 15 00 10 A0 D6 11 4B 1F 12 26 55 0D 21 1D BB 53 5B 4E 12"
val data = "00 01 09 00 70 00 01 5C 71 80 A6 BA 20 62 2E C1 BE BF F2 47 37 40 A1 00 38 91 25 85 58 18 D3 67 77 2C 4D 02 D8 66 A6 F7 3E 57 D8 CE 01 47 7F D0 8F 13 C8 3A E5 19 A2 60 BC 4C 9A 35 4E 92 9F 21 48 6C 67 68 36 6B 94 C1 6F 11 8D 55 6B 04 9A 22 C3 00 20 29 7E D4 A7 16 02 07 14 41 90 3A 65 06 AC CB 28 AB 90 DB 46 33 C9 C0 1D 06 44 7A 92 17 C3 A5 F3 00 00 01 03 00 14 00 01 00 10 60 C9 5D A7 45 70 04 7F 21 7D 84 50 5C 66 A5 C6 01 07 01 D3 00 01 00 16 00 00 00 01 00 00 00 64 00 00 0D B6 00 09 3A 80 00 00 00 3C 00 02 2E 29 4E 47 5F 68 78 2C 47 25 5F 59 50 65 60 5D 00 88 00 04 5D 59 45 17 B7 5F F8 D4 00 00 00 00 00 78 38 E0 3B 23 4A C5 0E 93 CB C1 66 96 37 8B 46 B2 86 23 3F 2D 09 45 E0 16 1C E9 9C 11 7A FA 2D A8 50 47 42 74 01 06 84 76 0E 5F C6 04 29 1A 4A 65 AA 93 49 DF BD 00 ED 80 B8 26 CA 80 E8 20 6D 15 43 DD D8 E6 48 C2 8A 5A F8 70 6B 51 3A E2 2D 21 95 4B 6A 75 A8 90 CA B1 C0 E5 73 99 D7 59 D8 DD 3D C9 5C E4 49 61 22 11 60 85 48 C4 7D E0 84 62 AD B3 13 84 61 C1 9E 19 35 41 44 44 37 3F 21 33 64 4B 37 5D 77 6D 61 3F 00 78 00 01 5D 59 45 17 00 70 A4 D9 44 9E 95 51 B4 B0 91 CC 1E DB 34 F9 F7 13 8B 30 08 C0 AE 33 22 9C FF 87 CF 9B A2 B0 E5 E1 D0 E0 AD DD 8F E9 F6 1E 01 1F AA 74 46 66 B4 81 54 B9 29 E5 FC 0B 7F C9 13 AE 32 BA D6 55 2E B0 A1 30 24 B6 F2 E7 62 F9 2E 00 E4 51 61 50 7C D1 36 E8 61 96 36 FF B7 32 74 3C 2A F7 74 63 DA 7D 57 84 18 ED 84 E9 D8 87 6D 66 1D D5 84 D4 23 99 00 83 01 63 2A 69 2E 25 79 28 3B 29 33 29 40 28 54 7E 21 00 70 00 01 5D 59 45 17 00 68 6F 1F FB 31 7B D7 B7 D8 91 32 D7 20 8B 8A F6 02 C8 22 E5 24 8C 25 F2 6A C5 B0 ED 35 01 BF AF 42 72 33 4E FB 3F D3 02 BA F4 46 2B 68 20 0B E3 39 81 B1 D3 8A E0 1B 0F 69 D1 70 AE 49 A5 24 4F BB 58 4F F8 31 A0 37 4C CD F1 12 35 80 99 7D 25 CA F9 E9 45 B6 B0 57 56 66 61 C5 7B 90 57 BF E2 2C 94 91 80 1A B0 D7 21 A8 44 2C 33 4A 29 77 5F 71 40 41 38 3D 7A 41 65 33 01 08 00 29 00 01 00 25 00 1D 02 5B 14 28 E0 B9 91 E2 80 A2 CC 80 CF 89 E2 80 A2 CC 81 E0 B9 91 29 02 13 80 02 00 05 00 04 00 00 00 01 01 15 00 10 F9 86 85 81 30 F6 1B E0 E7 97 98 F6 46 C3 4F B2"
val s = DataInputStream(data.hexToBytes().inputStream())
val packet = ServerLoginResponseSuccessPacket(s,(data.length+1)/3)
packet.decode()
@ -32,4 +32,8 @@ fun main(){
System.out.println("nick: " + packet.nick)
System.out.println("age: " + packet.age)
System.out.println("gender: " + packet.gender)
}