Пример #1
0
    def _filterRouters(self, routers):
        exitflags = common.string2list(self.opt['exitflags']) 
        relayflags = common.string2list(self.opt['relayflags'])
        relayuptime = int(self.opt['relayuptime'])

        exits = []
        relays = []
        for i in routers:
            if not (False in (f in i.flags for f in exitflags)):
                exits.append(i)
                continue
            
            if not (False in (f in i.flags for f in relayflags)) \
                and i.uptime > relayuptime:
                relays.append(i)

        return (relays, exits)
Пример #2
0
        datadir = common.selectDatadir(datadirs)
    except Exception, e:
        # When no datadir exists or exists without write access
        common.log(e, 'ERROR')
        common.log("Creating new data directory in '%s'" % DATADIR_USER )
        try:
            os.mkdir(os.path.expanduser(DATADIR_USER))
            datadir = DATADIR_USER
        except OSError, e:
            common.log(e, 'ERROR')
            sys.exit(-1)

    # Load all plugins
    # Load string names of plugins from config and retrieve its object representations
    try:
        plugins = common.loadPlugins(common.string2list(config.get('global', 'plugins')))
    except ConfigParser.NoOptionError:
        plugins = {}
    
    opt = common.mergeOptions(config, options)
    
    # DO EVERYTHING HERE
    TorUtil.loglevel = opt['tordebug']
    
    # Create URL Queue. Every URL added to queue will be processed by scanner
    urldisp = urldispatcher.urlDispatcher(opt)
    threaddisp = threaddispatcher.threadDispatcher(opt)
    torctl = sockctl.Controller(opt['torhost'], \
                                 int(opt['torcontrolport']), \
                                 opt['torcontrolpwd'])
    pathdisp = pathdispatcher.pathDispatcher(opt, torctl)
Пример #3
0
    except Exception, e:
        # When no datadir exists or exists without write access
        common.log(e, 'ERROR')
        common.log("Creating new data directory in '%s'" % DATADIR_USER)
        try:
            os.mkdir(os.path.expanduser(DATADIR_USER))
            datadir = DATADIR_USER
        except OSError, e:
            common.log(e, 'ERROR')
            sys.exit(-1)

    # Load all plugins
    # Load string names of plugins from config and retrieve its object representations
    try:
        plugins = common.loadPlugins(
            common.string2list(config.get('global', 'plugins')))
    except ConfigParser.NoOptionError:
        plugins = {}

    opt = common.mergeOptions(config, options)

    # DO EVERYTHING HERE
    TorUtil.loglevel = opt['tordebug']

    # Create URL Queue. Every URL added to queue will be processed by scanner
    urldisp = urldispatcher.urlDispatcher(opt)
    threaddisp = threaddispatcher.threadDispatcher(opt)
    torctl = sockctl.Controller(opt['torhost'], \
                                 int(opt['torcontrolport']), \
                                 opt['torcontrolpwd'])
    pathdisp = pathdispatcher.pathDispatcher(opt, torctl)