حَدَّثَنَا قُتَيْبَةُ بْنُ سَعِيدٍ، حَدَّثَنَا اللَّيْثُ، عَنْ جَعْفَرِ بْنِ رَبِيعَةَ، عَنِ الأَعْرَجِ، عَنْ أَبِي هُرَيْرَةَ، أَنَّ النَّبِيَّ صلى الله عليه وسلم قَالَ ‏"‏ إِذَا سَمِعْتُمْ صِيَاحَ الدِّيَكَةِ فَسَلُوا اللَّهَ تَعَالَى مِنْ فَضْلِهِ فَإِنَّهَا رَأَتْ مَلَكًا وَإِذَا سَمِعْتُمْ نَهِيقَ الْحِمَارِ فَتَعَوَّذُوا بِاللَّهِ مِنَ الشَّيْطَانِ فَإِنَّهَا رَأَتْ شَيْطَانًا ‏"‏ ‏.‏

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. Translation Not Available

Book Ref: Sunan Abi Dawud Book 43 Hadith 5102
Web Ref:  Sunan Abi Dawud Book 42 Hadith 5083