Cyberattacks leave schools, hospitals and utilities struggling to pay ransom, restore services and boost security.