The development of the Internet of Things has prominently expanded the perception of human beings, but ensuing security issues have attracted people's attention. From the perspective of the relatively weak sensor network in the Internet of Things. Proposed method is aiming at the characteristics of diversification and heterogeneity of collected data in sensor networks; the data set is clustered and analyzed from the aspects of network delay and data flow to extract data characteristics. Then, according to the characteristics of different types of network attacks, a hybrid detection method for network attacks is established. An efficient data intrusion detection algorithm based on K-means clustering is proposed. This paper proposes a network node control method based on traffic constraints to improve the security level of the network. Simulation experiments show that compared with traditional password-based intrusion detection methods; the proposed method has a higher detection level and is suitable for data security protection in the Internet of Things. This paper proposes an efficient intrusion detection method for applications with Internet of Things.