In this paper, we investigate a delayed SEIQRS-V epidemic model for propagation of malicious codes in a wireless sensor network. The communication radius and distributed density of nodes is considered in the proposed model. With this model, first we find a feasible region which is invariant and where the solutions of our model are positive. To show that the system is locally asymptotically stable, a Lyapunov function is constructed. After that, sufficient conditions for local stability and existence of Hopf bifurcation are derived by analyzing the distribution of the roots of the corresponding characteristic equation. Finally, numerical simulations are presented to verify the obtained theoretical results and to analyze the effects of some parameters on the dynamical behavior of the proposed model in the paper.