Sayyiduna Abdullah bin Mas'ud (may Allah be pleased with him) narrated: We were with the Prophet (peace and blessings be upon him) in a cave when a snake came out. He said: "Kill it," but it got ahead of us. Then he said: "It has been protected from your harm just as you have been protected from its harm."
Hadith Referenceالمعجم الكبير للطبراني / باب العين / 10116