From 2ed3b94e2419df77dc86e4231a416aa2a20d8926 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Mon, 20 Jan 2020 20:20:12 +0100 Subject: [PATCH] Better log analysis --- scripts/understand_tor.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) mode change 100644 => 100755 scripts/understand_tor.py diff --git a/scripts/understand_tor.py b/scripts/understand_tor.py old mode 100644 new mode 100755 index cbaea7a..8cf5cbc --- a/scripts/understand_tor.py +++ b/scripts/understand_tor.py @@ -9,7 +9,8 @@ input() with open('better_logs.txt', 'w') as f: for line in sys.stdin: - r = re.search(r'650 CIRC (\d+) (\S+) \S+ BUILD_FLAGS=\S+ PURPOSE=(\S+) HS_STATE=(\S+) TIME_CREATED=(\S+) (REASON=(\S+))? -', line) + r = re.search(r'650 CIRC (\d+) (\S+) (\S+) BUILD_FLAGS=(\S+) PURPOSE=(\S+) HS_STATE=(\S+)( REND_QUERY=(\S+))? TIME_CREATED=(\S+)( REASON=(\S+))?', line) if not r: continue - f.write("\n") + circ_id, circ_status, circ_relay_list, build_flags, purpose, hs_state, _, rend_query, time_created, _, reason= r.groups() + f.write(f"{circ_id},{circ_status},{purpose},{hs_state},{rend_query},{reason}\n") + f.flush()