Add prCount

This commit is contained in:
HackerNCoder 2021-10-30 01:53:24 +00:00
parent 67f64130db
commit 9b26db0b4f

27
prCount.py Normal file
View file

@ -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()