Network protection against worms and cascading failures using modularity partitioning