[tor-relays] Api for atlas.torproject.org
Damian Johnson
atagar at torproject.org
Sat Feb 17 01:12:56 UTC 2018
> Or any other easier way to do it in like python :)
Here ya go. This downloads the consensus so if you're gonna be doing
more than an occasional one-off check you should use the suggestions
from teor.
========================================
import sys
import stem.descriptor.remote
def is_exit(address):
for desc in stem.descriptor.remote.get_consensus():
if 'Exit' in desc.flags and address == desc.address:
return True
return False
if __name__ == '__main__':
if len(sys.argv) < 2:
print('You need to provide an address to check.')
elif is_exit(sys.argv[1]):
print('%s is a tor exit.' % sys.argv[1])
else:
print('%s is not a tor exit.' % sys.argv[1])
========================================
% python demo.py 199.58.81.140
199.58.81.140 is not a tor exit.
% python demo.py 154.16.149.74
154.16.149.74 is a tor exit.
More information about the tor-relays
mailing list