aboutsummaryrefslogtreecommitdiffhomepage
path: root/File-decryption/decode_capture.py
diff options
context:
space:
mode:
authorThomas Van Iseghem <[email protected]>2023-04-23 12:29:29 +0200
committerThomas Van Iseghem <[email protected]>2023-04-23 12:29:29 +0200
commit039cce293a190b028f7013a9fbbcd999e2b348f1 (patch)
treea8217dbefcb15029cadcf48dfec0632bbda64059 /File-decryption/decode_capture.py
parenta4ec128f500754937f078177a35573b808b64d0e (diff)
downloadOpenCortex-039cce293a190b028f7013a9fbbcd999e2b348f1.tar.gz
OpenCortex-039cce293a190b028f7013a9fbbcd999e2b348f1.zip
Renamed "Capture" to "File"-decryption and moved webapp to it
Diffstat (limited to 'File-decryption/decode_capture.py')
-rw-r--r--File-decryption/decode_capture.py24
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