This commit is contained in:
Him188moe 2019-08-18 21:27:13 +08:00
parent 9ad7492790
commit e1c8a6a073
3 changed files with 16 additions and 1 deletions

View File

@ -86,7 +86,7 @@ fun DataInputStream.readIP(): String {
return buff return buff
} }
fun DataInputStream.readVarString(length:Int): String{ fun DataInputStream.readVarString(length: Int): String {
return String(this.readNBytes(length)) return String(this.readNBytes(length))
} }

View File

@ -1,6 +1,9 @@
package net.mamoe.mirai.network.packet.server.login package net.mamoe.mirai.network.packet.server.login
import net.mamoe.mirai.network.packet.server.ServerPacket import net.mamoe.mirai.network.packet.server.ServerPacket
import net.mamoe.mirai.network.packet.server.dataInputStream
import net.mamoe.mirai.network.packet.server.goto
import net.mamoe.mirai.util.TEACryptor
import java.io.DataInputStream import java.io.DataInputStream
/** /**
@ -24,3 +27,14 @@ class ServerLoginResponseVerificationCodePacket(input: DataInputStream) : Server
token00BA = 取文本中间(data, 取文本长度(data) - 178, 119)*/ token00BA = 取文本中间(data, 取文本长度(data) - 178, 119)*/
} }
} }
class ServerLoginResponseVerificationCodePacketEncrypted(input: DataInputStream) : ServerPacket(input) {
override fun decode() {
}
fun decrypt(): ServerLoginResponseVerificationCodePacket {
this.input goto 14
return ServerLoginResponseVerificationCodePacket(TEACryptor.CRYPTOR_SHARE_KEY.decrypt(this.input.readAllBytes().let { it.copyOfRange(0, it.size - 1) }).dataInputStream())
}
}

View File

@ -9,6 +9,7 @@ import java.util.Random;
* @author iweiz https://github.com/iweizime/StepChanger/blob/master/app/src/main/java/me/iweizi/stepchanger/qq/Cryptor.java * @author iweiz https://github.com/iweizime/StepChanger/blob/master/app/src/main/java/me/iweizi/stepchanger/qq/Cryptor.java
*/ */
public class TEACryptor { public class TEACryptor {
public static final TEACryptor CRYPTOR_SHARE_KEY = new TEACryptor(Protocol.Companion.hexToBytes(Protocol.shareKey));
public static final TEACryptor CRYPTOR_0825KEY = new TEACryptor(Protocol.Companion.hexToBytes(Protocol._0825key)); public static final TEACryptor CRYPTOR_0825KEY = new TEACryptor(Protocol.Companion.hexToBytes(Protocol._0825key));
public static final TEACryptor CRYPTOR_00BAKEY = new TEACryptor(Protocol.Companion.hexToBytes(Protocol._00BaKey)); public static final TEACryptor CRYPTOR_00BAKEY = new TEACryptor(Protocol.Companion.hexToBytes(Protocol._00BaKey));