Get AI-identified network weaknesses
()
| 19173 | 'success': True, |
| 19174 | 'message': f'Files cleared successfully ({clear_type} clear, {removed} entries)' |
| 19175 | }) |
| 19176 | |
| 19177 | except Exception as e: |
| 19178 | logger.error(f"Error clearing files: {e}") |
| 19179 | return jsonify({'error': str(e)}), 500 |
| 19180 | |
| 19181 | # Legacy endpoint compatibility |
| 19182 | @app.route('/list_files') |
| 19183 | def legacy_list_files(): |
| 19184 | """Legacy endpoint for file listing""" |
| 19185 | try: |
| 19186 | path = request.args.get('path', '/') |
| 19187 | |
| 19188 | # Use the same logic as list_files_api but return legacy format |
| 19189 | if path == '/' or path == '': |
| 19190 | return jsonify([ |
| 19191 | {'name': 'data_stolen', 'is_directory': True, 'children': []}, |
| 19192 | {'name': 'scan_results', 'is_directory': True, 'children': []}, |
| 19193 | {'name': 'crackedpwd', 'is_directory': True, 'children': []}, |
| 19194 | {'name': 'vulnerabilities', 'is_directory': True, 'children': []}, |
| 19195 | {'name': 'logs', 'is_directory': True, 'children': []}, |
| 19196 | {'name': 'backups', 'is_directory': True, 'children': []}, |
| 19197 | {'name': 'uploads', 'is_directory': True, 'children': []} |
| 19198 | ]) |
| 19199 | |
| 19200 | # For other paths, use the web_utils function |
| 19201 | actual_path = "" |
| 19202 | if path.startswith('/data_stolen'): |
| 19203 | actual_path = shared_data.datastolendir |
| 19204 | elif path.startswith('/scan_results'): |
| 19205 | actual_path = shared_data.scan_results_dir |
| 19206 | elif path.startswith('/crackedpwd'): |
| 19207 | actual_path = shared_data.crackedpwddir |
| 19208 | elif path.startswith('/vulnerabilities'): |
| 19209 | actual_path = shared_data.vulnerabilities_dir |
| 19210 | elif path.startswith('/logs'): |
| 19211 | actual_path = shared_data.datadir + '/logs' |
| 19212 | elif path.startswith('/backups'): |
| 19213 | actual_path = shared_data.backupdir |
| 19214 | elif path.startswith('/uploads'): |
| 19215 | actual_path = shared_data.upload_dir |
| 19216 |
nothing calls this directly
no test coverage detected