The paper applies the segmentation of peer-to- peer network to the defense process of P2P-based botnet, in order to cause the greatest damage on the P2P network. A lot of papers have been researching how to find the key nodes in P2P networks. To solve this problem, this paper proposes distributed detection algorithm NEI and centralized detection algorithm COR for detecting cut vertex, NEI algorithm not only apply to detect cut vertex of directed graph but also to the undirected graph. COR algorithm can reduce the additional communication. Then, this paper carries out simulation on P2P botnet, the simulation results show that the maximum damage on the botnet can be achieved by destructing key nodes.