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

Function toggle_threat_monitor

webapp_modern.py:11864–11891  ·  view source on GitHub ↗

Enable or disable continuous threat monitoring.

()

Source from the content-addressed store, hash-verified

11862 try:
11863 net = _ip.ip_network(raw, strict=False)
11864 normalised = str(net)
11865 except ValueError:
11866 return jsonify({'error': f'Invalid CIDR: {raw}'}), 400
11867
11868 if request.method == 'POST':
11869 if normalised == primary:
11870 return jsonify({'error': 'This is already your primary subnet — no need to add it'}), 400
11871 if normalised not in subnets:
11872 subnets.append(normalised)
11873 shared_data.config['scan_subnets'] = subnets
11874 shared_data.scan_subnets = subnets
11875 shared_data.save_config()
11876 return jsonify({'subnets': subnets, 'primary': primary})
11877
11878 if request.method == 'DELETE':
11879 subnets = [s for s in subnets if s != normalised]
11880 shared_data.config['scan_subnets'] = subnets
11881 shared_data.scan_subnets = subnets
11882 shared_data.save_config()
11883 return jsonify({'subnets': subnets, 'primary': primary})
11884
11885 except Exception as e:
11886 logger.error(f"Error managing scan subnets: {e}")
11887 return jsonify({'error': str(e)}), 500
11888
11889
11890_MAC_RE = re.compile(r'^([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}$')
11891
11892
11893@app.route('/api/config/scan-blacklist', methods=['GET', 'POST', 'DELETE'])
11894def manage_scan_blacklist():

Callers

nothing calls this directly

Calls 3

infoMethod · 0.80
getMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected