Wpa_cli command requires you to know in advance if a network is open or secured. I'm developing a script using wpa_cli and I just want it to connects to network whether it is open or secured , obviously if secured it should ask for password otherwise it should just connect.
How can I check if a network is open or secured so that scripts runs wpa_cli accordingly?
I just want a behavior like android phone, if a network is open it just connects to it, if it is secured it asks for password.