US agencies, companies secure networks after huge hack