An intelligent approach to detect covert attack and provide a secured communication for wireless sensor networks