Skip to content

4sync0/pyfernet

Repository files navigation

pyfernet

python cryptography fernet

NOTE

The default database is still not secure, it will be kept that way for testing and non-important functions as it provides an easier way of doing things.
Regarless, as promissed, I'm working in a easy way to be able to input your own custom database, for now you can only connect to a mongodb database, and the program will forget on exit but I have plans to make it possible to also connect to a mysql db and to make the program re-connect to the custom database every time its being used.

But for now that's all we have, it should work fine on windows and unix (see b-128)

fernet encryption jpg

last-commit badge discord badge build badge

What's all this?

this is a cryptography project built thanks to the cryptography package
with this project, you can encrypt any file using fernet for more information regarding the fernet package, check their github repo

Why use pyfernet?

Everyone can encrypt their files using fernet, but you could save all those 20 minutes that would take you to set up the package, plus the headache you'd get for any error, specially if you don't know what you're doing.
With pyfernet, you can now do all without wasting time, no knowledge with python or cryptography is required
With pyfernet, you can encyrpt files, decrypt files, save it in a json file, manage the keys... & weekly updates!

  • Compatibility with Mac, linux & windows
  • frequently updated
  • easy to use
  • feature-rich

Installation Guide

This section of the readme file is totally dedicated to the installation of pyfernet, if you follow all the stepts, you should get no errors during the process.

  1. Make sure you have python and pip downloaded, if not, download it here (pip should already come with python)
    you can check it by running python --version and pip --version
  2. git is required for this step, so make sure you've it installed, once you have git and python installed, clone this repository by running the following command:
    git clone https://github.com/Party-Pie/pyfernet.git
  3. Now, navigate to the root directory of the repository with this command: cd pyfernet
  4. Once there, install the package dependencies which are essential: pip install -r requirements.txt
  5. And finally, run main.py: python main.py (make sure you're still on the root directory)

You're all done! now, every time you want to use pyfernet you can do so by running fernet in your terminal.

How to use pyfernet

Please read this section, specially if it's your first time using pyfernet as it contains essential information over how to use this.

Once you've gone over the intallation guide, you may be wondering how to do use this great tool, don't worry, it's nothing complex, infact, it's pretty simple but do read carefully.

Essential commands (you'd run each time you start another sesion)

  • Firstly, you need to type /new in order to tell the script which file you're going to be using during this sesion
  • Now, you'll have to either generate the key (/genkey) or, if you already have a key, (/setkey). Note: each time you close sesion, none of this info. will save, so you'll need to run these last commands again.
    A key are some words and numbers, joint together, which can be used to decrypt or encrypt files. Each file has a unique key.
    You can check if there is a key and a file generated/setted running these commands: /key and /file.

Other important commands

  • You can encrypt files with this self-explanatory command: /encrypt & to decrypt: /decrypt
  • You could also change the current working directory with the /changedir command, and check it with the cwd command
  • to save encrypted files and keys, you'll have to follow this steps:
    • 1st, save it running the /save command, this will save the key and file you have encrypted during that same sesion
    • Then, you can either load it directly -> /load, or save it to a json file -> /tojson (saved in ~encryption/storage.json)
      In order to delete the content inside the files where these files & their keys are saved, you'd need to run: /destroydict
  • You can also view the debug and error logs by typing /logs & destroy it with the /relogs command
  • You can view info about the sesion running this following command /sesion, you need to have generated a key during that same sesion
  • Another little thing you can do is deleting the variables during that same sesion, to do so, type: /delvars
  • In order to exit, you should run, /exit, or hold ctrl+C, but that's only recommended if the script froze.
  • Another pretty important command, would be: /update. This, not only checks if your pyfernet clone is outdated and updates it, but it also does a customized and simple backup of certain files (storage.json, logs.log & true.txt)

New feature : You now can use /encrypt -t and /decrypt -t in order to make a temporary key for encryption and decryption

Multifernet encryption

This new feature allows you to encrypt files using several keys instead of just one.
There's no change in commands, just start it using the /multi -s command & quit the multifernet mode with: /multi -q
But first, there are some things you need to take into account:

  • If you type the /setkey command, you'll only type the keys separated by a space else the key won'tsave correctly into the list
  • This multifernet implementation into pyfernet is pretty new and recent, so you may experience some bugs while using it, please report any problem in issues

That'd be all for now, appreciate taking your time in reading this

Made with love, by some random guy on the internet.