Knowing what is in the mind of others is part of 'Elm al-Ghayb ( Knoweldge of the unseen) which is gifted by Allah (SWT) to His humble servants according to different degrees depending on the level of the humbleness of the servant.
The Prophet (SAWA) and Ahlul Bayt (AS) are gifted what Allah Has gifted them from 'Elm al-Ghayb. Even pious believers can know the mind of some person under curtain circumstances. The Hadeeth says: Beware of the deep sight of the believer, as he is guided by the Noor of Allah.
Real piousness opens the gates of facts of life to the pious servant of Allah (SAWA).
Satan does not know our intentions but whispers to people to misguide and harm them.