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

Function _safe_int

webapp_modern.py:15785–15799  ·  view source on GitHub ↗

Parse an int from request input without raising on bad input. Used wherever a 500 (unhandled ValueError) would otherwise be returned to the client when they pass a non-numeric query arg.

(value, default, min_v=None, max_v=None)

Source from the content-addressed store, hash-verified

15783 except Exception as e:
15784 logger.warning(f"Could not get database stats: {e}")
15785
15786 # Build comprehensive stats object with multiple naming conventions for frontend compatibility
15787 stats = {
15788 # Target counts (multiple naming conventions for compatibility)
15789 'active_target_count': safe_int(shared_data.targetnbr),
15790 'target_count': safe_int(shared_data.targetnbr),
15791 'total_targets': safe_int(shared_data.targetnbr),
15792
15793 'inactive_target_count': safe_int(shared_data.inactive_targetnbr),
15794 'offline_target_count': safe_int(shared_data.inactive_targetnbr),
15795
15796 'total_target_count': safe_int(shared_data.total_targetnbr),
15797 'all_targets': safe_int(shared_data.total_targetnbr),
15798
15799 'new_target_count': safe_int(shared_data.new_targets),
15800 'new_targets': safe_int(shared_data.new_targets),
15801 'new_target_ips': shared_data.new_target_ips if hasattr(shared_data, 'new_target_ips') else [],
15802

Callers 3

attack_logsFunction · 0.85
wardriving_networksFunction · 0.85
get_zap_logsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected