mirror of
https://github.com/mamoe/mirai.git
synced 2025-03-11 21:30:11 +08:00
loginpacket correction
This commit is contained in:
parent
625d48f3a5
commit
9516c30862
@ -73,7 +73,7 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
|
||||
|
||||
is SMSVerifyCodeNeeded -> {
|
||||
val result = bot.configuration.loginSolver.onGetPhoneNumber()
|
||||
response = LoginPacket.SubCommand8(
|
||||
response = LoginPacket.SubCommand7(
|
||||
bot.client,
|
||||
response.t174,
|
||||
response.t402,
|
||||
|
@ -1,82 +0,0 @@
|
||||
package net.mamoe.mirai.qqandroid.network.protocol.packet.chat.receive
|
||||
|
||||
import kotlinx.io.core.ByteReadPacket
|
||||
import kotlinx.serialization.protobuf.ProtoBuf
|
||||
import net.mamoe.mirai.qqandroid.QQAndroidBot
|
||||
import net.mamoe.mirai.qqandroid.network.QQAndroidClient
|
||||
import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY
|
||||
import net.mamoe.mirai.qqandroid.network.protocol.packet.OutgoingPacket
|
||||
import net.mamoe.mirai.qqandroid.network.protocol.packet.PacketFactory
|
||||
import net.mamoe.mirai.qqandroid.network.protocol.packet.buildOutgingPacket
|
||||
import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.data.Cmd0x352Packet
|
||||
import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.data.MsgSvc
|
||||
import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.data.RequestPushNotify
|
||||
|
||||
internal object GetMsgRequest : PacketFactory<MsgSvc.PbGetMsgResp>("MessageSvc.PbGetMsg") {
|
||||
override suspend fun ByteReadPacket.decode(bot: QQAndroidBot): MsgSvc.PbGetMsgResp {
|
||||
println("received MsgSvc.PbGetMsgResp")
|
||||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
/**
|
||||
@Serializable
|
||||
class PbGetMsgReq(
|
||||
@SerialId(1) val syncFlag: Int /* enum */ = 0,
|
||||
@SerialId(2) val syncCookie: ByteArray = EMPTY_BYTE_ARRAY,
|
||||
@SerialId(3) val rambleFlag: Int = 1,
|
||||
@SerialId(4) val latestRambleNumber: Int = 20,
|
||||
@SerialId(5) val otherRambleNumber: Int = 3,
|
||||
@SerialId(6) val onlineSyncFlag: Int = 1,
|
||||
@SerialId(7) val contextFlag: Int = 0,
|
||||
@SerialId(8) val whisperSessionId: Int = 0,
|
||||
@SerialId(9) val msgReqType: Int = 0,
|
||||
@SerialId(10) val pubaccountCookie: ByteArray = EMPTY_BYTE_ARRAY,
|
||||
@SerialId(11) val msgCtrlBuf: ByteArray = EMPTY_BYTE_ARRAY,
|
||||
@SerialId(12) val serverBuf: ByteArray = EMPTY_BYTE_ARRAY
|
||||
) : ProtoBuf
|
||||
|
||||
|
||||
@Serializable
|
||||
internal class RequestPushNotify(
|
||||
@SerialId(0) val uin: Long = 0L,
|
||||
@SerialId(1) val ctype: Byte = 0,
|
||||
@SerialId(2) val strService: String?,
|
||||
@SerialId(3) val strCmd: String?,
|
||||
@SerialId(4) val vNotifyCookie: ByteArray? = EMPTY_BYTE_ARRAY,
|
||||
@SerialId(5) val usMsgType: Int?,
|
||||
@SerialId(6) val wUserActive: Int?,
|
||||
@SerialId(7) val wGeneralFlag: Int?,
|
||||
@SerialId(8) val bindedUin: Long?,
|
||||
@SerialId(9) val stMsgInfo: MsgInfo?,
|
||||
@SerialId(10) val msgCtrlBuf: String?,
|
||||
@SerialId(11) val serverBuf: ByteArray?,
|
||||
@SerialId(12) val pingFlag: Long?,
|
||||
@SerialId(13) val svrip: Int?
|
||||
) : JceStruct, Packet
|
||||
*/
|
||||
operator fun invoke(
|
||||
client: QQAndroidClient,
|
||||
notify: RequestPushNotify
|
||||
): OutgoingPacket = buildOutgingPacket(client, key = client.wLoginSigInfo.d2Key) {
|
||||
val req = MsgSvc.PbGetMsgReq(
|
||||
serverBuf = notify.serverBuf ?: EMPTY_BYTE_ARRAY,
|
||||
msgReqType = notify.usMsgType ?: 0,
|
||||
syncFlag = 0,
|
||||
rambleFlag = 0,
|
||||
contextFlag = 1,
|
||||
latestRambleNumber = 20,
|
||||
otherRambleNumber = 3,
|
||||
onlineSyncFlag = 1
|
||||
)
|
||||
|
||||
val data = ProtoBuf.dump(
|
||||
MsgSvc.PbGetMsgReq.serializer(),
|
||||
req
|
||||
)
|
||||
|
||||
writeInt(data.size)
|
||||
writeFully(data, 0, data.size)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,19 +0,0 @@
|
||||
package net.mamoe.mirai.qqandroid.network.protocol.packet.friend
|
||||
|
||||
import kotlinx.io.core.ByteReadPacket
|
||||
import net.mamoe.mirai.data.Packet
|
||||
import net.mamoe.mirai.qqandroid.QQAndroidBot
|
||||
import net.mamoe.mirai.qqandroid.network.protocol.packet.PacketFactory
|
||||
|
||||
|
||||
internal object FriendListPacket :
|
||||
PacketFactory<FriendListPacket.GetFriendListResponse>("friendlist.GetFriendListReq") {
|
||||
|
||||
class GetFriendListResponse() : Packet
|
||||
|
||||
|
||||
override suspend fun ByteReadPacket.decode(bot: QQAndroidBot): GetFriendListResponse {
|
||||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
|
@ -1,30 +0,0 @@
|
||||
package net.mamoe.mirai.qqandroid.network.protocol.packet.friend.data
|
||||
|
||||
import kotlinx.serialization.SerialId
|
||||
import kotlinx.serialization.Serializable
|
||||
import net.mamoe.mirai.qqandroid.io.JceStruct
|
||||
|
||||
@Serializable
|
||||
internal class GetFriendListReq(
|
||||
@SerialId(0) val reqtype: Int? = null,
|
||||
@SerialId(1) val ifReflush: Byte? = null,
|
||||
@SerialId(2) val uin: Long? = null,
|
||||
@SerialId(3) val startIndex: Short? = null,
|
||||
@SerialId(4) val getfriendCount: Short? = null,
|
||||
@SerialId(5) val groupid: Byte? = null,
|
||||
@SerialId(6) val ifGetGroupInfo: Byte? = null,
|
||||
@SerialId(7) val groupstartIndex: Byte? = null,
|
||||
@SerialId(8) val getgroupCount: Byte? = null,
|
||||
@SerialId(9) val ifGetMSFGroup: Byte? = null,
|
||||
@SerialId(10) val ifShowTermType: Byte? = null,
|
||||
@SerialId(11) val version: Long? = null,
|
||||
@SerialId(12) val uinList: List<Long>? = null,
|
||||
@SerialId(13) val eAppType: Int = 0,
|
||||
@SerialId(14) val ifGetDOVId: Byte? = null,
|
||||
@SerialId(15) val ifGetBothFlag: Byte? = null,
|
||||
@SerialId(16) val vec0xd50Req: ByteArray? = null,
|
||||
@SerialId(17) val vec0xd6bReq: ByteArray? = null,
|
||||
@SerialId(18) val vecSnsTypelist: List<Long>? = null
|
||||
) : JceStruct
|
||||
|
||||
|
@ -1,2 +0,0 @@
|
||||
package net.mamoe.mirai.qqandroid.network.protocol.packet.friend.data
|
||||
|
@ -1,8 +0,0 @@
|
||||
package net.mamoe.mirai.qqandroid.network.protocol.packet.friend.data
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
class Vec0xd6bReq {
|
||||
|
||||
}
|
File diff suppressed because one or more lines are too long
@ -9,7 +9,7 @@ object QLogReader {
|
||||
@JvmStatic
|
||||
fun main(args: Array<String>) {
|
||||
|
||||
println(readQLog(File("C:\\Users\\Him18\\Desktop\\log\\wtlogin_20200101.log")))
|
||||
println(readQLog(File("/Users/jiahua.liu/Downloads/wtlogin_20200129.log")))
|
||||
}
|
||||
|
||||
fun readQLog(file: File): String {
|
||||
|
@ -11,8 +11,7 @@ fun main(){
|
||||
//server to client
|
||||
val s2c = "01 46 00 33 00 00 00 A3 00 0F E9 AA 8C E7 9F AD E4 BF A1 E5 A4 B1 E8 B4 A5 00 18 E9 AA 8C E8 AF 81 E7 A0 81 E8 BE 93 E5 85 A5 E9 94 99 E8 AF AF E3 80 82 00 00 00 00 05 08 00 22 01 00 00 0B B8 00 1B 02 00 00 00 10 20 02 ED BD 08 10 00 00 00 A3 00 00 00 00 3E 03 3F A2 00 00 00 A3".hexToBytes().toIoBuffer().readTLVMap()
|
||||
//client to server
|
||||
val c2s = "00 08 00 08 00 00 00 00 08 04 00 00 01 04 00 24 41 69 78 39 46 68 4E 44 6C 41 42 30 54 79 46 30 4B 36 67 78 37 45 6E 2B 30 7A 39 35 65 35 30 6E 66 41 3D 3D 01 16 00 0E 00 08 F7 FF 7C 00 01 04 00 01 5F 5E 10 E2 01 74 00 61 45 66 43 39 46 4B 63 70 47 30 5F 5A 55 41 4F 6A 4E 4C 6F 72 56 30 77 66 4B 67 49 4D 33 33 6E 58 44 37 5F 4B 61 75 56 6D 4F 6F 54 68 6A 64 38 62 72 44 64 69 5F 62 48 51 5A 66 37 6E 4F 6B 78 43 35 6E 47 4E 38 6B 6A 35 39 6D 37 32 71 47 66 78 4E 76 50 51 53 39 33 66 37 6B 72 71 66 71 78 63 5F 01 7A 00 04 00 00 00 09 01 97 00 01 00".hexToBytes().toIoBuffer().readTLVMap()
|
||||
val c2s = "00 08 00 08 00 00 00 00 08 04 00 00 01 04 00 24 41 69 4E 54 75 7A 50 2F 48 6D 5A 30 74 37 64 54 71 57 7A 67 79 35 54 4C 77 39 55 69 53 59 69 45 71 67 3D 3D 01 16 00 0E 00 08 F7 FF 7C 00 01 04 00 01 5F 5E 10 E2 01 74 00 61 45 66 43 39 46 4B 63 70 47 30 5F 5A 55 41 4F 6A 4E 4C 6F 72 56 30 77 66 4B 67 49 4D 33 33 6E 58 44 37 5F 4B 61 75 56 6D 4F 6F 54 68 6A 64 38 62 72 44 64 69 5F 62 48 51 5A 66 37 6E 4F 6B 78 43 35 6E 47 4E 38 6B 6A 35 39 6D 37 32 71 47 66 78 4E 76 50 51 53 39 33 66 37 6B 72 71 66 71 78 63 5F 01 7A 00 04 00 00 00 09 01 97 00 01 00".hexToBytes().toIoBuffer().readTLVMap()
|
||||
|
||||
|
||||
println(s2c.contentToString())
|
||||
println(c2s.contentToString())
|
||||
}
|
@ -70,7 +70,7 @@ fun ByteArray.adjustToPublicKey(): ECDHPublicKey {
|
||||
commonHeadFor02 + this
|
||||
} else if (!this.toUHexString("").startsWith(constantHead)) {
|
||||
commonHeadForNot02 +
|
||||
if (this[0].toInt() == 0x04) this
|
||||
if (this[0].toInt() == 0x04 || this[0].toInt() == 0x03) this
|
||||
else (byteArray_04 + this)
|
||||
} else this
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user