Energy Efficient Security Mechanism for Black Hole Attacks in WSNs