Automated Synthesis Framework for Network Security and Resilience