def setUp(self):
     self.database_dir = tempfile.mkdtemp()
     self.factory = sqlite_temp_db.SQLiteTempDBFactory(
         sqlitecon.SQLiteConnectionManager(":memory:", keepalive=True),
         self.database_dir)
     self.temp_stores = set()
Exemplo n.º 2
0
    create_directory(FLAGS.monitor_state_dir)

    try:
        list_ = requests.get(tld_list.TLD_LIST_ADDR, timeout=5)
        if list_.status_code == 200:
            create_directory(FLAGS.tld_list_dir)
            with open('/'.join((FLAGS.tld_list_dir, "tld_list")), 'w') as f:
                f.write(list_.content)
    except requests.exceptions.RequestException:
        logging.warning("Couldn't fetch top level domain list")

    sqlite_log_db = sqlite_log_db.SQLiteLogDB(
        sqlitecon.SQLiteConnectionManager(FLAGS.ct_sqlite_db))

    sqlite_temp_db_factory = sqlite_temp_db.SQLiteTempDBFactory(
        sqlitecon.SQLiteConnectionManager(FLAGS.ct_sqlite_temp_dir + "/meta"),
        FLAGS.ct_sqlite_temp_dir)

    sqlite_cert_db = sqlite_cert_db.SQLiteCertDB(
        sqlitecon.SQLiteConnectionManager(FLAGS.ct_sqlite_cert_db))

    ctlogs = client_pb2.CtLogs()
    with open(FLAGS.ctlog_config, "r") as config:
        log_config = config.read()
    text_format.Merge(log_config, ctlogs)

    ct_server_list = []
    for log in ctlogs.ctlog:
        sqlite_log_db.update_log(log)
        ct_server_list.append(log.log_server)