[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [tor-relays] Api for atlas.torproject.org



> 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.
_______________________________________________
tor-relays mailing list
tor-relays@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-relays