简体   繁体   English

我如何安全地防止用户在我的脚本中获取字符串?

[英]How would I securely prevent a user from getting a string in my script?

If I was to give a python script to someone to run, they would have to run it with an API key to allow access to the server.如果我将一个 python 脚本提供给某人运行,他们必须使用 API 密钥运行它以允许访问服务器。 Is there any way I can prevent them from seeing the key but still be able to use it.有什么办法可以阻止他们看到密钥但仍然可以使用它。

If you really need to protect this key, then you need to treat it as a password.如果您确实需要保护此密钥,则需要将其视为密码。

There are various ways of doing this:有多种方法可以做到这一点:

Securely storing passwords for use in python script has 3 answers: 安全存储在 python 脚本中使用的密码有 3 个答案:

  • use bcrypt使用bcrypt
  • use pbkdf2使用pbkdf2
  • and some homebrew method和一些自制方法

I need to securely store a username and password in Python, what are my options? 我需要在 Python 中安全地存储用户名和密码,我有哪些选择? has 7 answers:有 7 个答案:

  • homebrew RAM only method自制 RAM 唯一方法
  • use keyring使用keyring
  • use cryptography使用cryptography
  • use pbkdf2使用pbkdf2
  • and 3 more homebrew methods和另外 3 种自制方法

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何防止永远循环使用我所有 ram 的 python 脚本? - How would I prevent a python script that loops forever from using all my ram? 如果不满足条件,如何防止我的脚本崩溃? - How do I prevent my script from crashing if condition is not met? 如何防止我的机器人获得角色 - How can i prevent my bot from getting roles 如何防止`format()`在字符串中插入换行符? - How do I prevent `format()` from inserting newlines in my string? 我如何在我的 web 应用程序上安全地接受和运行用户代码? - How can i accept and run user's code securely on my web app? 使用\\ frac和\\ sqrt从网站获取解析的数据,如何将它们替换为字符串中的内容 - Getting parsed data from website with \frac and \sqrt how would i replace these with what they are in a string 我如何将 request.user 传递到我的表单中? - How would I pass request.user into my form? 如何防止我的 JSON 文件被 Python 覆盖? - How can I prevent my JSON file from getting overwritten in Python? 当用户在python 2.7中输入字符串时,如何防止出现此错误? - How can I prevent this error from coming up when the user enters a string in python 2.7? 如何防止用户在不登录我使用 Flask 和 Pyrebase4 开发的应用程序的情况下访问 session? - How can I prevent the user from accessing a session without logging in to my application developed with Flask and Pyrebase4?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM