1
0
mirror of https://github.com/mamoe/mirai.git synced 2025-04-14 23:20:49 +08:00

Testing tools

This commit is contained in:
Him188 2020-01-29 13:44:34 +08:00
parent 3d49f3b58a
commit 964c236ddf
2 changed files with 231 additions and 3 deletions
mirai-core-qqandroid/src/jvmTest/kotlin/androidPacketTests

View File

@ -166,7 +166,7 @@ fun ByteReadPacket.analysisOneFullPacket(): ByteReadPacket = debugIfFail("Failed
println(" got new protocolVersion=$it")
}
val commandId = readUShort().toInt()
println(" commandId=${commandId}")
println(" commandId=0x${commandId.toShort().toUHexString()}")
readUShort().toInt().takeIf { it != 1 }?.let {
println(" got new const0=$it")
}
@ -237,7 +237,9 @@ fun ByteReadPacket.analysisOneFullPacket(): ByteReadPacket = debugIfFail("Failed
try {
discardExact(4)
readTLVMap()[0x106]
?.also { DebugLogger.info("找到了 0x106") }?.decryptBy(passwordMd5 + ByteArray(4) + uin.toInt().toByteArray())?.read {
?.also { DebugLogger.info("找到了 0x106") }
?.decryptBy(passwordMd5 + ByteArray(4) + uin.toInt().toByteArray())
?.read {
discardExact(2 + 4 * 4 + 8 + 4 + 4 + 1 + 16)
tgtgtKey = readBytes(16)
DebugLogger.info("获取 tgtgtKey=${tgtgtKey.toUHexString()}")
@ -323,7 +325,7 @@ fun ByteReadPacket.decodeSso() {
println(" unknownHex=" + readBytes(12).toUHexString())
println(" extraData=" + readBytes(readInt() - 4).toUHexString())
val commandName = readBytes(readInt() - 4).encodeToString()
PacketLogger.info(" commandName=" + commandName)
PacketLogger.warning(" commandName=$commandName")
(" unknown4Bytes=" + readBytes(readInt() - 4).toUHexString())
(" imei=" + readBytes(readInt() - 4).toUHexString())
(" 0 bytes=" + readBytes(readInt() - 4).toUHexString())

File diff suppressed because one or more lines are too long