@@ -210,50 +210,3 @@ def migrate_networks_from_wpa_supplicant():
210210 except Exception as e :
211211 print (f"Error migrating WiFi networks: { e } " )
212212 return None
213-
214-
215- def migrate_from_networkmanager ():
216- """Scan NetworkManager connections and migrate to Redis."""
217- try :
218- # Get all wifi connections
219- result = subprocess .run (
220- ["nmcli" , "-t" , "-f" , "NAME,TYPE" , "connection" , "show" ],
221- capture_output = True , text = True , check = True
222- )
223-
224- wifi_connections = []
225- for line in result .stdout .splitlines ():
226- parts = line .split (':' , 1 )
227- if len (parts ) == 2 :
228- name , conn_type = parts
229- if conn_type == 'wifi' :
230- wifi_connections .append (name )
231-
232- networks = []
233- for conn_name in wifi_connections :
234- # Get connection details
235- result = subprocess .run (
236- ["sudo" , "nmcli" , "--show-secrets" , "connection" , "show" , conn_name ],
237- capture_output = True , text = True , check = True
238- )
239-
240- # Parse output to get SSID and PSK
241- ssid = None
242- psk = None
243-
244- for line in result .stdout .splitlines ():
245- if "802-11-wireless.ssid:" in line :
246- ssid = line .split (":" , 1 )[1 ].strip ()
247- elif "802-11-wireless-security.psk:" in line :
248- psk = line .split (":" , 1 )[1 ].strip ()
249-
250- if ssid :
251- if psk :
252- networks .append ({'ssid' : ssid , 'psk' : psk })
253- else :
254- networks .append ({'ssid' : ssid })
255-
256- return networks
257- except Exception as e :
258- print (f"Error migrating from NetworkManager: { e } " )
259- return None
0 commit comments