The incident offers a window into the use of powerful and invasive spyware aimed at students and political opposition members amid contentious elections.