Praise be to Allah.
If the school does not disclose the students’ grades, or the students do not like anyone to see their grades, then it is not permissible to use any means that allow you to do that, and this comes under the heading of spying.
Regarding the prohibition on looking at what people want to hide, there is a warning addressed to the one who listens in on people’s conversations when they dislike that, as al-Bukhaari (7042) narrated from Ibn ‘Abbaas that the Prophet (blessings and peace of Allah be upon him) said: “Whoever speaks of a dream that he did not actually see will be ordered [on the Day of Judgement] to tie two grains of barley together, and he will never be able to do so. Whoever listens in on other people’s conversations when they do not like that will have molten lead poured into his ears on the Day of Resurrection. Whoever makes an image will be punished and will be ordered to breathe life into it, and he will not be able to do so.”
Al-Haafiz Ibn Hajar (may Allah have mercy on him) said:
… Ibn Abi Jamrah said: This includes the one who goes into his house and closes his door, and speaks to someone else. His action indicates that he does not want a stranger to listen to his conversation, so the one who listens to him is included in this warning. He is like one who looks at him through a crack in the door, and there is a warning concerning that, and because if they put out his eye he will not receive compensation.
He said: There is an exception from the general meaning of one who dislikes someone to listen to his conversation in the case of one who speaks with another person in public, and there is someone who does not want to listen to him. In this case, the listener is not included in this warning, because the other person’s action, namely speaking out loud in publics, indicates that he does not dislike others to listen to him, so listening is permissible. "Fath al-Baari (12/429)".
And Allah knows best.