mirror of
https://github.com/mamoe/mirai.git
synced 2025-03-26 07:20:09 +08:00
Merge branch 'master' of https://github.com/mamoe/mirai
This commit is contained in:
commit
aefe39eaf4
mirai-core-qqandroid/src
commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet
jvmTest/kotlin/androidPacketTests
@ -222,6 +222,7 @@ internal inline fun BytePacketBuilder.writeSsoPacket(
|
||||
subAppId: Long,
|
||||
commandName: String,
|
||||
extraData: ByteReadPacket = BRP_STUB,
|
||||
unknownHex: String = "01 00 00 00 00 00 00 00 00 00 01 00",
|
||||
sequenceId: Int,
|
||||
body: BytePacketBuilder.() -> Unit
|
||||
) {
|
||||
@ -229,7 +230,7 @@ internal inline fun BytePacketBuilder.writeSsoPacket(
|
||||
writeInt(sequenceId)
|
||||
writeInt(subAppId.toInt())
|
||||
writeInt(subAppId.toInt())
|
||||
writeHex("01 00 00 00 00 00 00 00 00 00 01 00")
|
||||
writeHex(unknownHex)
|
||||
if (extraData === BRP_STUB) {
|
||||
writeInt(0x04)
|
||||
} else {
|
||||
|
@ -279,7 +279,7 @@ internal object LoginPacket : PacketFactory<LoginPacket.LoginPacketResponse>("wt
|
||||
1, 15 -> onErrorMessage(tlvMap)
|
||||
2 -> onSolveLoginCaptcha(tlvMap, bot)
|
||||
-96 -> onUnsafeDeviceLogin(tlvMap)
|
||||
-52 -> onSMSVerifyNeeded(tlvMap, bot)
|
||||
-52 /*0xCC=204*/ -> onSMSVerifyNeeded(tlvMap, bot)
|
||||
else -> error("unknown login result type: $type")
|
||||
}
|
||||
}
|
||||
|
@ -95,19 +95,24 @@ private fun processFullPacketWithoutLength(packet: ByteReadPacket) {
|
||||
val bytes = it.data.readBytes()
|
||||
if (flag2 == 2 && it.packetFactory != null) {
|
||||
PacketLogger.debug("Oicq Reuqest= " + bytes.toUHexString())
|
||||
try{
|
||||
try {
|
||||
bytes.toReadPacket().parseOicqResponse {
|
||||
if (it.packetFactory.commandName == "wtlogin.login") {
|
||||
DebugLogger.info("服务器发来了 wtlogin.login. 正在解析 key")
|
||||
try {
|
||||
val subCommand = readUShort().toInt()
|
||||
println("subCommand=$subCommand")
|
||||
val type = readUByte().toInt()
|
||||
println("type=$type")
|
||||
if (type == 0) {
|
||||
debugIfFail {
|
||||
if (it.packetFactory.commandName == "wtlogin.login") {
|
||||
DebugLogger.info("服务器发来了 wtlogin.login. 正在解析 key")
|
||||
try {
|
||||
val subCommand = readUShort().toInt()
|
||||
println("subCommand=$subCommand")
|
||||
val type = readUByte().toInt()
|
||||
println("type=$type")
|
||||
|
||||
discardExact(2)
|
||||
val tlvMap: Map<Int, ByteArray> = this.readTLVMap()
|
||||
println("tlvMap: ")
|
||||
tlvMap.forEach {
|
||||
println(it.key.toShort().toUHexString() + " = " + it.value.toUHexString())
|
||||
}
|
||||
|
||||
tlvMap[0x119]?.let { t119Data ->
|
||||
t119Data.decryptBy(tgtgtKey).toReadPacket().debugPrint("0x119data").apply {
|
||||
discardExact(2) // always discarded. 00 1C
|
||||
@ -123,9 +128,9 @@ private fun processFullPacketWithoutLength(packet: ByteReadPacket) {
|
||||
DebugLogger.info("D2Key=${D2Key.toUHexString()}")
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user