GithubHelp home page GithubHelp logo

sector009 / lock_files Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jlinoff/lock_files

0.0 2.0 0.0 144 KB

Python command line tool to encrypt or decrypt files using AES encryption and a common password.

License: MIT License

Python 100.00%

lock_files's Introduction

lock_files

Python command line tool to encrypt or decrypt files using AES encryption and a common password.

You can use it lock files before they are uploaded to storage services like DropBox or Google Drive.

The password can be stored in a safe file, specified on the command line or it can be manually entered each time the tool is run.

Here is how you would use this tool to encrypt a number of files using a local, secure file.

$ cat >password-file
thisismysecretpassword
EOF
$ chmod 0600 password-file
$ lock_files -P ./password-file -r -v -e file1.txt file2.txt dir1 dir2

Here is how you would use this tool to decrypt a number of files.

$ lock_files -P ./password-file -r -v -d file1.txt file2.txt dir1 dir2

Here is how you would use this tool to decrypt a file, execute a program and then re-encrypt it when the program exits.

$ lock_files -P ./password --decrypt file1.txt
$ emacs file1.txt
$ lock_files -P ./password --encrypt file1.txt

The tool checks each file to make sure that it is writeable before processing. If any files are not writeable, it means that they cannot be changed so the program aborts.

Notice that the program writes the encrypted data to the same file name by default. You can override this using the -u or --unique option as follows:

$ lock_files -P ./password-file -r -v -e -u file1.txt
$ ls file1.txt*
file1.txt   file1.txt.enc

The -u option appends the .enc extension for files that are encrypted or the .dec extension for files that are decrypted. It is useful for guaranteeing that you do not overwrite the original files.

Finally, if you specify -v -v (very verbose), you will see the operations on each file.

Here is the on-line help:

usage: lock_files.py [-h] [-d | -e] [-p PASSWORD_FILE | -P PASSWORD] [-r] [-u]
                     [-v] [-V]
                     [FILES [FILES ...]]

description:
  Encrypt and decrypt files using AES encryption and a common
  password. You can use it lock files before they are uploaded to
  storage services like DropBox or Google Drive.

  The password can be stored in a safe file, specified on the command
  line or it can be manually entered each time the tool is run.
  
  Here is how you would use this tool to encrypt a number of files
  using a local, secure file.
  
     $ cat >password-file
     thisismysecretpassword
     EOF
     $ chmod 0600 password-file
     $ lock_files -P ./password-file -r -v -e file1.txt file2.txt dir1 dir2
  
  Here is how you would use this tool to decrypt a number of files.

     $ lock_files -P ./password-file -r -v -d file1.txt file2.txt dir1 dir2

  Here is how you would use this tool to decrypt a file, execute a
  program and then re-encrypt it when the program exits.

     $ lock_files -P ./password --decrypt file1.txt
     $ emacs file1.txt
     $ lock_files -P ./password --encrypt file1.txt
  
  The tool checks each file to make sure that it is writeable before
  processing. If any files are not writeable, it means that they cannot
  be changed so the program aborts.

  Notice that the program writes the encrypted data to the same file
  name by default. You can override this using the -u or --unique option
  as follows:

     $ lock_files -P ./password-file -r -v -e -u file1.txt
     $ ls file1.txt*
     file1.txt   file1.txt.enc

  The -u option appends the .enc extension for files that are encrypted
  or the .dec extension for files that are decrypted. It is useful for
  guaranteeing that you do not overwrite the original files.

  Finally, if you specify -v -v (very verbose), you will see the
  operations on each file.

positional arguments:
  FILES                 files to process

optional arguments:
  -h, --help            show this help message and exit
  -d, --decrypt         decrypt
  -e, --encrypt         encrypt
  -p PASSWORD_FILE, --password-file PASSWORD_FILE
                        file that contains the password, default is to prompt
  -P PASSWORD, --password PASSWORD
                        password on the command line, not secure
  -r, --recurse         recurse when directories are encountered
  -u, --unique          use a unique file name for the output files
  -v, --verbose         level of verbosity
  -V, --version         show program's version number and exit

lock_files's People

Contributors

jlinoff avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.