Network Defense And Countermeasures: Principles And Practices