Questions tagged [getpass]

Use for questions concerning the Python stdlib module which provides secure and portable password input

Many programs that interact with the user via the terminal need to ask the user for password values without showing what the user types on the screen. The getpass module provides a portable way to handle such password prompts securely.

52 questions
0
votes
1 answer

Python getpass works at second attempt when in separate module

I try to use a seperate Module with a getpass() function in it, e.g. #! /usr/bin/python3 from getpass import getpass import sys def mypass(): try: password = getpass('Password: ') except Exception as e: print(e) …
mxFrank
  • 11
  • 3
0
votes
0 answers

How to fake user input in python

I recently came across this website. In the implore bar, if you type "/" and then some random letters, it will look like you are not typing that and are instead typing "Sam says sweet sounds". I am currently using Python3, and I wonder if that's…
Rebecca
  • 23
  • 1
  • 6
0
votes
1 answer

Using getpass() fails in the self.__init__() method but works fine when used functionally. Why is this?

I can't work out what I'm doing wrong here. I want to set up a new user if this class is instantiated and there is no user already pickled. My __init__ method currently looks like this: class User: def __init__(self, *args, **kwargs): if…
nihilok
  • 1,325
  • 8
  • 12
0
votes
1 answer

Is there method such that password won't be echoed on cmd while passing it as command line argument?

I am trying to build a Python application for running in various platforms, for that I am adding command line options for parameters, two of which is username and password. For password, I don't want it to be echoed on screen while someone is…
M S
  • 3
  • 2
0
votes
0 answers

How to turn off ECHO in IDLE python as i have to use it to maskpasswords

[GCC 8.4.0] on linux Type "help", "copyright", "credits" or "license()" for more information. >>> import getpass >>> f=getpass.getpass() Warning (from warnings module): File "/usr/lib/python3.6/getpass.py", line 62 passwd =…
0
votes
1 answer

Getting password using getPass isn't working for me

My code : from getpass import getpass def display_credentials(): website = input("Enter the name of the website:") password = getpass("Enter master password: ") print(website) print(password) if __name__ == "__main__": …
0
votes
1 answer

Why expect is able to interact with `getpass` call?

I am surprised about way of working getpass(). I am using it in python, however I am aware of the fact that it is about https://linux.die.net/man/3/getpass call in reality. Moreover, I am aware of the fact that ssh-add uses it as well. It is not…
dbs9654
  • 13
  • 3
0
votes
1 answer

getpass.getuser / os.environ['username'] returns computer name and not username

I made a service with python which will call this app made with pyinstaller using subprocess.popen. It makes a call to getpass.getuser() but instead of the username it returns the computer-name. I've tried getpass.getuser() / os.environ['username']…
Wasim Afser
  • 48
  • 10
0
votes
2 answers

send an input file to a python code which is using getpass function

Assume this code as a simple Python code which can get username and password: from getpass import getpass user = getpass(" enter username :") pass = getpass(" enter password ") print("user = ", user) print("pass = ", pass) in addition, suppose…
Saeed
  • 159
  • 3
  • 13
0
votes
1 answer

How to remove \r character from the getpass prompt

I have written a code which actually matches the patter RegEx in Python. I have used getpass library to prompt the user to enter the password.But if the user enters the wrong password[say 'HH'-which is invalid password].Once the user hits enter…
Akash
  • 1
  • 1
0
votes
0 answers

Why does python getpass not work for connecting to gmail using imapclient, and how should I accomplish connecting in instead?

I want to connect to gmail using imapclient. I've followed the example from the book "Automate the Boring Stuff with Python" chapter 16 by Al Sweigart. The code from the book works well in interactive mode. However, Al and others warn to not include…
John
  • 11
  • 6
0
votes
0 answers

python 3 - getpass.getpass() is echoing password... nothing seems to work

So I wrote a script, and it actually worked for a while. I import the getpass module, and sure enough the user name was echoed, but the password was not. I ran the script several weeks later, and now the password is echoing. Here's my code: import…
MS-87
  • 173
  • 1
  • 10
0
votes
1 answer

Problem in using getpass with psycog for password management

My goal is to use getpass to hide the entry of my password when I connect to a postgresql database via python3. I use python3 on jyputer notebook. This work well : connect = psycopg2.connect("dbname='db_toto' user='dad' host='xx.xx.xxx.x'…
A. Sègla
  • 11
  • 2
0
votes
2 answers

Testing getpass module: 'password input may be echoed'

I'm looking for any insight into why the below error is raised. I'm wondering if the issue is with pytest? I'm otherwise using getpass with no issues in my application. However, I'm new to the testing world. common.py: def username_password(): …
Michael Johnson
  • 470
  • 6
  • 18
0
votes
1 answer

getpass python3 no input

existing_users = { 'adam' : 'Test123' } unverified_users = [] status = "" status = input("If you have an account, type YES, NO to create a new user, QUIT to exit: ") status = status.lower() max_attempts = 2 import getpass while…
cyzczy
  • 197
  • 1
  • 2
  • 11