I am using STEM library in Python
to access Tor. Suppose I have a url which is blocked in my country and I do not know the country from which it will be allowed, how can I scan exit nodes of different countries to find the right exit node for access?
My first thought is to come up with a list of countries you'd like to test accessing the site from and instruct Tor to use ExitNodes from each country and try accessing the site over the Tor socks proxy to get a list of countries that work.
For example (incomplete code):
countries = [ "us", "fr", "de", "ca", "nl" ]
for co in countries:
controller.set_conf("ExitNodes", "{" + co + "}")
# make request using Tor socks proxy for site here
# some check to determine if site is blocking country or not
How the site blocks access to a country determines how to test for it. A country firewall may block access to the site which could just result in timeouts, or if the site blocks access maybe they show a certain message or return a 403
response.
In short, inspect the HTML you get back when using each country as an Exit to determine if you are blocked or not.