Update prCount
This commit is contained in:
parent
9b26db0b4f
commit
487f531a8c
32
prCount.py
32
prCount.py
|
@ -3,16 +3,19 @@ import re
|
||||||
|
|
||||||
prLines = []
|
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
|
# 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
|
||||||
file = open("consensus", "r")
|
cons = open("consensus", "r")
|
||||||
|
|
||||||
|
torVersion = input("version to check:")
|
||||||
|
torSearch = "^v.*Tor " + torVersion
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
line1 = file.readline()
|
line1 = cons.readline()
|
||||||
|
|
||||||
if not line1: break
|
if not line1: break
|
||||||
|
|
||||||
if re.search("^v.*Tor 0.4.6.7", line1, re.IGNORECASE):
|
if re.search(torSearch, line1, re.IGNORECASE):
|
||||||
line2 = file.readline()
|
line2 = cons.readline()
|
||||||
prLines.append(line2)
|
prLines.append(line2)
|
||||||
|
|
||||||
c = Counter(prLines)
|
c = Counter(prLines)
|
||||||
|
@ -24,4 +27,21 @@ for element in c.most_common():
|
||||||
print()
|
print()
|
||||||
print(c.most_common(1)[0][0])
|
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…
Reference in a new issue