Hello!
I just password protected my terminal in python+windows, and someone asked how I did it on irc, so I figured I'd post it here.
Step 1: make the python script:
somefile.py
import time
passwd = raw_input('C:\Documents and Settings\yourname>') #you can have it ask for a password as well, but I prefer this.
if passwd == 'somepassword':
print 'password accepted. Welcome, hacker.'
else:
print 'Fuck off, n00b.'
print 'You have been locked out of this terminal.'
time.sleep(42)
print "Jesus, just *fuck off*, ok?"
time.sleep(42)
print "Still waiting?"
time.sleep(42)
print "'Cause, I'm not gonna let you get at the terminal."
while True:
time.sleep(42)
Step 2: create the batch file that will run the python file. it's just one line:
somefile.bat
python C:\path\to\password\program.py
step 3: set the batch file to run when the terminal is started up.
open the run menu. Windows key+R or start -> run
type "regedit"
Navigate to HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor in the side bar. right click and edit the "Autorun" property.
Type in the path to the batch file from step 2.
Now open the command prompt!
it should look normal, but if you don't type in the right password, it gets mad at you
Note that removing python from the classpath or pressing ctrl+C will bypass this, but it's useful for weeding out the skids.