I tried many different getpass style packages but they either didn't install properly or would't work.
The code below has been adapted from getpass3.
It requires the getch package and only runs under Python 3.
#/usr/bin/env python3
from getch import *
import sys
echo = '*'