The greatest thing that can be used as a defense against devils is sticking to the Book and the Sunnah, by one's knowledge and by one's actions.
The Book and the Sunnah present the straight path, and it is Satan who struggles to steer us from this straight path. Allah says in the Quran,
"And He (commands you, saying This is My straight path, so follow it. Follow not other ways, lest you be parted from His way. This has He ordained for you, that you may ward off evil." (al-Anaam 153). The Prophet (peace be upon him) explained this verse. He once drew a straight linee with his hand and said, "This is the straight path of Allah." Then on its left and on its right he drew other lines and he said, "These paths all have Satan calling (people) to them." And then he recited the above verse. [This was narrated by Ahmad, al-Haakim, who called it sahih, and al-Nasa'i]
If the person follows what has come from Allah in his beliefs, actions, words, worship, law, and so on, and avoids what He has forbidden, then he will be protected from Satan. Allah says in the Quran,
"Oh you who believe, Come, all of you, into submission (unto Him); and follow not the footsteps of Satan. Lo! He is an open enemy for you" (al-Baqara 208). The Arabic word al-silm in that verse refers to Islam while some say it means obeying Allah and Muqaatil says it refers to all acts in which there is righteousness. From that we see that it is an order to apply all of the branches of Islam and all the aspects of its laws according to one's abilities; and the verse prohibits the following of the footsteps of Satan. Whoever does not follow any part of Islam has, in fact, folllowed in some of the footsteps of Satan. Therefore any kind of allowing what Allah has prohibited or vice-versa is a following of Satan. Eating any forbidden and foul foods is all part of following in the footsteps of Satan that has been declared prohibited for us.
"O mankind! Eat that which is lawful and wholesome in the earth, and follow not the footsteps of the devil. Lo! He is an open enemy for you" (al-Baqara 168).
Sticking to the Book of Allah and his Sunnah in one's words and actions will rebuke Satan and will greatly infuriate him. It is recorded in Sahih Muslim, Musnad Ahmad and Sunan Ibn Majah on the authority of Abu Huraira that the Prophet (peace be upon him) said,
"When the son of Adam reads a verse of prostration and then prostrates, Satan departs from him and cries, saying, 'Woe to me. The son of Adam was ordered to prostrate and he did so and, therefore, he will be granted paradise. I was ordered to prostrate and disobeyed and, therefore, I will get the hell-fire."