예제 #1
0
 def setUp(self):
     self.probe = OrgProbe({})
     self.probe.rules = [
         "re:url:^http://www\\.talktalk\\.co\\.uk/" +
         "notice/parental-controls\\?accessurl",
         "re:url:^http://www\\.siteblocked\\.org/piratebay\\.html\\?"
     ]
     self.probe.categorizor = Categorizor('querystring:urlclassname:base64')
예제 #2
0
파일: __main__.py 프로젝트: nllz/OrgProbe
    config.set('global', 'interval', 1)
    with open(configfile, 'w') as fp:
        config.write(fp)

if config.has_section('api'):

    def apiconfig(prop, method):
        try:
            setattr(APIRequest, prop.upper(), method('api', prop))
            logging.info("Set %s to %s", prop, getattr(APIRequest,
                                                       prop.upper()))
        except Exception:
            pass

    apiconfig('https', config.getboolean)
    apiconfig('host', config.get)
    apiconfig('port', config.getint)
    apiconfig('version', config.get)

probe = OrgProbe(config)

if '--register' in opts:
    probe.register(opts, config)
    with open(configfile, 'w') as fp:
        config.write(fp)
    sys.exit(0)

else:
    logging.info("Entering run mode")
    sys.exit(probe.run(optargs))