#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2005
    Posts
    2
    Rep Power
    0

    Scrambling passwords at login?


    Hi,

    I'm looking around to find a way to replace password input with "***" or even completely mute the echo. I'd like to do it without using special ANSI codes (I tried the "no echo" code but it didn't work anyway).

    Any ideas? I'm using the asyncore/asynchat modules. I'm afraid I'll have to rewrite the push() method.
  2. #2
  3. Commie Mutant Traitor
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Jun 2004
    Location
    Alpharetta, GA
    Posts
    1,806
    Rep Power
    1570
    If you are using a text-only interface, you could try getpass.getpass() from the standard library. Try this test code to see if it is what you want:
    Code:
    # File: getpass-example-1.py
    
    import getpass
    
    usr = getpass.getuser()
    pwd = getpass.getpass("enter password for user %s: " % usr)
    print usr, pwd
    This may give you problems in Windows, however. While it worked fine in the Windows Console itself, it wouldn't work in the DrPython or IDLE test windows; in the former it failed to work at all, while in the latter the prompt worked correctly but the text was echoed, and it gave a warning message.

    There is also a Console module available specifically for Windows which I believe provides the same functionality.
    Last edited by Schol-R-LEA; July 19th, 2005 at 01:33 AM.
    Rev First Speaker Schol-R-LEA;2 JAM LCF ELF KoR KCO BiWM TGIF
    #define KINSEY (rand() % 7) λ Scheme is the Red Pill
    Scheme in Short Understanding the C/C++ Preprocessor
    Taming Python A Highly Opinionated Review of Programming Languages for the Novice, v1.1

    FOR SALE: One ShapeSystem 2300 CMD, extensively modified for human use. Includes s/w for anthro, transgender, sex-appeal enhance, & Gillian Anderson and Jason D. Poit clone forms. Some wear. $4500 obo. tverres@et.ins.gov

IMN logo majestic logo threadwatch logo seochat tools logo