0

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?

4

1 回答 1

0

我的第一个想法是列出您想测试访问该站点的国家/地区列表,并指示 Tor 使用每个国家/地区的 ExitNodes,并尝试通过 Tor socks 代理访问该站点以获取可用的国家/地区列表。

例如(不完整的代码):

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

站点如何阻止访问某个国家/地区决定了如何对其进行测试。国家/地区的防火墙可能会阻止对站点的访问,这可能会导致超时,或者如果站点阻止访问,它们可能会显示特定消息或返回403响应。

简而言之,检查您在使用每个国家/地区作为出口时返回的 HTML 以确定您是否被阻止。

于 2015-12-03T19:54:26.483 回答