Protecting Power Grids from Cyberattacks