I guess a stupid way to do that would be to prompt "This next step requires you to disconnect from the internet" and loop as long as 8.8.8.8 is pingable or something, then prompt when it's safe to reconnect.
If someone has remote control of your computer, they'd install a sniffer that picks up the password and sends it back next time there's an internet connection.