You can let the RPi connect to open networks with some adjustments in /etc/network/interfaces
iface wlan0 inet manual
and in /etc/wpa_supplicant/wpa_supplicant.conf
With this, the RPi will connect to Open WiFis automatically.
If you want to connect to the "nearest" network, you should write a small script. With
iwlist wlan0 scan you get a list of Wifis an its signal level. You can select which are
- open networks, means no WEP or WPA
- best dBM level
this ESSID you can use with
iwconfig wlan0 essid $bestwifi.