mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-06 08:00:10 +08:00
update
This commit is contained in:
parent
6d4b3253e3
commit
fdde4cae5a
@ -13,8 +13,8 @@ import io.netty.handler.codec.bytes.ByteArrayEncoder
|
||||
import net.mamoe.mirai.network.packet.client.ClientPacket
|
||||
import net.mamoe.mirai.network.packet.client.login.ClientServerRedirectionPacket
|
||||
import net.mamoe.mirai.network.packet.client.writeHex
|
||||
import net.mamoe.mirai.network.packet.server.Server0825Packet
|
||||
import net.mamoe.mirai.network.packet.server.ServerPacket
|
||||
import net.mamoe.mirai.network.packet.server.ServerTouchResponsePacket
|
||||
import net.mamoe.mirai.utils.MiraiLogger
|
||||
import java.net.DatagramPacket
|
||||
import java.net.InetSocketAddress
|
||||
@ -31,7 +31,7 @@ class Robot(val number: Int) {
|
||||
@ExperimentalUnsignedTypes
|
||||
internal fun onPacketReceived(packet: ServerPacket) {
|
||||
packet.decode()
|
||||
if (packet is Server0825Packet) {
|
||||
if (packet is ServerTouchResponsePacket) {
|
||||
connect(packet.serverIP)
|
||||
sendPacket(ClientServerRedirectionPacket(packet.serverIP, number))
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ import java.io.IOException
|
||||
/**
|
||||
* The packet to touch server.
|
||||
*
|
||||
* @see net.mamoe.mirai.network.packet.server.Server0825Packet
|
||||
* @see net.mamoe.mirai.network.packet.server.ServerTouchResponsePacket
|
||||
*
|
||||
* @author Him188moe @ Mirai Project
|
||||
*/
|
||||
|
@ -1,7 +1,6 @@
|
||||
package net.mamoe.mirai.network.packet.server
|
||||
|
||||
import net.mamoe.mirai.network.packet.Packet
|
||||
import net.mamoe.mirai.network.packet.client.toHexString
|
||||
import net.mamoe.mirai.util.toHexString
|
||||
|
||||
import java.io.DataInputStream
|
||||
@ -23,8 +22,8 @@ abstract class ServerPacket(val input: DataInputStream) : Packet {
|
||||
val idBytes = stream.readUntil(11)
|
||||
|
||||
return when (idBytes.joinToString("") { it.toString(16) }) {
|
||||
"08 25 31 01" -> Server0825Packet(Server0825Packet.Type.TYPE_08_25_31_01, stream)
|
||||
"08 25 31 02" -> Server0825Packet(Server0825Packet.Type.TYPE_08_25_31_02, stream)
|
||||
"08 25 31 01" -> ServerTouchResponsePacket(ServerTouchResponsePacket.Type.TYPE_08_25_31_01, stream)
|
||||
"08 25 31 02" -> ServerTouchResponsePacket(ServerTouchResponsePacket.Type.TYPE_08_25_31_02, stream)
|
||||
|
||||
else -> throw UnsupportedOperationException()
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ import java.io.DataInputStream
|
||||
*
|
||||
* @author Him188moe @ Mirai Project
|
||||
*/
|
||||
class Server0825Packet(private val type: Type, inputStream: DataInputStream) : ServerPacket(inputStream) {
|
||||
class ServerTouchResponsePacket(private val type: Type, inputStream: DataInputStream) : ServerPacket(inputStream) {
|
||||
lateinit var serverIP: String;
|
||||
|
||||
var loginTime: Int = 0
|
@ -1,9 +1,3 @@
|
||||
import net.mamoe.mirai.network.packet.server.Server0825Packet;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* @author Him188moe @ Mirai Project
|
||||
*/
|
||||
|
@ -1,8 +1,6 @@
|
||||
import net.mamoe.mirai.network.packet.client.toHexString
|
||||
import net.mamoe.mirai.network.packet.server.Server0825Packet
|
||||
import net.mamoe.mirai.util.TEACryptor
|
||||
import net.mamoe.mirai.network.packet.server.ServerTouchResponsePacket
|
||||
import net.mamoe.mirai.util.hexToBytes
|
||||
import net.mamoe.mirai.util.hexToUBytes
|
||||
import net.mamoe.mirai.util.toHexString
|
||||
import java.io.DataInputStream
|
||||
|
||||
@ -10,7 +8,7 @@ import java.io.DataInputStream
|
||||
fun main(){
|
||||
val data = "00 37 13 08 25 31 01 76 E4 B8 DD 03 00 00 00 01 2E 01 00 00 68 52 00 00 00 00 A4 F1 91 88 C9 82 14 99 0C 9E 56 55 91 23 C8 3D C3 47 F0 25 A1 8E 74 EF 1E 0B 32 5B 20 8A FA 3B 0B 52 8F 86 E6 04 F1 D6 F8 63 75 60 8C 0C 7D 06 D1 E0 22 F8 49 EF AF 61 EE 7E 69 72 EB 10 08 30 69 50 1C 84 A9 C2 16 D7 52 B9 1C 79 CA 5A CF FD BC AE D8 A6 BB DC 21 6E 79 26 E1 A2 23 11 AA B0 9A 49 39 72 ED 61 12 B6 88 4D A2 56 23 E9 92 11 92 27 4A 70 00 C9 01 7B 03"
|
||||
val s = DataInputStream(data.hexToBytes().inputStream())
|
||||
val packet = Server0825Packet(Server0825Packet.Type.TYPE_08_25_31_01,s)
|
||||
val packet = ServerTouchResponsePacket(ServerTouchResponsePacket.Type.TYPE_08_25_31_01, s)
|
||||
packet.decode()
|
||||
System.out.println(packet.token.toUByteArray().toHexString(" "))
|
||||
System.out.println(packet.loginTime.toHexString(" "))
|
||||
|
Loading…
Reference in New Issue
Block a user