It is narrated from Hazrat Abu Hurairah (may Allah be pleased with him) that the Noble Prophet (peace and blessings be upon him) has commanded that even during prayer, the two black things—that is, the snake and the scorpion—may be killed.
Hadith Referenceمسند احمد / مسند المكثرين من الصحابة / 7817