remove remaining hex code in Pyc file

时间:2018-03-25 19:47:34

标签: python python-3.x compilation hex pyc

I have a project to send, where basically I have to send an email using python.

My code is complete so I was about to send it. Because of the fact the module smtplib needs my email log in, I compiled my code so people could no see my email and password, however, even compiled, when we look at the hex code, we can still see my email and password (and some print)

Is there a way to compile so we have no information left after?

Thank you very much for your help and time !

1 个答案:

答案 0 :(得分:1)

Generally it is a bad idea to hold sensitive information in the code. There is no uniformly the best way to do it, but common practices to store credentials include:

  • in a separate code file not in your code base (local_settings.py, added to .gitignore)
  • in a separate config file outside of the project (e.g. json or yml)
  • environment variables (read using os.environ)
  • command line parameters
  • request as user input
  • a combination of all above