Aiming at the more and more serious network safety condition inside the electric power domain, this paper puts forward a power system network safety defense scheme that is based on real-time abnormal checking and initiative defense reaction. Through the simulation of network attacks inside the power system, it utilizes Extended Berkeley Packet Filter (EBPF) for the acquisition of kernel data and thus applies the adaptive weighted Bagging-Long Short-Term Memory (Bagging-LSTM) algorithm to carry out anomaly detection with high precision. The adaptive Bagging-LSTM puts together different kinds of network data together with past information, therefore it can carry out adjustment and elevate its performance in accordance with need. This characteristic assists it to give accurate and rapid outcomes when it is carrying out detection work tasks. In the aspect of defense, it uses proactive defense of adaptive attack graph which is based on security knowledge graph (SKG). This method has an integration of an adaptive attack graph reasoning algorithm, which can at once change defense strategies according to historical attack information and future attack threats for the handling of complex and diverse attacks. Through experiments we can get that the model is able to reach a 96.8 percent accuracy, a 80 millisecond response time, and a 2.9 percent false alarm rate; they also have the proof that proactive defense can make protection for the power system defense capability, thus reaching a defense success rate which is 93.5%. In the end, the utilization of the adaptive Bagging algorithm that is combined with SKG has a major function in promoting the security measures of power system defense works, therefore helping to raise the overall network protection degree.