i wanna know if it is possible not to hard code my user name and password in a script that copy a file in the operation system and send it via smtp [gmail]

Thank you!

有帮助吗?

解决方案

I bet that best way will be to keep password encrypted, algo is your choice. Then when user give you credentials you check if it match stored encrypted data and then send it. This will take off the step you have to keep plaintext password in any file/database. Anyway you didn't say if you realy need to keep password plain text (but it seems like a case because of remote use), if so then you should use 2-way encryption to avoid plain text passwords - it can be breaked easy but still needs one more step than just read the config file.

其他提示

Store your data as environment variables or inside a configuration file...

make the script take the username as command line args.

if you import sys, then sys.argv is the list of all command line args, where the first is the name of the python script itself.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top