func sendPacket(pk lav7.Packet) { sendFromFields(0x80, raknet.Fields{ "seqNumber": lastSeq, "packets": []*raknet.EncapsulatedPacket{ raknet.NewEncapsulated( func() *buffer.Buffer { buf := buffer.FromBytes([]byte{pk.Pid()}) buf.Append(pk.Write()) return buf }(), ), }, }) lastSeq++ }
func auth() { go func() { for { recvBuffer := make([]byte, 1024*4) if _, err := bufio.NewReader(conn).Read(recvBuffer); err != nil { panic(err) } spew.Dump(recvBuffer) if len(recvBuffer) >= 8 && recvBuffer[0] >= 0x80 && recvBuffer[0] < 0x90 && recvBuffer[4] == 0x00 && recvBuffer[7] == 0x15 { fmt.Println("Session is closed!") os.Exit(0) } else if recvBuffer[0] >= 0x80 && recvBuffer[0] < 0x90 { dp := &raknet.DataPacket{ Buffer: buffer.FromBytes(recvBuffer), } dp.Decode() for _, ep := range dp.Packets { if ep.Buffer.Payload[0] == 0x91 { fmt.Println("Session is closed!") os.Exit(0) return } } } } }() send(ocr1) send(ocr2) send(handshake) lastSeq++ sendCompressed(&lav7.Login{ Username: "******", Proto1: lav7.MinecraftProtocol, Proto2: lav7.MinecraftProtocol, ClientID: 0, SkinName: "WhoKnows", Skin: make([]byte, 32*64*4), }) lastSeq++ }