Mishkat al-Masabih
'Abd ar-Rahman b. Abu Laila. said that Abu Laila reported God’s messenger as saying, "When a snake appears in a dwelling say to it, ‘We ask you by the covenant made with Noah and the covenant made with Solomon son of David not to harm us.’ Then if it comes back, kill it." Tirmidhi and Abu Dawud transmitted it.
وَعَنْ عَبْدِ الرَّحْمَنِ بْنِ أَبِي لَيْلَى قَالَ: قَالَ أَبُو لَيْلَى: قَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ: " إِذَا ظَهَرَتِ الْحَيَّةُ فِي الْمَسْكَنِ فَقُولُوا لَهَا: إِنَّا نَسْأَلُكِ بِعَهْدِ نُوحٍ وَبِعَهْدِ سُلَيْمَانَ بْنِ دَاوُدَ أَنْ لَا تُؤْذِينَا فَإِنْ عَادَتْ فَاقْتُلُوهَا ". رَوَاهُ التِّرْمِذِيُّ وَأَبُو دَاوُدَ
Reference