From e0eb5b8e3f88a6ee0cc92334aafe9bc609f44d1f Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Wed, 30 Aug 2023 18:23:22 +0300 Subject: [PATCH] Decode with schema in manualdecrypt utility --- libgm/manualdecrypt/main.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libgm/manualdecrypt/main.go b/libgm/manualdecrypt/main.go index 043500d..3d4d1f4 100644 --- a/libgm/manualdecrypt/main.go +++ b/libgm/manualdecrypt/main.go @@ -109,12 +109,17 @@ func main() { _, _ = fmt.Fprintln(os.Stderr, "------------------------------ RAW DECRYPTED DATA ------------------------------") fmt.Println(base64.StdEncoding.EncodeToString(decrypted)) _, _ = fmt.Fprintln(os.Stderr, "--------------------------------- DECODED DATA ---------------------------------") - cmd := exec.Command("protoc", "--decode_raw") + respType, ok := requestType[ord.Action] + var cmd *exec.Cmd + if ok { + cmd = exec.Command("protoc", "--proto_path=../gmproto", "--decode", string(respType.ProtoReflect().Type().Descriptor().FullName()), "client.proto") + } else { + cmd = exec.Command("protoc", "--decode_raw") + } cmd.Stdin = bytes.NewReader(decrypted) cmd.Stdout = os.Stderr cmd.Stderr = os.Stderr mustNoReturn(cmd.Run()) - respType, ok := requestType[ord.Action] if ok { respData := respType.ProtoReflect().New().Interface() mustNoReturn(proto.Unmarshal(decrypted, respData))