All perfect praise be to Allaah, the Lord of the worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and messenger.
According to the Sunnah, the effects of magic can be nullified by reciting Quranic verses and protecting oneself with legislated supplications, reciting chapters 112 and 113 of the Quran, and the morning and the evening mention of Allaah, and the mention when going to sleep and when waking up from sleep, when entering and leaving the house, and when entering and coming out of the toilet, and other designated supplications. In reality, this is what repels magic.
Apart from this, nothing else is needed or permitted Islamically.