Sunan Abi Dawud 5102
Abu Hurairah reported the Prophet (May peace be upon him) as saying:
when you hear the cocks crowing, ask Allah for some of His grace, for they have seen as angel; but when you hear an ass braying, seek refuge in Allah from the devil, for it has seen the devil.
حَدَّثَنَا قُتَيْبَةُ بْنُ سَعِيدٍ، حَدَّثَنَا اللَّيْثُ، عَنْ جَعْفَرِ بْنِ رَبِيعَةَ، عَنِ الأَعْرَجِ، عَنْ أَبِي هُرَيْرَةَ، أَنَّ النَّبِيَّ صلى الله عليه وسلم قَالَ ‏
"‏ إِذَا سَمِعْتُمْ صِيَاحَ الدِّيَكَةِ فَسَلُوا اللَّهَ تَعَالَى مِنْ فَضْلِهِ فَإِنَّهَا رَأَتْ مَلَكًا وَإِذَا سَمِعْتُمْ نَهِيقَ الْحِمَارِ فَتَعَوَّذُوا بِاللَّهِ مِنَ الشَّيْطَانِ فَإِنَّهَا رَأَتْ شَيْطَانًا ‏"‏ ‏.‏