Common ssoVersion, thanks to @

wdvxdr1123 (for the previous commit)
This commit is contained in:
Him188 2020-12-16 23:13:15 +08:00
parent c478f24db0
commit 9fc3bad9fe
3 changed files with 14 additions and 8 deletions

View File

@ -190,6 +190,7 @@ internal open class QQAndroidClient(
internal fun nextHighwayDataTransSequenceIdForApplyUp(): Int = highwayDataTransSequenceIdForApplyUp.getAndAdd(2) internal fun nextHighwayDataTransSequenceIdForApplyUp(): Int = highwayDataTransSequenceIdForApplyUp.getAndAdd(2)
val appClientVersion: Int = 0 val appClientVersion: Int = 0
val ssoVersion: Int = 13
var networkType: NetworkType = NetworkType.WIFI var networkType: NetworkType = NetworkType.WIFI

View File

@ -92,7 +92,8 @@ internal fun BytePacketBuilder.t106(
tgtgtKey: ByteArray, tgtgtKey: ByteArray,
isGuidAvailable: Boolean = true, isGuidAvailable: Boolean = true,
guid: ByteArray?, guid: ByteArray?,
loginType: LoginType loginType: LoginType,
ssoVersion: Int,
) { ) {
writeShort(0x106) writeShort(0x106)
passwordMd5.requireSize(16) passwordMd5.requireSize(16)
@ -100,10 +101,11 @@ internal fun BytePacketBuilder.t106(
guid?.requireSize(16) guid?.requireSize(16)
writeShortLVPacket { writeShortLVPacket {
encryptAndWrite(MiraiPlatformUtils.md5(passwordMd5 + ByteArray(4) + (salt.takeIf { it != 0L } ?: uin).toInt().toByteArray())) { encryptAndWrite(MiraiPlatformUtils.md5(passwordMd5 + ByteArray(4) + (salt.takeIf { it != 0L } ?: uin).toInt()
.toByteArray())) {
writeShort(4)//TGTGTVer writeShort(4)//TGTGTVer
writeInt(Random.nextInt()) writeInt(Random.nextInt())
writeInt(13)//ssoVer writeInt(ssoVersion)//ssoVer
writeInt(appId.toInt()) writeInt(appId.toInt())
writeInt(appClientVersion) writeInt(appClientVersion)
@ -159,12 +161,13 @@ internal fun BytePacketBuilder.t116(
internal fun BytePacketBuilder.t100( internal fun BytePacketBuilder.t100(
appId: Long = 16, appId: Long = 16,
subAppId: Long, subAppId: Long,
appClientVersion: Int appClientVersion: Int,
ssoVersion: Int,
) { ) {
writeShort(0x100) writeShort(0x100)
writeShortLVPacket { writeShortLVPacket {
writeShort(1)//db_buf_ver writeShort(1)//db_buf_ver
writeInt(5)//sso_ver writeInt(ssoVersion)//sso_ver
writeInt(appId.toInt()) writeInt(appId.toInt())
writeInt(subAppId.toInt()) writeInt(subAppId.toInt())
writeInt(appClientVersion) writeInt(appClientVersion)
@ -702,4 +705,5 @@ private inline fun Boolean.toInt(): Int = if (this) 1 else 0
// noinline: wrong exception stacktrace reported // noinline: wrong exception stacktrace reported
private infix fun Int.shouldEqualsTo(int: Int) = check(this == int) { "Required $int, but found $this" } private infix fun Int.shouldEqualsTo(int: Int) = check(this == int) { "Required $int, but found $this" }
private infix fun ByteArray.requireSize(exactSize: Int) = check(this.size == exactSize) { "Required size $exactSize, but found ${this.size}" } private infix fun ByteArray.requireSize(exactSize: Int) =
check(this.size == exactSize) { "Required size $exactSize, but found ${this.size}" }

View File

@ -145,7 +145,8 @@ internal class WtLogin {
client.tgtgtKey, client.tgtgtKey,
true, true,
client.device.guid, client.device.guid,
LoginType.PASSWORD LoginType.PASSWORD,
client.ssoVersion
) )
/* // from GetStWithPasswd /* // from GetStWithPasswd
@ -159,7 +160,7 @@ internal class WtLogin {
if (ConfigManager.get_loginWithPicSt()) appIdList = longArrayOf(1600000226L) if (ConfigManager.get_loginWithPicSt()) appIdList = longArrayOf(1600000226L)
*/ */
t116(client.miscBitMap, client.subSigMap) t116(client.miscBitMap, client.subSigMap)
t100(appId, client.subAppId, client.appClientVersion) t100(appId, client.subAppId, client.appClientVersion, client.ssoVersion)
t107(6) t107(6)
// t108(byteArrayOf()) // t108(byteArrayOf())