aboutsummaryrefslogtreecommitdiffhomepage
path: root/Capture-decryption/decode_capture.py
blob: bb856189ee0f39a2cc7036d71d72fec1fc96835b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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)

# Print the JSON string to stdout
sys.stdout.write(json_string)