From 9b26db0b4fb63dc6b6084aaa4e5fff80c2a7e7e6 Mon Sep 17 00:00:00 2001 From: HackerNCoder Date: Sat, 30 Oct 2021 01:53:24 +0000 Subject: [PATCH] Add prCount --- prCount.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 prCount.py diff --git a/prCount.py b/prCount.py new file mode 100644 index 0000000..57d3229 --- /dev/null +++ b/prCount.py @@ -0,0 +1,27 @@ +from collections import Counter +import re + +prLines = [] + +# You need a consensus, easiest is to download from collector, e.g: https://collector.torproject.org/recent/relay-descriptors/consensuses/2021-10-29-23-00-00-consensus +file = open("consensus", "r") + +while True: + line1 = file.readline() + + if not line1: break + + if re.search("^v.*Tor 0.4.6.7", line1, re.IGNORECASE): + line2 = file.readline() + prLines.append(line2) + +c = Counter(prLines) + +for element in c.most_common(): + print(element) + +#print(c.most_common()) +print() +print(c.most_common(1)[0][0]) + +file.close()