网页python脚本如何处理内联凭据?

2024-10-03 04:38:07 发布

您现在位置:Python中文网/ 问答频道 /正文

我写了一些脚本,在网页加载时用html调用。我有时被要求在这些脚本中向某些服务传递凭据。例如:

stdout = subprocess.Popen( ["ldapsearch -H ldap://111.111.111.11" +"-LLL -D " +"\"CN=someAccountCN,OU=example,OU=example,OU=example group,DC=example,DC=com\" " +"-x -w somePassword " +"-b \"OU=example group,DC=example,DC=com\" " +"\"("+group[0]+")\""], stdout=subprocess.PIPE, shell=True )

可以预见的是,用户可能可以查看此脚本的内容,并且我希望有某种方式将这些凭据保密(即不让他们看到“someAccountCN”和“somePassword”)。一般如何处理这种情况?我可能会调用一个不同的脚本,它是根的rx;这个解决方案很好,但有点笨拙。我想知道有没有其他的解决办法。在


Tags: 脚本com网页examplehtmlstdoutgroupou