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