mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-09 18:00:33 +08:00
Fix packet
This commit is contained in:
parent
34f1936c6d
commit
eca68252a7
@ -14,10 +14,7 @@ import net.mamoe.mirai.qqandroid.network.protocol.packet.login.LoginPacket
|
|||||||
import net.mamoe.mirai.qqandroid.network.protocol.packet.login.PacketId
|
import net.mamoe.mirai.qqandroid.network.protocol.packet.login.PacketId
|
||||||
import net.mamoe.mirai.utils.LockFreeLinkedList
|
import net.mamoe.mirai.utils.LockFreeLinkedList
|
||||||
import net.mamoe.mirai.utils.MiraiInternalAPI
|
import net.mamoe.mirai.utils.MiraiInternalAPI
|
||||||
import net.mamoe.mirai.utils.io.ClosedChannelException
|
import net.mamoe.mirai.utils.io.*
|
||||||
import net.mamoe.mirai.utils.io.PlatformSocket
|
|
||||||
import net.mamoe.mirai.utils.io.ReadPacketInternalException
|
|
||||||
import net.mamoe.mirai.utils.io.debugPrint
|
|
||||||
import net.mamoe.mirai.utils.unsafeWeakRef
|
import net.mamoe.mirai.utils.unsafeWeakRef
|
||||||
import kotlin.coroutines.CoroutineContext
|
import kotlin.coroutines.CoroutineContext
|
||||||
|
|
||||||
@ -35,6 +32,8 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
|
|||||||
|
|
||||||
println("Sending login")
|
println("Sending login")
|
||||||
LoginPacket.SubCommand9(bot.client).sendAndExpect<LoginPacket.LoginPacketResponse>()
|
LoginPacket.SubCommand9(bot.client).sendAndExpect<LoginPacket.LoginPacketResponse>()
|
||||||
|
println("SessionTicket=${bot.client.wLoginSigInfo.wtSessionTicket.data.toUHexString()}")
|
||||||
|
println("SessionTicketKey=${bot.client.wLoginSigInfo.wtSessionTicketKey.toUHexString()}")
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun launchPacketProcessor(rawInput: ByteReadPacket): Job {
|
internal fun launchPacketProcessor(rawInput: ByteReadPacket): Job {
|
||||||
|
@ -118,7 +118,7 @@ internal open class QQAndroidClient(
|
|||||||
var loginExtraData: LoginExtraData? = null
|
var loginExtraData: LoginExtraData? = null
|
||||||
lateinit var wFastLoginInfo: WFastLoginInfo
|
lateinit var wFastLoginInfo: WFastLoginInfo
|
||||||
var reserveUinInfo: ReserveUinInfo? = null
|
var reserveUinInfo: ReserveUinInfo? = null
|
||||||
var wLoginSigInfo: WLoginSigInfo? = null
|
lateinit var wLoginSigInfo: WLoginSigInfo
|
||||||
var tlv113: ByteArray? = null
|
var tlv113: ByteArray? = null
|
||||||
lateinit var qrPushSig: ByteArray
|
lateinit var qrPushSig: ByteArray
|
||||||
|
|
||||||
|
@ -47,6 +47,7 @@ OutgoingPacket {
|
|||||||
byte 2 // head flag
|
byte 2 // head flag
|
||||||
short 27 + 2 + remaining.length
|
short 27 + 2 + remaining.length
|
||||||
ushort client.protocolVersion // const 8001
|
ushort client.protocolVersion // const 8001
|
||||||
|
ushort commandId // e.g. 0x0810
|
||||||
ushort 0x0001
|
ushort 0x0001
|
||||||
uint client.uin
|
uint client.uin
|
||||||
byte 3 // const
|
byte 3 // const
|
||||||
|
@ -421,7 +421,7 @@ internal object LoginPacket : PacketFactory<LoginPacket.LoginPacketResponse, Log
|
|||||||
* login extra data
|
* login extra data
|
||||||
*/
|
*/
|
||||||
private fun QQAndroidClient.analysisTlv537(t537: ByteArray) = t537.read {
|
private fun QQAndroidClient.analysisTlv537(t537: ByteArray) = t537.read {
|
||||||
discardExact(2)
|
//discardExact(2)
|
||||||
loginExtraData = LoginExtraData( // args are to correct order
|
loginExtraData = LoginExtraData( // args are to correct order
|
||||||
uin = readUInt().toLong(),
|
uin = readUInt().toLong(),
|
||||||
ip = readUByteLVByteArray(),
|
ip = readUByteLVByteArray(),
|
||||||
@ -509,8 +509,7 @@ internal object LoginPacket : PacketFactory<LoginPacket.LoginPacketResponse, Log
|
|||||||
val host = readUShortLVString()
|
val host = readUShortLVString()
|
||||||
val port = readShort()
|
val port = readShort()
|
||||||
|
|
||||||
bot.logger.warning("更换服务器: host=$host, port=$port, type=$type")
|
bot.logger.warning("服务器: host=$host, port=$port, type=$type")
|
||||||
// TODO: 2020/1/9 SET HOST ADDRESS ?? MAY BE IMPORTANT
|
|
||||||
// SEE oicq_request.java at method analysisT173
|
// SEE oicq_request.java at method analysisT173
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -524,7 +523,7 @@ internal object LoginPacket : PacketFactory<LoginPacket.LoginPacketResponse, Log
|
|||||||
val host = readUShortLVString()
|
val host = readUShortLVString()
|
||||||
val port = readShort()
|
val port = readShort()
|
||||||
|
|
||||||
// TODO: 2020/1/9 SET IPV6 ADDRESS
|
bot.logger.warning("服务器 ipv6: host=$host, port=$port, type=$type")
|
||||||
// SEE oicq_request.java at method analysisT17f
|
// SEE oicq_request.java at method analysisT17f
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ expect class ECDH(keyPair: ECDHKeyPair) {
|
|||||||
@Suppress("FunctionName")
|
@Suppress("FunctionName")
|
||||||
expect fun ECDH(): ECDH
|
expect fun ECDH(): ECDH
|
||||||
|
|
||||||
internal val initialPublicKey =
|
val initialPublicKey =
|
||||||
ECDH.constructPublicKey("3046301006072A8648CE3D020106052B8104001F03320004928D8850673088B343264E0C6BACB8496D697799F37211DEB25BB73906CB089FEA9639B4E0260498B51A992D50813DA8".chunkedHexToBytes())
|
ECDH.constructPublicKey("3046301006072A8648CE3D020106052B8104001F03320004928D8850673088B343264E0C6BACB8496D697799F37211DEB25BB73906CB089FEA9639B4E0260498B51A992D50813DA8".chunkedHexToBytes())
|
||||||
private val commonHeadFor02 = "302E301006072A8648CE3D020106052B8104001F031A00".chunkedHexToBytes()
|
private val commonHeadFor02 = "302E301006072A8648CE3D020106052B8104001F031A00".chunkedHexToBytes()
|
||||||
private val commonHeadForNot02 = "3046301006072A8648CE3D020106052B8104001F033200".chunkedHexToBytes()
|
private val commonHeadForNot02 = "3046301006072A8648CE3D020106052B8104001F033200".chunkedHexToBytes()
|
||||||
|
Loading…
Reference in New Issue
Block a user