The paper has two objectives. The first is to study rigorously the transient behavior of some P2P networks where information is replicated and disseminated according to an epidemic type dynamics. The second is to use the insight gained in order to predict how efficient are measures taken against peer to peer networks. We first study a model which extends a classical epidemic model to characterize the peer to peer swarms in the presence of free riding peers. We then study a second model that a peer initiates a contact with another peer chosen randomly. In both cases, the network is shown to have a phase transition: a small change in the parameters causes a large change in the behavior of the network. We show in particular how the phase transition affects measures that content provider networks may take against P2P networks that distribute non-authorized music or books, and what is the efficiency of counter-measures.