What can a Jew do to be protected from harm during such times of war? Our Sages teach us that the way is through our actions, specifically through that of Talmud Torah (Torah study) and Gemilut Hassadim (Bestowing kindness to another).
Torah Study to counter attack lusts and desires
and bestowing kindness to counter attack conceit & haughtiness.
An action which is also said to be a protective measure for the war of Gog and Magog is making sure to eat a "Seudah Shelishit" (3rd meal) on Shabbat.
Now here is another practical application of the above concept: if you notice yourself falling into the depths of any of those negative character traits (i.e., lusts, desires, conceit and/or haughtiness) then try to work on on the corresponding "counter attack" to lift yourself back up.
Always remember: Only Hashem can watch over us and protect us. Ain Od Milvado!
Ketiva, Vechatima Tova.