Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
There's more than one way to do things
 
PerlMonks  

Re: How do I make password prompts not echo back the user?

by Anonymous Monk
on Oct 22, 2003 at 22:30 UTC ( [id://301453]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to How do I make password prompts not echo back the user?

Here's how I did it using Term::Readkey

ReadMode ('noecho');
print "Enter Password: ";
chomp($pw = <STDIN>);
ReadMode ('restore');
  • Comment on Re: How do I make password prompts not echo back the user?

Replies are listed 'Best First'.
Re: Answer: How do I make password prompts not echo back the user?
by batkins (Chaplain) on Oct 22, 2003 at 22:54 UTC
    Another methood is this:
    system('stty -echo'); print "Enter Password: "; chomp($pw = <STDIN>); system('stty echo');

    The computer can't tell you the emotional story. It can give you the exact mathematical design, but what's missing is the eyebrows. - Frank Zappa

       This works but there are two caveats you should bear in mind:

      • If you're running the script as a priviledged process you might have just opened yourself to a local attack, if the user can modify their path and slip in a trojan 'stty' binary.
      • This fails utterly on Windows, amongst other systems.
      Steve
      ---
      steve.org.uk

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://301453]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.