diff options
Diffstat (limited to 'File-decryption/decode_capture.py')
-rw-r--r-- | File-decryption/decode_capture.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/File-decryption/decode_capture.py b/File-decryption/decode_capture.py new file mode 100644 index 0000000..dd3d413 --- /dev/null +++ b/File-decryption/decode_capture.py @@ -0,0 +1,24 @@ +import sys +import google.protobuf.json_format as json_format +import Capture_pb2 + +if len(sys.argv) != 2: + print(f"Usage: {sys.argv[0]} <protobuf_file>") + sys.exit(1) + +protobuf_file = sys.argv[1] + +# Read the input protobuf from the file +with open(protobuf_file, "rb") as f: + input_data = f.read() + +# Parse the input protobuf into a message object +message = Capture_pb2.Capture() +message.ParseFromString(input_data) + +# Convert the message object to a JSON string +json_string = json_format.MessageToJson(message) + +# Save the JSON string to a file +with open("capture.json", "w") as f: + f.write(json_string)
\ No newline at end of file |