In computer networks, introducing an intrusion detection system with high precision and accuracy is considered vital. In this article, a proposed model using a deep learning algorithm is presented and its results are analyzed. To evaluate the performance of this algorithm, NSL-KDD, CIC-IDS 2018, UNSW-NB15 and MQTT datasets have been used. The evaluation criteria include precision, accuracy, F1 score, and, readability. The new approach uses a hybrid algorithm that includes a convolutional neural network (CNN) to extract general features and long-short-term memory (LSTM) to extract periodic features that are in the form of a layer. are cross-connected, it is introduced to detect penetration. This algorithm showed the highest known accuracy of 99% on the NSL-KDD dataset. It has reached 97% in all criteria in UNSW-NB15, 96% in all criteria in CIC-IDS 2018, and also, in MQTT for three abstraction levels of features, i.e. packet-based flow features, unidirectional flow, and The two-way flow has reached above 97%, which shows the superiority of this algorithm.