Update prCount

master
HackerNCoder 11 months ago
parent 9b26db0b4f
commit 487f531a8c
  1. 32
      prCount.py

@ -3,16 +3,19 @@ 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")
# You need a consensus, I download from collector, e.g: https://collector.torproject.org/recent/relay-descriptors/consensuses/2021-10-29-23-00-00-consensus
cons = open("consensus", "r")
torVersion = input("version to check:")
torSearch = "^v.*Tor " + torVersion
while True:
line1 = file.readline()
line1 = cons.readline()
if not line1: break
if re.search("^v.*Tor 0.4.6.7", line1, re.IGNORECASE):
line2 = file.readline()
if re.search(torSearch, line1, re.IGNORECASE):
line2 = cons.readline()
prLines.append(line2)
c = Counter(prLines)
@ -24,4 +27,21 @@ for element in c.most_common():
print()
print(c.most_common(1)[0][0])
file.close()
most_common = c.most_common(1)[0][0]
cons.close()
cons = open("consensus", "r")
while True:
line1 = cons.readline()
if not line1: break
if re.search("^r", line1, re.IGNORECASE):
line2 = cons.readline()
line2 = cons.readline()
if re.search(torSearch, line2, re.IGNORECASE):
line3 = cons.readline()
if line3 != most_common:
print(line1 + line3)

Loading…
Cancel
Save