Mishkat al-Masabih
Al-Hasan told in mursal form that he heard God’s Messenger had said, “God curse the one who looks and the one who is looked at!” Baihaqi transmitted it in Shu'ab al-iman.
وَعَنِ الْحَسَنِ مُرْسَلًا قَالَ: بَلَغَنِي أَنَّ رَسُولَ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ قَالَ: «لَعَنَ اللَّهُ النَّاظِرَ وَالْمَنْظُورَ إِلَيْهِ» . رَوَاهُ الْبَيْهَقِيُّ فِي شُعَبِ الْإِيمَانِ
Reference