add extremely verbose packet log
This commit is contained in:
parent
ec5bae8b8f
commit
0576f3ce63
|
@ -19,4 +19,6 @@ keys.db
|
|||
/worlds/
|
||||
/dist/
|
||||
/public/
|
||||
/builds/
|
||||
/builds/
|
||||
|
||||
packets.log.enc
|
||||
|
|
|
@ -13,6 +13,7 @@ import (
|
|||
|
||||
"github.com/bedrock-tool/bedrocktool/locale"
|
||||
"github.com/bedrock-tool/bedrocktool/utils"
|
||||
"github.com/bedrock-tool/bedrocktool/utils/crypt"
|
||||
|
||||
_ "github.com/bedrock-tool/bedrocktool/subcommands"
|
||||
_ "github.com/bedrock-tool/bedrocktool/subcommands/skins"
|
||||
|
@ -23,6 +24,7 @@ import (
|
|||
)
|
||||
|
||||
func main() {
|
||||
var extra_debug bool
|
||||
defer func() {
|
||||
if err := recover(); err != nil {
|
||||
logrus.Errorf(locale.Loc("fatal_error", nil))
|
||||
|
@ -35,6 +37,9 @@ func main() {
|
|||
println("--END COPY HERE--")
|
||||
println("")
|
||||
println(locale.Loc("report_issue", nil))
|
||||
if extra_debug {
|
||||
println(locale.Loc("used_extra_debug_report", nil))
|
||||
}
|
||||
if utils.G_interactive {
|
||||
input := bufio.NewScanner(os.Stdin)
|
||||
input.Scan()
|
||||
|
@ -61,6 +66,7 @@ func main() {
|
|||
|
||||
flag.BoolVar(&utils.G_debug, "debug", false, locale.Loc("debug_mode", nil))
|
||||
flag.BoolVar(&utils.G_preload_packs, "preload", false, locale.Loc("preload_packs", nil))
|
||||
flag.BoolVar(&extra_debug, "extra-debug", false, locale.Loc("extra_debug", nil))
|
||||
flag.String("lang", "", "lang")
|
||||
enable_dns := flag.Bool("dns", false, locale.Loc("enable_dns", nil))
|
||||
|
||||
|
@ -99,6 +105,13 @@ func main() {
|
|||
utils.InitDNS()
|
||||
}
|
||||
|
||||
if extra_debug {
|
||||
utils.F_Log, err = os.Create("packets.log")
|
||||
if err != nil {
|
||||
logrus.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
// exit cleanup
|
||||
sigs := make(chan os.Signal, 1)
|
||||
signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)
|
||||
|
@ -110,6 +123,21 @@ func main() {
|
|||
|
||||
subcommands.Execute(ctx)
|
||||
|
||||
// encrypt packet log
|
||||
if extra_debug {
|
||||
data, err := os.ReadFile("packets.log")
|
||||
if err != nil {
|
||||
logrus.Warn(err)
|
||||
} else {
|
||||
enc, err := crypt.Enc("packets.log", data)
|
||||
if err != nil {
|
||||
logrus.Warn(err)
|
||||
} else {
|
||||
os.WriteFile("packets.log.enc", enc, 0o755)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if utils.G_interactive {
|
||||
logrus.Info(locale.Loc("enter_to_exit", nil))
|
||||
input := bufio.NewScanner(os.Stdin)
|
||||
|
|
|
@ -14,6 +14,12 @@ report_issue:
|
|||
https://github.com/bedrock-tool/bedrocktool/issues
|
||||
Und fügen Sie die Fehlerinformationen hinzu, beschreiben Sie, was Sie getan haben, um diesen Fehler zu erhalten.
|
||||
Vielen Dank!
|
||||
used_extra_debug_report:
|
||||
other: |
|
||||
HINWEIS: Sie haben extra-debug verwendet, welches eine packets.log und eine packets.log.enc Datei erstellt.
|
||||
Bitte laden Sie nur die packets.log.enc Datei hoch, wenn Sie ein Problem melden möchten.
|
||||
packets.log und packets.log.enc können Account-Informationen enthalten (nie Login-Informationen), daher ist es sicherer, die verschlüsselte Datei hochzuladen.
|
||||
Diese Datei kann von dem Entwickler gelesen werden, aber nicht von Personen, die die öffentlichen Problemseiten ansehen.
|
||||
enter_to_exit:
|
||||
other: "Drücken Sie die Eingabetaste, um das Programm zu beenden."
|
||||
should_login_xbox:
|
||||
|
|
|
@ -14,6 +14,12 @@ report_issue:
|
|||
https://github.com/bedrock-tool/bedrocktool/issues
|
||||
And attach the error info, describe what you did to get this error.
|
||||
Thanks!
|
||||
used_extra_debug_report:
|
||||
other: |
|
||||
NOTE: you have used extra-debug which creates a packets.log and a packets.log.enc file
|
||||
please if you want to submit an issue only upload the packets.log.enc file.
|
||||
packets.log and packets.log.enc may include account info (never login info) so it is safer to upload the encrypted file.
|
||||
that file can be read by the developer and not by people looking at the public issues page.
|
||||
enter_to_exit:
|
||||
other: "Press Enter to exit."
|
||||
should_login_xbox:
|
||||
|
|
|
@ -14,6 +14,12 @@ report_issue:
|
|||
https://github.com/bedwock-tool/bewdwocktoo/issues
|
||||
And attach the ewwow info, describe what you did to get this ewwow.
|
||||
Thanks!
|
||||
used_extra_debug_report:
|
||||
other: |
|
||||
NOTE: you have used extra-debug which creates a packets.log and a packets.log.enc file
|
||||
please if you want to submit an issue only upload the packets.log.enc file.
|
||||
packets.log and packets.log.enc may include account info (never login info) so it is safer to upload the encrypted file.
|
||||
that file can be read by the developer and not by people looking at the public issues page.
|
||||
enter_to_exit:
|
||||
other: "Press Entew to exit."
|
||||
should_login_xbox:
|
||||
|
|
|
@ -175,14 +175,6 @@ func (c *WorldCMD) Execute(ctx context.Context, f *flag.FlagSet, _ ...interface{
|
|||
return pk, nil
|
||||
}
|
||||
|
||||
super_verbose_log := false
|
||||
if super_verbose_log {
|
||||
utils.F_Log, err = os.Create("packets.log")
|
||||
if err != nil {
|
||||
logrus.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
err = proxy.Run(ctx, server_address)
|
||||
if err != nil {
|
||||
logrus.Error(err)
|
||||
|
@ -540,7 +532,7 @@ func (w *WorldState) OnConnect(proxy *utils.ProxyContext) {
|
|||
map_item_id, _ := world.ItemRidByName("minecraft:filled_map")
|
||||
MAP_ITEM_PACKET.Content[0].Stack.ItemType.NetworkID = map_item_id
|
||||
if gd.ServerAuthoritativeInventory {
|
||||
MAP_ITEM_PACKET.Content[0].StackNetworkID = rand.Int31n(32)
|
||||
MAP_ITEM_PACKET.Content[0].StackNetworkID = 0xffff + rand.Int31n(0xfff)
|
||||
}
|
||||
|
||||
if len(gd.CustomBlocks) > 0 {
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
package crypt
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
_ "embed"
|
||||
"time"
|
||||
|
||||
"golang.org/x/crypto/openpgp"
|
||||
"golang.org/x/crypto/openpgp/armor"
|
||||
"golang.org/x/crypto/openpgp/packet"
|
||||
)
|
||||
|
||||
//go:embed key.gpg
|
||||
var key_gpg []byte
|
||||
var recip *openpgp.Entity
|
||||
|
||||
func init() {
|
||||
block, err := armor.Decode(bytes.NewBuffer(key_gpg))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
recip, err = openpgp.ReadEntity(packet.NewReader(block.Body))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func Enc(name string, data []byte) ([]byte, error) {
|
||||
w := bytes.NewBuffer(nil)
|
||||
wc, err := openpgp.Encrypt(w, []*openpgp.Entity{recip}, nil, &openpgp.FileHints{
|
||||
IsBinary: true, FileName: name, ModTime: time.Now(),
|
||||
}, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if _, err = wc.Write(data); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
wc.Close()
|
||||
return w.Bytes(), nil
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
|
||||
mQGNBGHqFb8BDADdhaCCihGEuMNtgHo931t2/H6D6I/j+kYZkgt54XeQqTQVLkaW
|
||||
FzL/MkLB5Hu3CQl1BlCdg8wRyOLdLOyhwtiAiFGcmUel28eIM+Y/Hcr+cUErGrEd
|
||||
M3r2VjCLytgQeX+jip/Wu/xVrizsCwuy4oxJN1DtAuUMNjP78TBdIa9MJfc68NTW
|
||||
YAbvG6XT3CJaTHQwWGMUC500Jtg647aRMCdWS1JXQqZiIdqFy/dFCgpfRycg9vpz
|
||||
RbxQ+EDZ23GDljIcDeaCJ6WWBMIw2pSdTA6psGl4FMeGfHGWaMPudpm5AATG/X1W
|
||||
bKzhs4JEDcXwu6Si65j7I6BiaxuARfBgRnLBOPhAt+TE0K6jzUc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GP PUBLIC KEY BLOCK-----
|
|
@ -49,7 +49,7 @@ var MutedPackets = []string{
|
|||
}
|
||||
|
||||
var ExtraVerbose []string
|
||||
var F_Log io.Writer
|
||||
var F_Log io.WriteCloser
|
||||
var dmp_lock sync.Mutex
|
||||
|
||||
func dmp_struct(level int, in any, w_type bool) (s string) {
|
||||
|
|
|
@ -21,9 +21,9 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
G_debug bool
|
||||
G_preload_packs bool
|
||||
G_interactive bool
|
||||
G_debug bool // log packet names to console
|
||||
G_preload_packs bool // connect to server to get packs before proxy
|
||||
G_interactive bool // interactive cli input
|
||||
)
|
||||
|
||||
var name_regexp = regexp.MustCompile(`\||(?:§.?)`)
|
||||
|
|
|
@ -9,18 +9,20 @@ import (
|
|||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func UnpackZip(r io.ReaderAt, size int64, unpack_folder string) {
|
||||
zr, _ := zip.NewReader(r, size)
|
||||
for _, src_file := range zr.File {
|
||||
out_path := path.Join(unpack_folder, src_file.Name)
|
||||
src_name := strings.ReplaceAll(src_file.Name, "\\", "/")
|
||||
out_path := path.Join(unpack_folder, src_name)
|
||||
if src_file.Mode().IsDir() {
|
||||
os.Mkdir(out_path, 0o755)
|
||||
} else {
|
||||
os.MkdirAll(path.Dir(out_path), 0o755)
|
||||
fr, _ := src_file.Open()
|
||||
f, _ := os.Create(path.Join(unpack_folder, src_file.Name))
|
||||
f, _ := os.Create(path.Join(unpack_folder, src_name))
|
||||
io.Copy(f, fr)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue