fix: use getpass instead of os.getlogin

This commit is contained in:
Markus Pesch 2023-02-23 15:26:18 +01:00
parent 47c3c4da7e
commit e828f0333a
Signed by: volker.raschek
GPG Key ID: 852BCC170D81A982

View File

@ -10,12 +10,13 @@ from cryptography.hazmat.primitives.asymmetric import ed25519, dsa, rsa, ec
from io import StringIO from io import StringIO
from scp import SCPClient from scp import SCPClient
from paramiko import RSAKey, Ed25519Key, ECDSAKey, DSSKey, PKey, SSHClient from paramiko import RSAKey, Ed25519Key, ECDSAKey, DSSKey, PKey, SSHClient
import getpass
def main(): def main():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument("--host", dest="hostname", required=True, type=str, help="SSH-Server") parser.add_argument("--host", dest="hostname", required=True, type=str, help="SSH-Server")
parser.add_argument("--port", dest="port", default=22, type=int, help="SSH-Port") parser.add_argument("--port", dest="port", default=22, type=int, help="SSH-Port")
parser.add_argument("--username", dest="username", default=os.getlogin(), type=str, help="Remote Unix User") parser.add_argument("--username", dest="username", default=getpass.getuser(), type=str, help="Remote Unix User")
parser.add_argument("--password", dest="password", default=None, type=str, help="Remote password") parser.add_argument("--password", dest="password", default=None, type=str, help="Remote password")
parser.add_argument("--identity-file", dest="identity_file", default=None, type=str, help="Path to private SSH-Key") parser.add_argument("--identity-file", dest="identity_file", default=None, type=str, help="Path to private SSH-Key")
parser.add_argument("--identity-passphrase", dest="identity_passphrase", default=None, type=str, help="Passphrase of the SSH-Key") parser.add_argument("--identity-passphrase", dest="identity_passphrase", default=None, type=str, help="Passphrase of the SSH-Key")