Skip to content

Commit

Permalink
new: script to remove a capture from lookyloo
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafiot committed Mar 19, 2024
1 parent 365f91d commit cf14afa
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tools/remove_capture.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env python3

import argparse
import shutil

from lookyloo import Lookyloo
from lookyloo.helpers import get_homedir

removed_captures_dir = get_homedir() / 'removed_captures'


def main() -> None:
parser = argparse.ArgumentParser(description='Remove a capture from the archives.')
parser.add_argument('capture_uuid', help='The UUID of the capture to remove.')
args = parser.parse_args()

lookyloo = Lookyloo()
if capture_cache := lookyloo.capture_cache(args.capture_uuid):
removed_captures_dir.mkdir(parents=True, exist_ok=True)
print(f'Moving {capture_cache.capture_dir} to {removed_captures_dir / capture_cache.capture_dir.name}')
shutil.move(str(capture_cache.capture_dir), str(removed_captures_dir / capture_cache.capture_dir.name))
else:
print(f'Unable to find capture with UUID {args.capture_uuid}.')


if __name__ == '__main__':
main()

0 comments on commit cf14afa

Please sign in to comment.