Whenever we feel attacked by forces of darkness, we can put James 4:7 into practice. This says: "Submit yourselves, then, to God. Resist the devil, and he will flee from you."
Our greatest defense against Satan is a right relationship with God through the application of Christ's sin-atoning blood to our hearts. We submit ourselves to God by confessing to Him any known sin in our lives and by actively standing on God's promise of forgiveness and cleansing; see 1 John 1:9.
It is through sin that the devil gains a foothold in our lives. A right relationship with God protects us spiritually in much the same way as an armored breastplate covers and protects all the vital organs of a warrior in battle. Read Ephesians 6:10-18.
Having submitted ourselves to God, we can then effectively resist the devil with truth. Our shield against Satan is our faith in God, which is founded on the truth of God's Word. The only weapon the devil has to use against us is deception. He tries to lure us into spiritual defeat with lies and distortions of the truth.
Christ was once led into the wilderness to be tempted by the devil. But He defeated Satan each time by standing on and quoting the Word of God. The devil finally had to leave when Jesus said, "Away from me, Satan! For it is written ..." (Matthew 4:1-10). It is important for us to use God's Word actively when we are faced with temptations or distressing situations. We should saturate our minds with God's Word, dwelling on who God is and what He has done for us in Christ.