Skip to content

Commit

Permalink
Merge branch 'LNSSPsd:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
chfwd authored Jun 4, 2023
2 parents 539f838 + 948de62 commit c2d5983
Show file tree
Hide file tree
Showing 11 changed files with 342 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ build/phoenixbuilder: build/ ${SRCS_GO}
GODEBUG=madvdontneed=1 CGO_CFLAGS=${CGO_DEF} CGO_ENABLED=1 go build -tags "${APPEND_GO_TAGS}" -trimpath -ldflags "-s -w" -o $@
build/phoenixbuilder-no-readline: build/ ${SRCS_GO}
cd depends/stub&&make clean&&cd -
GODEBUG=madvdontneed=1 CGO_CFLAGS=${CGO_DEF} CGO_ENABLED=1 go build -tags "no_readline" -tags "${APPEND_GO_TAGS}" -trimpath -ldflags "-s -w" -o $@
GODEBUG=madvdontneed=1 CGO_CFLAGS=${CGO_DEF} CGO_ENABLED=1 go build -tags "no_readline ${APPEND_GO_TAGS}" -trimpath -ldflags "-s -w" -o $@
build/phoenixbuilder-with-symbols: build/ ${SRCS_GO}
cd depends/stub&&make clean&&cd -
GODEBUG=madvdontneed=1 CGO_CFLAGS=${CGO_DEF} CGO_ENABLED=1 go build -tags "${APPEND_GO_TAGS}" -trimpath -o $@
Expand Down
9 changes: 5 additions & 4 deletions fastbuilder/bdump/blockNBT/CommandBlock/legacyMethod.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,18 @@ func (c *CommandBlock) PlaceCommandBlockWithLegacyMethod(block *types.Module, cf
} else if block.CommandBlockData.Mode == packet.CommandBlockRepeating {
blockName = "repeating_command_block"
}
block.Block.Name = &blockName
c.BlockEntityDatas.Block.Name = blockName
// 确定命令方块的类型
if block.Block == nil {
block.Block = &types.Block{}
block.Block.Name = &blockName
err := c.WriteDatas(false)
if err != nil {
return fmt.Errorf("PlaceCommandBlockWithLegacyMethod: %v", err)
}
return nil
}
// 如果是 operation 26 - SetCommandBlockData
block.Block.Name = &blockName
c.BlockEntityDatas.Block.Name = blockName
// 确定命令方块的类型 & 如果是 operation 26 - SetCommandBlockData
request := commands_generator.SetBlockRequest(block, cfg)
if c.BlockEntityDatas.Datas.FastMode {
err := c.BlockEntityDatas.API.SendSettingsCommand(request, true)
Expand Down
1 change: 1 addition & 0 deletions fastbuilder/bdump/command/set_command_block_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ func (cmd *SetCommandBlockData) Marshal(writer io.Writer) error {
}

func (cmd *SetCommandBlockData) Unmarshal(reader io.Reader) error {
cmd.CommandBlockData = &types.CommandBlockData{}
buf:=make([]byte, 4)
_, err:=io.ReadAtLeast(reader, buf, 4)
if err!=nil {
Expand Down
116 changes: 116 additions & 0 deletions fastbuilder/core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package core

import (
"bufio"
"bytes"
"encoding/binary"
"encoding/json"
"fmt"
"os"
Expand Down Expand Up @@ -193,6 +195,35 @@ func InitClient(env *environment.PBEnvironment) {
conn.WritePacket(&packet.ClientCacheStatus{
Enabled: false,
})
runtimeid := fmt.Sprintf("%d", conn.GameData().EntityUniqueID)
{
conn.WritePacket(&packet.PyRpc{
Content: []byte{0x82, 0xc4, 0x8, 0x5f, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x5f, 0xc4, 0x5, 0x74, 0x75, 0x70, 0x6c, 0x65, 0xc4, 0x5, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x93, 0xc4, 0xc, 0x53, 0x79, 0x6e, 0x63, 0x55, 0x73, 0x69, 0x6e, 0x67, 0x4d, 0x6f, 0x64, 0x82, 0xc4, 0x8, 0x5f, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x5f, 0xc4, 0x5, 0x74, 0x75, 0x70, 0x6c, 0x65, 0xc4, 0x5, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x91, 0x90, 0xc0},
})
conn.WritePacket(&packet.PyRpc{
Content: []byte{0x82, 0xc4, 0x8, 0x5f, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x5f, 0xc4, 0x5, 0x74, 0x75, 0x70, 0x6c, 0x65, 0xc4, 0x5, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x93, 0xc4, 0xf, 0x53, 0x79, 0x6e, 0x63, 0x56, 0x69, 0x70, 0x53, 0x6b, 0x69, 0x6e, 0x55, 0x75, 0x69, 0x64, 0x82, 0xc4, 0x8, 0x5f, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x5f, 0xc4, 0x5, 0x74, 0x75, 0x70, 0x6c, 0x65, 0xc4, 0x5, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x91, 0xc0, 0xc0},
})
conn.WritePacket(&packet.PyRpc{
Content: []byte{0x82, 0xc4, 0x8, 0x5f, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x5f, 0xc4, 0x5, 0x74, 0x75, 0x70, 0x6c, 0x65, 0xc4, 0x5, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x93, 0xc4, 0x1f, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x61, 0x64, 0x41, 0x64, 0x64, 0x6f, 0x6e, 0x73, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x46, 0x72, 0x6f, 0x6d, 0x47, 0x61, 0x63, 0x82, 0xc4, 0x8, 0x5f, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x5f, 0xc4, 0x5, 0x74, 0x75, 0x70, 0x6c, 0x65, 0xc4, 0x5, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x90, 0xc0},
})
conn.WritePacket(&packet.PyRpc{
Content: bytes.Join([][]byte{[]byte{0x82, 0xc4, 0x8, 0x5f, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x5f, 0xc4, 0x5, 0x74, 0x75, 0x70, 0x6c, 0x65, 0xc4, 0x5, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x93, 0xc4, 0xb, 0x4d, 0x6f, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x43, 0x32, 0x53, 0x82, 0xc4, 0x8, 0x5f, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x5f, 0xc4, 0x5, 0x74, 0x75, 0x70, 0x6c, 0x65, 0xc4, 0x5, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x94, 0xc4, 0x9, 0x4d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0xc4, 0x6, 0x70, 0x72, 0x65, 0x73, 0x65, 0x74, 0xc4, 0x12, 0x47, 0x65, 0x74, 0x4c, 0x6f, 0x61, 0x64, 0x65, 0x64, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x81, 0xc4, 0x8, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x64, 0xc4},
[]byte{byte(len(runtimeid))},
[]byte(runtimeid),
[]byte{0xc0},
}, []byte{}),
})
conn.WritePacket(&packet.PyRpc{
Content: []byte{0x82, 0xc4, 0x8, 0x5f, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x5f, 0xc4, 0x5, 0x74, 0x75, 0x70, 0x6c, 0x65, 0xc4, 0x5, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x93, 0xc4, 0x19, 0x61, 0x72, 0x65, 0x6e, 0x61, 0x47, 0x61, 0x6d, 0x65, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x4c, 0x6f, 0x61, 0x64, 0x82, 0xc4, 0x8, 0x5f, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x5f, 0xc4, 0x5, 0x74, 0x75, 0x70, 0x6c, 0x65, 0xc4, 0x5, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x90, 0xc0},
})
conn.WritePacket(&packet.PyRpc{
Content: bytes.Join([][]byte{[]byte{0x82, 0xc4, 0x8, 0x5f, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x5f, 0xc4, 0x5, 0x74, 0x75, 0x70, 0x6c, 0x65, 0xc4, 0x5, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x93, 0xc4, 0xb, 0x4d, 0x6f, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x43, 0x32, 0x53, 0x82, 0xc4, 0x8, 0x5f, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x5f, 0xc4, 0x5, 0x74, 0x75, 0x70, 0x6c, 0x65, 0xc4, 0x5, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x94, 0xc4, 0x9, 0x4d, 0x69, 0x6e, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, 0xc4, 0xe, 0x76, 0x69, 0x70, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0xc4, 0xc, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x55, 0x69, 0x49, 0x6e, 0x69, 0x74, 0xc4},
[]byte{byte(len(runtimeid))},
[]byte(runtimeid),
[]byte{0xc0},
}, []byte{}),
})
}
env.UQHolder = uqHolder.NewUQHolder(conn.GameData().EntityRuntimeID)
env.UQHolder.(*uqHolder.UQHolder).UpdateFromConn(conn)
env.UQHolder.(*uqHolder.UQHolder).CurrentTick = 0
Expand Down Expand Up @@ -336,6 +367,7 @@ func EnterWorkerThread(env *environment.PBEnvironment, breaker chan struct{}) {
chunkAssembler.CreateRequestScheduler(func(pk *packet.SubChunkRequest) {
conn.WritePacket(pk)
})
getchecknum_everPassed := false
// currentChunkConstructor := &world_provider.ChunkConstructor{}
for {
if breaker != nil {
Expand All @@ -352,6 +384,80 @@ func EnterWorkerThread(env *environment.PBEnvironment, breaker chan struct{}) {

env.NewUQHolder.(*blockNBT_API.PacketHandleResult).HandlePacket(&pk) // for blockNBT

{
p, ok := pk.(*packet.PyRpc)
if ok {
if strings.Contains(string(p.Content), "GetStartType") {
// 2021-12-22 10:51~11:55
// 2023-05-30
// Thank netease for wasting my time again ;)
//fmt.Printf("%X\n", p.Content)
encData := p.Content[len(p.Content)-163 : len(p.Content)-1]
//fmt.Printf("%s\n", p.Content)
//fmt.Printf("%s\n", encData)
//fmt.Printf("%s\n", env.Uid)
client := env.FBAuthClient.(*fbauth.Client)
response := client.TransferData(string(encData), fmt.Sprintf("%s", env.Uid))
//fmt.Printf("%s\n", response)
conn.WritePacket(&packet.PyRpc{
Content: bytes.Join([][]byte{[]byte{0x82, 0xc4, 0x8, 0x5f, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x5f, 0xc4, 0x5, 0x74, 0x75, 0x70, 0x6c, 0x65, 0xc4, 0x5, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x93, 0xc4, 0xc, 0x53, 0x65, 0x74, 0x53, 0x74, 0x61, 0x72, 0x74, 0x54, 0x79, 0x70, 0x65, 0x82, 0xc4, 0x8, 0x5f, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x5f, 0xc4, 0x5, 0x74, 0x75, 0x70, 0x6c, 0x65, 0xc4, 0x5, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x91, 0xc4},
[]byte{byte(len(response))},
[]byte(response),
[]byte{0xc0},
}, []byte{}),
})
//fmt.Printf("%s\n", response)
} else if strings.Contains(string(p.Content), "GetMCPCheckNum") {
// This shit sucks, so as netease.
if getchecknum_everPassed {
continue
}
//fmt.Printf("%X", p.Content)
//fmt.Printf("%s\n", p.Content)
firstArgLenB := p.Content[19:21]
firstArgLen := binary.BigEndian.Uint16(firstArgLenB)
firstArg := string(p.Content[21 : 21+firstArgLen])
secondArgLen := uint16(p.Content[23+firstArgLen])
secondArg := string(p.Content[24+firstArgLen : 24+firstArgLen+secondArgLen])
//fmt.Printf("%s\n", secondArg)
//valM,_:=getUserInputMD5()
//valS,_:=getUserInputMD5()
//valM := utils.GetMD5(fmt.Sprintf("qhk+um%ssvdrx,9=>", secondArg))
//valS := utils.GetMD5(fmt.Sprintf("%s%s", valM[16:], valM[:16]))
//fmt.Printf("%s\n",valM)
client := env.FBAuthClient.(*fbauth.Client)
valM, valS := client.TransferCheckNum(firstArg, secondArg)
/*conn.WritePacket(&packet.PyRpc{
Content: bytes.Join([][]byte{[]byte{0x82, 0xc4, 0x8, 0x5f, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x5f, 0xc4, 0x5, 0x74, 0x75, 0x70, 0x6c, 0x65, 0xc4, 0x5, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x93, 0xc4, 0xe, 0x53, 0x65, 0x74, 0x4d, 0x43, 0x50, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x82, 0xc4, 0x8, 0x5f, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x5f, 0xc4, 0x5, 0x74, 0x75, 0x70, 0x6c, 0x65, 0xc4, 0x5, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x91, 0xc4, 0x20},
[]byte(valM),
[]byte{0xc0},
}, []byte{}),
})*/
conn.WritePacket(&packet.PyRpc{
Content: bytes.Join([][]byte{[]byte{0x93, 0xc4, 0x0e}, []byte("SetMCPCheckNum"), []byte{0x91, 0x93, 0xc4, 0x20},
[]byte(valM),
[]byte{0xc4, 0x20},
[]byte(valS),
[]byte{0xc2},
[]byte{0xC0},
}, []byte{}),
})
getchecknum_everPassed = true
/*go func() {
time.Sleep(3*time.Second)
ud, _ := uuid.NewUUID()
chann := make(chan *packet.CommandOutput)
commandSender.UUIDMap.Store(ud.String(), chann)
commandSender.SendCommand("list", ud)
resp := <-chann
fmt.Printf("%+v\n", resp)
} ()*/
} else {
//fmt.Printf("PyRpc! %s\n", p.Content)
}
}
}

if env.OmegaAdaptorHolder != nil {
env.OmegaAdaptorHolder.(*embed.EmbeddedAdaptor).FeedPacketAndByte(pk, data)
continue
Expand Down Expand Up @@ -552,3 +658,13 @@ func Fatal() {
}
os.Exit(0)
}

func getUserInputMD5() (string, error) {
reader := bufio.NewReader(os.Stdin)
fmt.Printf("MD5: ")
code, err := reader.ReadString('\n')
if err != nil {
return "", err
}
return strings.TrimRight(code, "\r\n"), err
}
27 changes: 27 additions & 0 deletions fastbuilder/cv4/auth/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,33 @@ func (client *Client) TransferData(content string, uid string) string {
return data
}

type FNumRequest struct {
Action string `json:"action"`
First string `json:"1st"`
Second string `json:"2nd"`
}

func (client *Client) TransferCheckNum(first string, second string) (string, string) {
rspreq := &FNumRequest{
Action: "phoenix::transfer-check-num",
First: first,
Second: second,
}
msg, err := json.Marshal(rspreq)
if err != nil {
panic("Failed to encode json")
}
client.SendMessage(msg)
resp, _ := <-client.serverResponse
code, _ := resp["code"].(float64)
if code != 0 {
panic("Failed to transfer checknum")
}
valM, _ := resp["valM"].(string)
valS, _ := resp["valS"].(string)
return valM, valS
}

type WorldChatRequest struct {
Category string `json:"category"`
Action string `json:"action"`
Expand Down
Loading

0 comments on commit c2d5983

Please sign in to comment.