Get vulnerabilities grouped by IP address with summary statistics. Query param: status=open|resolved|all (default: open)
()
| 12995 | |
| 12996 | update_result.setdefault('warnings', [])[:0] = warnings |
| 12997 | if not update_result['ok']: |
| 12998 | return _update_response(update_result) |
| 12999 | |
| 13000 | _finalize_update(update_result) |
| 13001 | response = _update_response(update_result) |
| 13002 | return response |
| 13003 | |
| 13004 | |
| 13005 | @app.route('/api/system/fix-git', methods=['POST']) |
| 13006 | def fix_git_safe_directory(): |
| 13007 | """Fix git safe directory issue""" |
| 13008 | try: |
| 13009 | import subprocess |
| 13010 | import os |
| 13011 | |
| 13012 | repo_path = os.getcwd() |
| 13013 | |
| 13014 | # Add repo to git safe directories |
| 13015 | result = subprocess.run( |
| 13016 | ['git', 'config', '--global', '--add', 'safe.directory', repo_path], |
| 13017 | cwd=repo_path, |
| 13018 | capture_output=True, |
| 13019 | text=True, |
| 13020 | check=True |
| 13021 | ) |
| 13022 | |
| 13023 | logger.info(f"Added {repo_path} to git safe directories") |
| 13024 | |
| 13025 | return jsonify({ |
| 13026 | 'success': True, |
| 13027 | 'message': f'Successfully added {repo_path} to git safe directories' |
| 13028 | }) |
| 13029 | |
| 13030 | except subprocess.CalledProcessError as e: |
| 13031 | logger.error(f"Failed to fix git safe directory: {e.stderr}") |
| 13032 | return jsonify({ |
| 13033 | 'success': False, |
| 13034 | 'error': f'Failed to fix git configuration: {e.stderr}' |
| 13035 | }), 500 |
| 13036 | except Exception as e: |
| 13037 | logger.error(f"Error fixing git safe directory: {e}") |
| 13038 | return jsonify({'success': False, 'error': str(e)}), 500 |
| 13039 | |
| 13040 | |
| 13041 | # ============================================================================ |
| 13042 | # PWNAGOTCHI INTEGRATION ENDPOINTS |
| 13043 | # ============================================================================ |
| 13044 | |
| 13045 | @app.route('/api/pwnagotchi/status') |
| 13046 | def get_pwnagotchi_status(): |
| 13047 | try: |
| 13048 | status = _build_pwnagotchi_status() |
| 13049 | return jsonify({'success': True, 'status': status}) |
| 13050 | except Exception as e: |
| 13051 | logger.error(f"Error retrieving Pwnagotchi status: {e}") |
| 13052 | return jsonify({'success': False, 'error': str(e)}), 500 |
| 13053 | |
| 13054 |
nothing calls this directly
no test coverage detected