Security, Protocols and CounterMeasures in Wireless Sensor Networks