This commit is contained in:
Him188moe 2019-08-18 17:31:30 +08:00
parent 99a0ec85c5
commit 4cb4b3d9d4
3 changed files with 4 additions and 5 deletions

View File

@ -38,7 +38,7 @@ abstract class ServerPacket(val input: DataInputStream) : Packet {
}
if (bytes.size > 700) {
return ServerLoginResponseSucceedPacketEncrypted(stream)
return ServerLoginResponseSucceedPacketEncrypted(stream, bytes.size)
}
return ServerLoginResponseFailedPacket(when (bytes.size) {

View File

@ -3,7 +3,6 @@ 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.readIP
import net.mamoe.mirai.network.packet.server.readVarString
import net.mamoe.mirai.util.TEACryptor
import net.mamoe.mirai.util.hexToBytes
@ -86,7 +85,7 @@ class ServerLoginResponseSuccessPacket(input: DataInputStream, val packetDataLen
}
}
class ServerLoginResponseSucceedPacketEncrypted(input: DataInputStream) : ServerPacket(input) {
class ServerLoginResponseSucceedPacketEncrypted(input: DataInputStream, val length: Int) : ServerPacket(input) {
override fun decode() {
}
@ -94,7 +93,7 @@ class ServerLoginResponseSucceedPacketEncrypted(input: DataInputStream) : Server
@ExperimentalUnsignedTypes
fun decrypt(tgtgtKey: ByteArray): ServerLoginResponseSuccessPacket {//todo test
this.input.skip(14)
return ServerLoginResponseSuccessPacket(TEACryptor.decrypt(TEACryptor.decrypt(this.input.readAllBytes().let { it.copyOfRange(0, it.size - 1) }, Protocol.shareKey.hexToBytes()), tgtgtKey).dataInputStream());
return ServerLoginResponseSuccessPacket(TEACryptor.decrypt(TEACryptor.decrypt(this.input.readAllBytes().let { it.copyOfRange(0, it.size - 1) }, Protocol.shareKey.hexToBytes()), tgtgtKey).dataInputStream(), length);
//TeaDecrypt(取文本中间(data, 43, 取文本长度(data) 45), m_0828_rec_decr_key)
}
}

View File

@ -31,7 +31,7 @@ class ServerSessionKeyResponsePacket(inputStream: DataInputStream) : ServerPacke
else -> throw IllegalStateException()
}
tlv0105 = "01 05 00 88 00 01 01 02 00 40 02 01 03 3C 01 03 00 00" + 取文本中间(data, 取文本长度(data) 367, 167) 00 40 02 02 03 3C 01 03 00 00 取文本中间 (data, 取文本长度 (data) 166, 167)
//tlv0105 = "01 05 00 88 00 01 01 02 00 40 02 01 03 3C 01 03 00 00" + 取文本中间(data, 取文本长度(data) 367, 167) “00 40 02 02 03 3C 01 03 00 00 ” 取文本中间 (data, 取文本长度 (data) 166, 167)
}
}