diff --git a/templates/index.html b/templates/index.html
index a42851f..1dc4a20 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -491,14 +491,15 @@
-
WiFi Interface
+
WiFi Adapter
-
airmon-ng:Checking...
@@ -4386,12 +4387,18 @@
// Refresh WiFi interfaces
function refreshWifiInterfaces() {
+ const select = document.getElementById('wifiInterfaceSelect');
+ select.innerHTML = '';
+
fetch('/wifi/interfaces')
- .then(r => r.json())
+ .then(r => {
+ if (!r.ok) throw new Error('Failed to fetch interfaces');
+ return r.json();
+ })
.then(data => {
- const select = document.getElementById('wifiInterfaceSelect');
- if (data.interfaces.length === 0) {
+ if (!data.interfaces || data.interfaces.length === 0) {
select.innerHTML = '';
+ showNotification('WiFi', 'No WiFi interfaces detected. Make sure you have a WiFi adapter connected.');
} else {
select.innerHTML = data.interfaces.map(i => {
// Build descriptive label with available info
@@ -4405,20 +4412,28 @@
if (i.monitor_capable) label += ' [Monitor OK]';
return ``;
}).join('');
+ showNotification('WiFi', `Found ${data.interfaces.length} interface(s)`);
}
// Update tool status
const statusDiv = document.getElementById('wifiToolStatus');
- statusDiv.innerHTML = `
- airmon-ng:${data.tools.airmon ? 'OK' : 'Missing'}
- airodump-ng:${data.tools.airodump ? 'OK' : 'Missing'}
- `;
+ if (statusDiv) {
+ statusDiv.innerHTML = `
+ airmon-ng:${data.tools?.airmon ? 'OK' : 'Missing'}
+ airodump-ng:${data.tools?.airodump ? 'OK' : 'Missing'}
+ `;
+ }
// Update monitor status
if (data.monitor_interface) {
monitorInterface = data.monitor_interface;
updateMonitorStatus(true);
}
+ })
+ .catch(err => {
+ console.error('Error fetching WiFi interfaces:', err);
+ select.innerHTML = '';
+ showNotification('WiFi Error', 'Could not detect WiFi interfaces: ' + err.message);
});
}