mirror of https://github.com/CIRCL/lookyloo
chg: Attempt to fix the cache
parent
d7dea9a68e
commit
8e94f7e12a
|
@ -1,9 +1,11 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import csv
|
||||||
import argparse
|
import argparse
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from lookyloo.lookyloo import Indexing, Lookyloo
|
from lookyloo.lookyloo import Indexing, Lookyloo
|
||||||
|
from lookyloo.helpers import get_captures_dir
|
||||||
|
|
||||||
logging.basicConfig(format='%(asctime)s %(name)s %(levelname)s:%(message)s',
|
logging.basicConfig(format='%(asctime)s %(name)s %(levelname)s:%(message)s',
|
||||||
level=logging.INFO)
|
level=logging.INFO)
|
||||||
|
@ -23,6 +25,13 @@ def main():
|
||||||
indexing = Indexing()
|
indexing = Indexing()
|
||||||
indexing.clear_indexes()
|
indexing.clear_indexes()
|
||||||
|
|
||||||
|
# Initialize lookup_dirs key
|
||||||
|
for index in get_captures_dir().rglob('index'):
|
||||||
|
with index.open('r') as _f:
|
||||||
|
recent_uuids = {uuid: str(index.parent / dirname) for uuid, dirname in csv.reader(_f) if (index.parent / dirname).exists()}
|
||||||
|
if recent_uuids:
|
||||||
|
lookyloo.redis.hset('lookup_dirs', mapping=recent_uuids)
|
||||||
|
|
||||||
# This call will rebuild all the caches as needed.
|
# This call will rebuild all the caches as needed.
|
||||||
lookyloo.sorted_capture_cache()
|
lookyloo.sorted_capture_cache()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue