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

Method clear_files_light

utils.py:551–573  ·  view source on GitHub ↗
(self, handler)

Source from the content-addressed store, hash-verified

549 handler.wfile.write(json.dumps({"status": "error", "message": str(e)}).encode('utf-8'))
550
551 def clear_files_light(self, handler):
552 try:
553 command = """
554 sudo rm -rf data/*.log && sudo rm -rf data/output/data_stolen/* && sudo rm -rf data/output/crackedpwd/* && sudo rm -rf data/output/scan_results/* && sudo rm -rf __pycache__ && sudo rm -rf config/__pycache__ && sudo rm -rf data/__pycache__ && sudo rm -rf actions/__pycache__ && sudo rm -rf resources/__pycache__ && sudo rm -rf web/__pycache__ && sudo rm -rf *.log && sudo rm -rf resources/waveshare_epd/__pycache__ && sudo rm -rf data/logs/* && sudo rm -rf data/output/vulnerabilities/* && sudo rm -rf data/logs/*
555 """
556 result = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
557 stdout, stderr = result.communicate()
558
559 if result.returncode == 0:
560 handler.send_response(200)
561 handler.send_header("Content-type", "application/json")
562 handler.end_headers()
563 handler.wfile.write(json.dumps({"status": "success", "message": "Files cleared successfully"}).encode('utf-8'))
564 else:
565 handler.send_response(500)
566 handler.send_header("Content-type", "application/json")
567 handler.end_headers()
568 handler.wfile.write(json.dumps({"status": "error", "message": stderr}).encode('utf-8'))
569 except Exception as e:
570 handler.send_response(500)
571 handler.send_header("Content-type", "application/json")
572 handler.end_headers()
573 handler.wfile.write(json.dumps({"status": "error", "message": str(e)}).encode('utf-8'))
574
575 def initialize_csv(self, handler):
576 try:

Callers

nothing calls this directly

Calls 2

writeMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected