Rescued version of Kel Modderman's wpa_supplicant manager.