QQA Debugging update

This commit is contained in:
Him188 2020-01-24 17:57:13 +08:00
parent b1451f664c
commit 7810127f7f
2 changed files with 22 additions and 22 deletions

View File

@ -4,6 +4,7 @@ buildscript {
jcenter() jcenter()
mavenCentral() mavenCentral()
google() google()
maven { url 'https://dl.bintray.com/kotlin/kotlin-dev/'}
} }
dependencies { dependencies {

View File

@ -214,7 +214,7 @@ internal object LoginPacket : PacketFactory<LoginPacket.LoginPacketResponse>("wt
} }
} }
private fun ByteReadPacket.onErrorMessage(tlvMap: Map<Int, ByteArray>): LoginPacketResponse.Error { private fun onErrorMessage(tlvMap: Map<Int, ByteArray>): LoginPacketResponse.Error {
return tlvMap[0x146]?.toReadPacket()?.run { return tlvMap[0x146]?.toReadPacket()?.run {
readShort() // ver readShort() // ver
readShort() // code readShort() // code
@ -228,31 +228,30 @@ internal object LoginPacket : PacketFactory<LoginPacket.LoginPacketResponse>("wt
} }
@UseExperimental(MiraiDebugAPI::class) @UseExperimental(MiraiDebugAPI::class)
suspend fun ByteReadPacket.onSolveLoginCaptcha(tlvMap: Map<Int, ByteArray>, bot: QQAndroidBot): LoginPacketResponse.Captcha = suspend fun onSolveLoginCaptcha(tlvMap: Map<Int, ByteArray>, bot: QQAndroidBot): LoginPacketResponse.Captcha {
this.debugPrint("login验证码解析").run { val client = bot.client
val client = bot.client // 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") when (question[18].toUHexString()) {
when (question[18].toUHexString()) { "36" -> {
"36" -> { //图片验证
//图片验证 DebugLogger.debug("是一个图片验证码")
debugPrint("是一个图片验证码") val imageData = tlvMap[0x165]
val imageData = tlvMap[0x165] bot.configuration.captchaSolver.invoke(
bot.configuration.captchaSolver.invoke( bot,
bot, (tlvMap[0x165] ?: error("Captcha Image Data Not Found")).toIoBuffer()
(tlvMap[0x165] ?: error("Captcha Image Data Not Found")).toIoBuffer() )
) }
} else -> {
else -> { error("UNKNOWN CAPTCHA QUESTION: $question")
error("UNKNOWN CAPTCHA QUESTION: $question")
}
} }
return TODO()
} }
return TODO()
}
@UseExperimental(MiraiDebugAPI::class) @UseExperimental(MiraiDebugAPI::class)
private fun ByteReadPacket.onLoginSuccess(tlvMap: Map<Int, ByteArray>, bot: QQAndroidBot): LoginPacketResponse.Success { private fun onLoginSuccess(tlvMap: Map<Int, ByteArray>, bot: QQAndroidBot): LoginPacketResponse.Success {
val client = bot.client val client = bot.client
println("TLV KEYS: " + tlvMap.keys.joinToString { it.contentToString() }) println("TLV KEYS: " + tlvMap.keys.joinToString { it.contentToString() })