This commit is contained in:
Him188moe 2019-08-18 21:36:31 +08:00
parent 1ae263a1ab
commit a2e5379db5
2 changed files with 11 additions and 19 deletions

View File

@ -1,8 +1,9 @@
package net.mamoe.mirai.network.packet.server.login
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.network.packet.server.readVarString
import net.mamoe.mirai.util.TEACryptor
import net.mamoe.mirai.util.toHexString
import java.io.DataInputStream
@ -30,7 +31,7 @@ class ServerLoginResponseVerificationCodePacket(input: DataInputStream, val pack
this.input.skip(1)
val b = this.input.readByte()
System.out.println(b.toHexString())
println(b.toHexString())
this.token00BA = this.input.goto(packetLength - 60).readNBytes(40)
}
@ -43,6 +44,7 @@ class ServerLoginResponseVerificationCodePacketEncrypted(input: DataInputStream)
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())
val data = TEACryptor.CRYPTOR_SHARE_KEY.decrypt(this.input.readAllBytes().let { it.copyOfRange(0, it.size - 1) });
return ServerLoginResponseVerificationCodePacket(data.dataInputStream(), data.size)
}
}

View File

@ -1,12 +1,9 @@
import net.mamoe.mirai.network.packet.server.login.ServerLoginResponseSuccessPacket
import net.mamoe.mirai.network.packet.server.login.ServerLoginResponseVerificationCodePacket
import net.mamoe.mirai.util.hexToBytes
import net.mamoe.mirai.util.toHexString
import java.io.ByteArrayInputStream
import java.io.DataInputStream
import java.io.File
import javax.imageio.ImageIO
import javax.imageio.stream.ImageInputStream
import java.io.FileOutputStream
@ExperimentalUnsignedTypes
fun main(){
@ -40,17 +37,10 @@ fun main(){
val s = DataInputStream(data.hexToBytes().inputStream())
val packet = ServerLoginResponseVerificationCodePacket(s,(data.length+1)/3)
packet.decode()
System.out.println(packet.token00BA.toUByteArray().toHexString(" "))
System.out.println(packet.verifyCode.toUByteArray().toHexString(" "))
System.out.println(packet.verifyCodeLength)
val f = File(System.getProperty("user.dir") + "/test.jpg")
f.createNewFile()
val io = ImageIO.createImageInputStream(ByteArrayInputStream(packet.verifyCode))
try {
ImageIO.write(Render, "jpg", f)
}catch (e: Exception){
e.printStackTrace()
}
println(packet.token00BA.toUByteArray().toHexString(" "))
println(packet.verifyCode.toUByteArray().toHexString(" "))
println(packet.verifyCodeLength)
File("C:\\Users\\Him18\\Desktop\\5.png").createNewFile()
s.transferTo(FileOutputStream("C:\\Users\\Him18\\Desktop\\5.png"))
}