If your router or access point has WPA or WPA2 enabled, the 802.11 management beacon will include an RSN Information Element that describes the WPA/WPA2 capabilities. You can use the /usr/sbin/iwlist interface scan command to scan for wireless access points. If your device has WPA/WPA2 enabled, the RSN Information Element will be reported in the scan results.
If you look at the results of the following scan, the first access point reports a RSN Information Element whereas the second does not. If the RSN IE is present in the scan results, then your wireless router or access point is configured for WPA/WPA2. In the scan results below, the second access point is not configured for WPA or WPA2.
[user@localhost ~]$ /sbin/iwlist eth7 scan
eth7 Scan completed :
Cell 01 - Address: 00:18:39:7A:B2:E0
ESSID:"AP1"
Mode:Managed
Frequency:2.437 GHz (Channel 6)
Quality:50/94 Signal level:-47 dBm Noise level:-154 dBm
Encryption key:on
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 18 Mb/s
24 Mb/s; 36 Mb/s; 54 Mb/s; 6 Mb/s; 9 Mb/s
12 Mb/s; 48 Mb/s
Extra:bcn_int=100
IE: WPA Version 1
Group Cipher : TKIP
Pairwise Ciphers (1) : TKIP
Authentication Suites (1) : PSK
Cell 02 - Address: 00:1D:7E:0D:1C:8D
ESSID:"AP2"
Mode:Managed
Frequency:2.412 GHz (Channel 1)
Quality:20/94 Signal level:-57 dBm Noise level:-154 dBm
Encryption key:on
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 18 Mb/s
24 Mb/s; 36 Mb/s; 54 Mb/s; 6 Mb/s; 9 Mb/s
12 Mb/s; 48 Mb/s
Extra:bcn_int=100