def extract_ip_feature(index):
    model = init_dga()
    cursor = client[db_name][coll_name_list[index]].find(timeout=False)
    cache = {}
    print index
    for row in cursor:
        if not ip_p.match(str(row["_id"])):
            continue

        number = len(row["ITEMS"])
        min_ttl = min(row["TTLS"])
        max_ttl = max(row["TTLS"])
        lifetime = int(row["LAST_SEEN"] - row["FIRST_SEEN"])/(60*60*24)

        dd = domain_diversity(row["SUBDOMAINS"], row["ITEMS"])
        ips = ip_pool_stability(row["ITEMS"], db_name)
        tmp_counter = collections.Counter(evaluate_url_list(model, row["ITEMS"]))
        dga = round(tmp_counter['dga']/float(number), 3)

        cache[row["_id"]] = {"number": number, "dd": dd, "ips": ips, "dga": dga,
                             "ttl": [min_ttl, max_ttl], "lifetime": lifetime, "_id": row["_id"]}
        # client[db_name][coll_name_list[index]+"_matrix"].insert(tmp)
    clear_cache(index,  cache)