mirror of
https://github.com/mamoe/mirai.git
synced 2025-04-01 04:10:12 +08:00
QQA Debugging update
This commit is contained in:
parent
9ff1ff604c
commit
b1451f664c
@ -203,18 +203,19 @@ internal object LoginPacket : PacketFactory<LoginPacket.LoginPacketResponse>("wt
|
|||||||
println("subCommand=$subCommand")
|
println("subCommand=$subCommand")
|
||||||
val type = readByte()
|
val type = readByte()
|
||||||
println("type=$type")
|
println("type=$type")
|
||||||
|
|
||||||
|
debugDiscardExact(2)
|
||||||
|
val tlvMap: Map<Int, ByteArray> = this.readTLVMap()
|
||||||
return when (type.toInt()) {
|
return when (type.toInt()) {
|
||||||
0 -> onLoginSuccess(bot)
|
0 -> onLoginSuccess(tlvMap, bot)
|
||||||
1, 15 -> onErrorMessage()
|
1, 15 -> onErrorMessage(tlvMap)
|
||||||
2 -> onSolveLoginCaptcha(bot)
|
2 -> onSolveLoginCaptcha(tlvMap, bot)
|
||||||
else -> error("unknown login result type: $type")
|
else -> error("unknown login result type: $type")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun ByteReadPacket.onErrorMessage(): LoginPacketResponse.Error {
|
private fun ByteReadPacket.onErrorMessage(tlvMap: Map<Int, ByteArray>): LoginPacketResponse.Error {
|
||||||
discardExact(2)
|
return tlvMap[0x146]?.toReadPacket()?.run {
|
||||||
val tlvMap = readTLVMap()
|
|
||||||
tlvMap[0x146]?.toReadPacket()?.run {
|
|
||||||
readShort() // ver
|
readShort() // ver
|
||||||
readShort() // code
|
readShort() // code
|
||||||
|
|
||||||
@ -222,15 +223,14 @@ internal object LoginPacket : PacketFactory<LoginPacket.LoginPacketResponse>("wt
|
|||||||
val message = readUShortLVString()
|
val message = readUShortLVString()
|
||||||
val errorInfo = readUShortLVString()
|
val errorInfo = readUShortLVString()
|
||||||
|
|
||||||
return LoginPacketResponse.Error(title, message, errorInfo)
|
LoginPacketResponse.Error(title, message, errorInfo)
|
||||||
} ?: error("Cannot find error message")
|
} ?: error("Cannot find error message")
|
||||||
}
|
}
|
||||||
|
|
||||||
@UseExperimental(MiraiDebugAPI::class)
|
@UseExperimental(MiraiDebugAPI::class)
|
||||||
suspend fun ByteReadPacket.onSolveLoginCaptcha(bot: QQAndroidBot): LoginPacketResponse.Captcha = this.debugPrint("login验证码解析").run {
|
suspend fun ByteReadPacket.onSolveLoginCaptcha(tlvMap: Map<Int, ByteArray>, bot: QQAndroidBot): LoginPacketResponse.Captcha =
|
||||||
|
this.debugPrint("login验证码解析").run {
|
||||||
val client = bot.client
|
val client = bot.client
|
||||||
debugDiscardExact(2)
|
|
||||||
val tlvMap: Map<Int, ByteArray> = this.readTLVMap()
|
|
||||||
// val ret = tlvMap[0x104]?.let { println(it.toUHexString()) }
|
// val ret = tlvMap[0x104]?.let { println(it.toUHexString()) }
|
||||||
println()
|
println()
|
||||||
val question = tlvMap[0x165] ?: error("CAPTCHA QUESTION UNKNOWN")
|
val question = tlvMap[0x165] ?: error("CAPTCHA QUESTION UNKNOWN")
|
||||||
@ -252,10 +252,8 @@ internal object LoginPacket : PacketFactory<LoginPacket.LoginPacketResponse>("wt
|
|||||||
}
|
}
|
||||||
|
|
||||||
@UseExperimental(MiraiDebugAPI::class)
|
@UseExperimental(MiraiDebugAPI::class)
|
||||||
private fun ByteReadPacket.onLoginSuccess(bot: QQAndroidBot): LoginPacketResponse.Success {
|
private fun ByteReadPacket.onLoginSuccess(tlvMap: Map<Int, ByteArray>, bot: QQAndroidBot): LoginPacketResponse.Success {
|
||||||
val client = bot.client
|
val client = bot.client
|
||||||
debugDiscardExact(2)
|
|
||||||
val tlvMap: Map<Int, ByteArray> = this.readTLVMap()
|
|
||||||
println("TLV KEYS: " + tlvMap.keys.joinToString { it.contentToString() })
|
println("TLV KEYS: " + tlvMap.keys.joinToString { it.contentToString() })
|
||||||
|
|
||||||
tlvMap[0x150]?.let { client.analysisTlv150(it) }
|
tlvMap[0x150]?.let { client.analysisTlv150(it) }
|
||||||
|
Loading…
Reference in New Issue
Block a user