GithubHelp home page GithubHelp logo

deepjyoti30 / locker Goto Github PK

View Code? Open in Web Editor NEW
21.0 4.0 1.0 1.2 MB

Just another naive locker program for Linux written in shell

License: MIT License

Shell 95.88% Makefile 4.12%
shell locker chmod linux filesystem

locker's Introduction

Locker

   __            _             
  / /  ___   ___| | _____ _ __ 
 / /  / _ \ / __| |/ / _ \ '__|
/ /__| (_) | (__|   <  __/ |   
\____/\___/ \___|_|\_\___|_|   

Just another naive locker for *nix

Made with Bash License

Why this

I was just reading a book and then I found out that we can change the permissions of a directory to none for all the users and that basically doesn't let any program except rm access the directory.

Hence, I created a small, naive script that just adds the ability to change those permissions with a password, which means that the dir can be locked using the password.

Dependencies

Are you kidding me? It's written in Shell, no dependencies, enjoy.

Installation

  • Clone the repo and enter the dir

    git clone https://github.com/deepjyoti30/locker && cd locker

  • Install using make

    make install

Usage

Usage: locker OPERATION DIR [--help]

Positional arguments:

  OPERATION: Either of [lock] or [unlock] can be passed.
  DIR: Directory to operate on.

Optional arguments:

  --help: Show this message and exit

Credits

Probably the book UNIX: concepts and applications by Sumitabha Das.

locker's People

Contributors

beyondmagic avatar deepjyoti30 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

willdoescode

locker's Issues

Existential crisis

The locked directory can be unlocked without password with just "chmod". So what's the purpose of this program or is it just a joke?

[Optimize] replace tr

FIRST

echo "$(tr ' ' '#' <<< "$dir_hash")"

can be replaced with

echo ${dir_hash// /#}

SECOND

echo "$(echo "$1" | tr '[:lower:]' '[:upper:]')"

can be replaced with

echo ${1^^}

THIRD

echo "$(echo "$1" | tr '[:upper:]' '[:lower:]')"

can be replaced with

echo ${1,,}

Could do this too

printf "[*] Passed OPERATION is: %s\n" "$(get_upper $OP)"

could just be changed to

printf "[*] Passed OPERATION is: %s\n" "${OP^^}"

And

OP=$(get_lower $1)

could be

OP=${1,,}

With these last 2 you can ditch the get_upper and get_lower functions

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.