Forces loyal to former Libyan general Khalifa Haftar have attacked Islamic groups and government buildings in Benghazi and Tripoli.