[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [ooni-probe/master] Add a very simple example on how to securely parse the ooniprobe reports



commit 83b0a8e394f281ac41abe0be52c7560e285e0967
Author: Arturo Filastò <art@xxxxxxxxx>
Date:   Fri Dec 7 03:08:08 2012 +0100

    Add a very simple example on how to securely parse the ooniprobe reports
---
 scripts/example_parser.py |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/scripts/example_parser.py b/scripts/example_parser.py
new file mode 100644
index 0000000..6c0dfab
--- /dev/null
+++ b/scripts/example_parser.py
@@ -0,0 +1,22 @@
+# This is an example of how to parse ooniprobe reports
+
+import yaml
+import sys
+print "Opening %s" % sys.argv[1]
+f = open(sys.argv[1])
+yamloo = yaml.safe_load_all(f)
+
+report_header = yamloo.next()
+print "ASN: %s" % report_header['probe_asn']
+print "CC: %s" % report_header['probe_cc']
+print "IP: %s" % report_header['probe_ip']
+print "Start Time: %s" % report_header['start_time']
+print "Test name: %s" % report_header['test_name']
+print "Test version: %s" % report_header['test_version']
+
+for report_entry in yamloo:
+    print "Test: %s" % report_entry['test']
+    print "Input: %s" % report_entry['input']
+    print "Report: %s" % report_entry['report']
+
+f.close()

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits