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

Function debug_server_capabilities

webapp_modern.py:16759–16805  ·  view source on GitHub ↗

Debug endpoint to see raw capability detection values

()

Source from the content-addressed store, hash-verified

16757def legacy_network_data():
16758 """Network data endpoint with WiFi-specific persistence"""
16759 try:
16760 # Update WiFi-specific network data from latest scan results
16761 update_wifi_network_data()
16762
16763 # Read from WiFi-specific persistent file
16764 network_data = read_wifi_network_data()
16765
16766 # If no persistent data, build from current scan results
16767 if not network_data:
16768 logger.debug("No WiFi-specific network data found, building from scan results")
16769
16770 scan_results_dir = getattr(shared_data, 'scan_results_dir', os.path.join('data', 'output', 'scan_results'))
16771 current_time = datetime.now().isoformat()
16772
16773 if os.path.exists(scan_results_dir):
16774 temp_data = {}
16775
16776 for filename in os.listdir(scan_results_dir):
16777 if filename.startswith('result_') and filename.endswith('.csv'):
16778 filepath = os.path.join(scan_results_dir, filename)
16779 try:
16780 with open(filepath, 'r', encoding='utf-8', errors='ignore') as f:
16781 reader = csv.reader(f)
16782 for row in reader:
16783 if len(row) >= 1 and row[0].strip():
16784 ip = row[0].strip()
16785 if re.match(r'^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$', ip):
16786 hostname = row[1] if len(row) > 1 and row[1] else ''
16787 alive = row[2] if len(row) > 2 and row[2] else '1'
16788 mac = row[3] if len(row) > 3 and row[3] else ''
16789
16790 # Collect ports from remaining columns
16791 ports = []
16792 if len(row) > 4:
16793 for port_col in row[4:]:
16794 if port_col and port_col.strip():
16795 ports.append(port_col.strip())
16796
16797 # Update or add entry
16798 if ip in temp_data:
16799 # Merge data
16800 if hostname and hostname != 'Unknown':
16801 temp_data[ip]['Hostnames'] = hostname
16802 if mac and mac != 'Unknown':
16803 temp_data[ip]['MAC Address'] = mac
16804 temp_data[ip]['Alive'] = int(alive) if alive.isdigit() else 1
16805 existing_ports = set(temp_data[ip]['Ports'].split(';')) if temp_data[ip]['Ports'] else set()
16806 existing_ports.update(ports)
16807 temp_data[ip]['Ports'] = ';'.join(sorted(existing_ports, key=lambda x: int(x) if x.isdigit() else 0))
16808 temp_data[ip]['LastSeen'] = current_time

Callers

nothing calls this directly

Calls 5

get_server_capabilitiesFunction · 0.90
releaseMethod · 0.80
get_capabilitiesMethod · 0.80
get_feature_statusMethod · 0.80
readMethod · 0.45

Tested by

no test coverage detected