AI Is Both Friend and Foe in Cybersecurity