Ejemplo n.º 1
0
    def post(self):
        if not State.tenant_cache[1].hostname:
            raise errors.ValidationError('hostname is not set')

        net_agent = Settings.get_agent()

        t = ('http', State.tenant_cache[1].hostname, 'robots.txt', None, None)
        url = bytes(urlparse.urlunsplit(t))
        try:
            resp = yield net_agent.request('GET', url)
            body = yield readBody(resp)

            server_h = resp.headers.getRawHeaders('Server', [None])[-1].lower()
            if not body.startswith(
                    'User-agent: *') or server_h != 'globaleaks':
                raise EnvironmentError('Response unexpected')
        except (EnvironmentError, ConnectError) as e:
            raise errors.ExternalResourceError()
 def operation(self):
     net_agent = Settings.get_agent()
     log.debug('Fetching list of Tor exit nodes')
     yield State.tor_exit_set.update(net_agent)
     log.debug('Retrieved a list of %d exit nodes', len(State.tor_exit_set))
Ejemplo n.º 3
0
 def fetch_packages_file(self):
     return get_page(Settings.get_agent(), DEB_PACKAGE_URL)