The eavesdropping attack is a serious security threat to a wireless sensor network (WSN) since the eavesdropping attack is a prerequisite for other attacks. Conventional WSNs consist of wireless nodes equipped with omnidirectional antennas, which broadcast radio signals in all directions and are consequently prone to the eavesdropping attacks. Different from omnidirectional antennas, directional antennas radiate radio signals on desired directions and potentially reduce the possibility of the eavesdropping attacks. In this paper, we propose a model to analyze the eavesdropping probability in both single-hop WSNs and multihop WSNs with omnidirectional antennas and directional antennas. We verify the correctness of our analytical model by conducting extensive simulations. We have found that using directional antennas in either single-hop WSNs or multihop WSNs can significantly reduce the eavesdropping probability. The reason of the improved security of WSNs with directional antennas lies in (i) the smaller exposure region of a directional antenna and (ii) the fewer hops to route a packet due to the longer transmission range of a directional antenna. Our results have also shown that the security improvement factor heavily depends on the node density, the antenna beamwidth, and the signal path loss factor.