Commit 699d29c6 authored by Him188moe's avatar Him188moe

update

parent 21ffb8a7
...@@ -95,7 +95,7 @@ public class MiraiServer { ...@@ -95,7 +95,7 @@ public class MiraiServer {
}); });
*/ */
Robot robot = new Robot(1994701021); Robot robot = new Robot(1994701021, "xiaoqqq");
try { try {
robot.connect(Protocol.Companion.getSERVER_IP().get(2), 8000); robot.connect(Protocol.Companion.getSERVER_IP().get(2), 8000);
} catch (InterruptedException e) { } catch (InterruptedException e) {
......
...@@ -35,7 +35,10 @@ class Robot(val number: Int, private val password: String) { ...@@ -35,7 +35,10 @@ class Robot(val number: Int, private val password: String) {
if (packet is ServerTouchResponsePacket) { if (packet is ServerTouchResponsePacket) {
if (packet.serverIP != null) {//redirection if (packet.serverIP != null) {//redirection
connect(packet.serverIP!!) connect(packet.serverIP!!)
sendPacket(ClientServerRedirectionPacket(packet.serverIP!!, number)) sendPacket(ClientServerRedirectionPacket(
serverIP = packet.serverIP!!,
qq = number
))
} else {//password submission } else {//password submission
sendPacket(ClientPasswordSubmissionPacket( sendPacket(ClientPasswordSubmissionPacket(
qq = this.number, qq = this.number,
......
...@@ -3,10 +3,7 @@ package net.mamoe.mirai.network.packet.client.login ...@@ -3,10 +3,7 @@ package net.mamoe.mirai.network.packet.client.login
import net.mamoe.mirai.network.Protocol import net.mamoe.mirai.network.Protocol
import net.mamoe.mirai.network.packet.PacketId import net.mamoe.mirai.network.packet.PacketId
import net.mamoe.mirai.network.packet.client.* import net.mamoe.mirai.network.packet.client.*
import net.mamoe.mirai.util.TEACryptor import net.mamoe.mirai.util.*
import net.mamoe.mirai.util.getCrc32
import net.mamoe.mirai.util.getRandomKey
import net.mamoe.mirai.util.hexToBytes
import java.io.IOException import java.io.IOException
import java.net.InetAddress import java.net.InetAddress
...@@ -15,6 +12,21 @@ import java.net.InetAddress ...@@ -15,6 +12,21 @@ import java.net.InetAddress
* *
* @author Him188moe @ Mirai Project * @author Him188moe @ Mirai Project
*/ */
@ExperimentalUnsignedTypes
fun main() {
val pk = ClientPasswordSubmissionPacket(
qq = 1994701021,
password = "D1 A5 C8 BB E1 Q3 CC DD",//其实这个就是普通的密码, 不是HEX
loginTime = 131513,
loginIP = "123.123.123.123",
token0825 = byteArrayOf(),
tgtgtKey = "AA BB CC DD EE FF AA BB CC".hexToBytes()
)
println(pk.encodeToByteArray().toHexString())
}
@PacketId("08 36 31 03")//may be 08 36, 31 03 has another meaning @PacketId("08 36 31 03")//may be 08 36, 31 03 has another meaning
@ExperimentalUnsignedTypes @ExperimentalUnsignedTypes
class ClientPasswordSubmissionPacket(private val qq: Int, private val password: String, private val loginTime: Int, private val loginIP: String, private val tgtgtKey: ByteArray, private val token0825: ByteArray) : ClientPacket() { class ClientPasswordSubmissionPacket(private val qq: Int, private val password: String, private val loginTime: Int, private val loginIP: String, private val tgtgtKey: ByteArray, private val token0825: ByteArray) : ClientPacket() {
...@@ -27,12 +39,12 @@ class ClientPasswordSubmissionPacket(private val qq: Int, private val password: ...@@ -27,12 +39,12 @@ class ClientPasswordSubmissionPacket(private val qq: Int, private val password:
this.writeHex(Protocol._0836key1) this.writeHex(Protocol._0836key1)
//TEA 加密 //TEA 加密
this.write(TEACryptor.encrypt(object : ClientPacket() { this.write(TEACryptor.encrypt(object : ByteArrayDataOutputStream() {
@Throws(IOException::class) @Throws(IOException::class)
override fun encode() { override fun toByteArray(): ByteArray {
val hostName: String = InetAddress.getLocalHost().hostName.let { it.substring(0, it.length - 3) }; val hostName: String = InetAddress.getLocalHost().hostName.let { it.substring(0, it.length - 3) };
this.writeQQ(System.currentTimeMillis().toInt())//that's correct this.writeInt(System.currentTimeMillis().toInt())
this.writeHex("01 12");//tag this.writeHex("01 12");//tag
this.writeHex("00 38");//length this.writeHex("00 38");//length
this.write(token0825);//length this.write(token0825);//length
...@@ -94,9 +106,9 @@ class ClientPasswordSubmissionPacket(private val qq: Int, private val password: ...@@ -94,9 +106,9 @@ class ClientPasswordSubmissionPacket(private val qq: Int, private val password:
write(it)//key write(it)//key
writeLong(getCrc32(it))//todo may be int? check that. writeLong(getCrc32(it))//todo may be int? check that.
} }
return super.toByteArray();
} }
}.encodeToByteArray(), Protocol.shareKey.hexToBytes())) }.toByteArray(), Protocol.shareKey.hexToBytes()))
} }
} }
\ No newline at end of file
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