From the course: Python Network Programmability: Scaling Scripts

Unlock this course with a free trial

Join today to access over 22,400 courses taught by industry experts.

Encrypted password file

Encrypted password file

- [Instructor] In this video, I'm gonna show you how to encrypt a file of usernames and passwords using Simple Crypt. This is a Python module that you can import into your projects. And it allows you to encrypt and decrypt data. You can find out more about Simple Crypt on GitHub. We're told that it's essentially a simple, secure encryption and decryption library for Python 2.7 and 3. To install it we use the command pip install simple-crypt. It provides two functions which are encrypt and decryption of data. I'm gonna show you an example in a moment, but there are examples on the GitHub page. And there are some warnings that the whole idea of encrypting with a password is not so smart these days. And there may be other ways to do this. But it's definitely better than storing your passwords in cleartext. So as an example, I could create a file called device-creds and store my usernames and passwords in that file. That's not a good idea because anyone could simply read the contents of…

Contents