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

Function deep_scan_host

webapp_modern.py:9047–9233  ·  view source on GitHub ↗

Perform a deep scan on a single host using TCP connect scan (-sT). Defaults to the curated top 3000 ports unless the caller explicitly requests a full-range sweep via mode/full flags.

()

Source from the content-addressed store, hash-verified

9045 'error': str(e),
9046 'hosts': [],
9047 'count': 0
9048 }), 500
9049
9050@app.route('/api/network')
9051def get_network():
9052 """Get network scan data from SQLite database - returns ALL hosts (alive and degraded)."""
9053 with _network_context_from_request():
9054 try:
9055 # Get all hosts from SQLite database
9056 hosts = shared_data.db.get_all_hosts()
9057
9058 logger.debug(f"[API /api/network] Retrieved {len(hosts)} total hosts from database")
9059
9060 # Convert to format expected by frontend
9061 network_data = []
9062 alive_count = 0
9063 degraded_count = 0
9064
9065 for host in hosts:
9066 # Parse ports from comma-separated string to list
9067 ports_str = host.get('ports', '')
9068 ports = [p.strip() for p in ports_str.split(',') if p.strip()] if ports_str else []
9069
9070 status = host.get('status', 'unknown')
9071 if status == 'alive':
9072 alive_count += 1
9073 elif status == 'degraded':
9074 degraded_count += 1
9075
9076 # Rogue / threat device detection
9077 from device_classifier import detect_threats
9078 threats = detect_threats(
9079 vendor=host.get('vendor', ''),
9080 mac=host.get('mac', ''),
9081 hostname=host.get('hostname', ''),
9082 ports=ports
9083 )
9084
9085 network_data.append({
9086 'mac': host.get('mac', ''),
9087 'ip': host.get('ip', ''),
9088 'hostname': host.get('hostname', ''),
9089 'vendor': host.get('vendor', ''),
9090 'status': status,
9091 'ports': ports,
9092 'threats': threats,
9093 'failed_pings': host.get('failed_ping_count', 0),
9094 'last_seen': host.get('last_seen', ''),
9095 # Action statuses
9096 'scanner': host.get('scanner_status', ''),
9097 'network_profile': host.get('network_profile', ''),
9098 'ssh_connector': host.get('ssh_connector', ''),
9099 'rdp_connector': host.get('rdp_connector', ''),
9100 'ftp_connector': host.get('ftp_connector', ''),
9101 'smb_connector': host.get('smb_connector', ''),
9102 'telnet_connector': host.get('telnet_connector', ''),
9103 'sql_connector': host.get('sql_connector', ''),
9104 'steal_files_ssh': host.get('steal_files_ssh', ''),

Callers

nothing calls this directly

Calls 8

infoMethod · 0.80
debugMethod · 0.80
errorMethod · 0.80
itemsMethod · 0.45
to_dictMethod · 0.45
getMethod · 0.45
decodeMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected