File: outdated_relays.py

package info (click to toggle)
python-stem 1.8.1-2.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 8,152 kB
  • sloc: python: 33,747; java: 312; makefile: 124; sh: 14
file content (19 lines) | stat: -rw-r--r-- 545 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from stem.descriptor.remote import DescriptorDownloader
from stem.version import Version

downloader = DescriptorDownloader()
count, with_contact = 0, 0

print("Checking for outdated relays...")
print("")

for desc in downloader.get_server_descriptors():
  if desc.tor_version < Version('0.2.3.0'):
    count += 1

    if desc.contact:
      print('  %-15s %s' % (desc.tor_version, desc.contact.decode("utf-8", "replace")))
      with_contact += 1

print("")
print("%i outdated relays found, %i had contact information" % (count, with_contact))