Automated security verification of networking protocols and query auditing algorithms for wireless sensor networks