Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x 在Python脚本中隐藏凭证_Python 3.x_Hide_Credentials_Disassembly - Fatal编程技术网

Python 3.x 在Python脚本中隐藏凭证

Python 3.x 在Python脚本中隐藏凭证,python-3.x,hide,credentials,disassembly,Python 3.x,Hide,Credentials,Disassembly,在Python脚本中隐藏凭证的最佳方法是什么? 我希望避免以明文形式存储它 import paramiko # how to avoid clear text ? my_server='myserver' my_password='mysecret' ssh = paramiko.client.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) try: ssh.connect(my_server

在Python脚本中隐藏凭证的最佳方法是什么? 我希望避免以明文形式存储它

import paramiko

# how to avoid clear text ?
my_server='myserver'
my_password='mysecret'

ssh = paramiko.client.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
try:
    ssh.connect(my_server, username='root', password=my_password)
except paramiko.SSHException:
    print("Connection Failed")
    quit()
如果使用pyInstaller创建myscript.exe,是否可以检索明文(我的\u服务器和我的\u密码)“反汇编”该.exe


谢谢

不管它是否以明文形式存储,如果脚本需要密码,拥有脚本的每个人都有密码


将凭证存储在单独的文件中(想到yaml),并在运行时加载该文件。如果每个用户都使用自己的凭据,请不要将凭据文件添加到存储库。

如果您以任何形式发布您的程序,并且您的程序使用密码,则有人可以获取密码。我将提供pyInstaller生成的和exe,而不是脚本。pyInstaller没有任何区别。您的程序本身必须使用明文密码,因此即使exe不容易解包,人们也可以从内存中读取密码。你不能让别人在不知道秘密的情况下使用秘密(除非你控制了他们的客户)。好的,明白了,谢谢。关于“人们可以从内存中读取密码”。你是什么意思?嗯,你用户的计算机在用户的控制之下。因此,无论程序存储在RAM中的是什么,用户都可以使用正确的工具进行读取。