MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / _clear_all

Method _clear_all

pager/pager_menu.py:397–429  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

395 time.sleep(0.5)
396
397 def _clear_all(self):
398 try:
399 subprocess.run(['rm', '-rf', LOGS_DIR], timeout=5)
400 os.makedirs(LOGS_DIR, exist_ok=True)
401 except Exception:
402 pass
403 try:
404 for f in os.listdir(CREDS_DIR):
405 if f.endswith('.csv'):
406 os.remove(os.path.join(CREDS_DIR, f))
407 except Exception:
408 pass
409 try:
410 subprocess.run(['rm', '-rf', STOLEN_DIR], timeout=5)
411 os.makedirs(STOLEN_DIR, exist_ok=True)
412 except Exception:
413 pass
414 for name in ['netkb.csv', 'livestatus.csv']:
415 try:
416 path = os.path.join(DATA_DIR, name)
417 if os.path.exists(path):
418 os.remove(path)
419 except Exception:
420 pass
421 for subdir in ['output/scan_results', 'output/vulnerabilities', 'output/zombies']:
422 try:
423 path = os.path.join(DATA_DIR, subdir)
424 subprocess.run(['rm', '-rf', path], timeout=5)
425 os.makedirs(path, exist_ok=True)
426 except Exception:
427 pass
428 self._show_message("All Data Cleared!", ON_COLOR)
429 time.sleep(0.5)
430
431
432def main():

Callers 1

_show_clear_data_menuMethod · 0.95

Calls 3

_show_messageMethod · 0.95
runMethod · 0.45
sleepMethod · 0.45

Tested by

no test coverage detected