When you type sudo, you're invoking a setuided file. This means that sudo runs under root user and you don't have acces to root user page memory unles you're root.

Only a keylogger executed under root can read the keyboard when executing sudo.