Abstract:The application of generative adversarial networks in network security situational awareness had been discussed. Using the generator and discriminator of generative adversarial networks, analyze the loss changes of Sigmoid function, Tanh function, ReLU function, and LeakyReLU function, and balance the network perception loss of generative adversarial networks. By transforming discrete random variables, a generation function for outputting network security data is obtained. In a generative adversarial network, the instantaneous discrete state of the network security situation is reflected, and the large-scale discrete network security situation perception value is quantified to achieve accurate perception of the network security situation. The results showed that AP2, AP3, and AP4 reached their highest situational awareness values during the third attack phase; In the fifth attack phase, AP1"s situational awareness value reached its highest point, and the perception results were consistent with the actual results. The perception performance was good and played an important role in improving network security.