Commit 33317838 authored by Him188's avatar Him188

Renamed captcha packet

parent 41ddd4c2
...@@ -403,7 +403,7 @@ internal class TIMBotNetworkHandler(private val bot: Bot) : BotNetworkHandler { ...@@ -403,7 +403,7 @@ internal class TIMBotNetworkHandler(private val bot: Bot) : BotNetworkHandler {
} }
is ServerCatchaPacket.Encrypted -> socket.distributePacket(packet.decrypt()) is ServerCaptchaPacket.Encrypted -> socket.distributePacket(packet.decrypt())
is ServerLoginResponseVerificationCodeInitPacket.Encrypted -> socket.distributePacket(packet.decrypt()) is ServerLoginResponseVerificationCodeInitPacket.Encrypted -> socket.distributePacket(packet.decrypt())
is ServerLoginResponseKeyExchangePacket.Encrypted -> socket.distributePacket(packet.decrypt(this.randomprivateKey)) is ServerLoginResponseKeyExchangePacket.Encrypted -> socket.distributePacket(packet.decrypt(this.randomprivateKey))
is ServerLoginResponseSuccessPacket.Encrypted -> socket.distributePacket(packet.decrypt(this.randomprivateKey)) is ServerLoginResponseSuccessPacket.Encrypted -> socket.distributePacket(packet.decrypt(this.randomprivateKey))
......
...@@ -109,7 +109,7 @@ abstract class ServerPacket(val input: DataInputStream) : Packet { ...@@ -109,7 +109,7 @@ abstract class ServerPacket(val input: DataInputStream) : Packet {
"00 58" -> ServerHeartbeatResponsePacket(stream) "00 58" -> ServerHeartbeatResponsePacket(stream)
"00 BA" -> ServerCatchaPacket.Encrypted(stream, idHex) "00 BA" -> ServerCaptchaPacket.Encrypted(stream, idHex)
"00 CE", "00 17" -> ServerEventPacket.Raw.Encrypted(stream, idHex.hexToBytes()) "00 CE", "00 17" -> ServerEventPacket.Raw.Encrypted(stream, idHex.hexToBytes())
......
...@@ -10,7 +10,6 @@ import java.io.DataInputStream ...@@ -10,7 +10,6 @@ import java.io.DataInputStream
/** /**
* 客户端请求验证码图片数据的第几部分 * 客户端请求验证码图片数据的第几部分
*/ */
@PacketId("00 BA 31") @PacketId("00 BA 31")
class ClientVerificationCodeTransmissionRequestPacket( class ClientVerificationCodeTransmissionRequestPacket(
private val packetId: Int, private val packetId: Int,
...@@ -47,7 +46,6 @@ class ClientVerificationCodeTransmissionRequestPacket( ...@@ -47,7 +46,6 @@ class ClientVerificationCodeTransmissionRequestPacket(
* 提交验证码 * 提交验证码
*/ */
@PacketId("00 BA 32") @PacketId("00 BA 32")
class ClientVerificationCodeSubmitPacket( class ClientVerificationCodeSubmitPacket(
private val packetIdLast: Int, private val packetIdLast: Int,
private val qq: Long, private val qq: Long,
...@@ -94,7 +92,6 @@ class ClientVerificationCodeSubmitPacket( ...@@ -94,7 +92,6 @@ class ClientVerificationCodeSubmitPacket(
* 刷新验证码 * 刷新验证码
*/ */
@PacketId("00 BA 31") @PacketId("00 BA 31")
class ClientVerificationCodeRefreshPacket( class ClientVerificationCodeRefreshPacket(
private val packetIdLast: Int, private val packetIdLast: Int,
private val qq: Long, private val qq: Long,
...@@ -135,7 +132,7 @@ class ServerCaptchaWrongPacket(input: DataInputStream, dataSize: Int, packetId: ...@@ -135,7 +132,7 @@ class ServerCaptchaWrongPacket(input: DataInputStream, dataSize: Int, packetId:
* @author Him188moe * @author Him188moe
*/ */
@PacketId("00 BA 31") @PacketId("00 BA 31")
open class ServerCaptchaTransmissionPacket(input: DataInputStream, private val dataSize: Int, private val packetId: ByteArray) : ServerCatchaPacket(input) { open class ServerCaptchaTransmissionPacket(input: DataInputStream, private val dataSize: Int, private val packetId: ByteArray) : ServerCaptchaPacket(input) {
lateinit var captchaSectionN: ByteArray lateinit var captchaSectionN: ByteArray
lateinit var verificationToken: ByteArray//56bytes lateinit var verificationToken: ByteArray//56bytes
...@@ -178,7 +175,7 @@ fun main() { ...@@ -178,7 +175,7 @@ fun main() {
* @author Him188moe * @author Him188moe
*/ */
@PacketId("00 BA 32") @PacketId("00 BA 32")
class ServerCaptchaCorrectPacket(input: DataInputStream) : ServerCatchaPacket(input) { class ServerCaptchaCorrectPacket(input: DataInputStream) : ServerCaptchaPacket(input) {
lateinit var token00BA: ByteArray//56 bytes lateinit var token00BA: ByteArray//56 bytes
...@@ -188,12 +185,12 @@ class ServerCaptchaCorrectPacket(input: DataInputStream) : ServerCatchaPacket(in ...@@ -188,12 +185,12 @@ class ServerCaptchaCorrectPacket(input: DataInputStream) : ServerCatchaPacket(in
} }
} }
abstract class ServerCatchaPacket(input: DataInputStream) : ServerPacket(input) { abstract class ServerCaptchaPacket(input: DataInputStream) : ServerPacket(input) {
@PacketId("00 BA") @PacketId("00 BA")
class Encrypted(input: DataInputStream, private val id: String) : ServerPacket(input) { class Encrypted(input: DataInputStream, private val id: String) : ServerPacket(input) {
fun decrypt(): ServerCatchaPacket { fun decrypt(): ServerCaptchaPacket {
this.input goto 14 this.input goto 14
val data = TEA.decrypt(this.input.readAllBytes().cutTail(1), TIMProtocol.key00BA.hexToBytes()) val data = TEA.decrypt(this.input.readAllBytes().cutTail(1), TIMProtocol.key00BA.hexToBytes())
if (id.startsWith("00 BA 32")) { if (id.startsWith("00 BA 32")) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment