Pages

Friday 23 May 2014

Password protect files on fly using crypt-editor


I always wanted an editor which can help me edit text securely with password protection using which I can easily create, save, edit files on fly. I am sure that there are some editors which can do it. However I felt that instead of an editor, it is better to have an interface which will allow me to edit files using my favorite editor while password protecting it. So I wrote a script called crypt-editor which uses gpg/mcrypt to encrypt and decrypt files enabling users to edit files using any editor.


Fork me on Github

Usage

Say you want to create/open a file using gedit:
crypt-editor gedit [filename]
You will be asked to enter the passphrase. Then gpg/mcrypt decrypts the file (if already exists) and opens it with gedit. On closing the file gpg/mcrypt encrypts it back and deletes the decrypted file.
If you do not specify the editor, the file is opened in vi editor (my favorite so it is default :P)
crypt-editor [filename]
Complete option list of crypt-editor:
crypt-editor -help
crypt-editor [filename]
crypt-editor [editor] [filename]
crypt-editor [-k key] [filename]
crypt-editor [-k key] [editor] [filename]

To create new file with mcrypt instead of gpg use -m option
crypt-editor -m [filename]

Examples:
crypt-editor passwords
crypt-editor gedit passwords
crypt-editor -k pa$$word passwords
crypt-editor -k pa$$word gvim passwords


Installation

Setting up crypt-editor is simple and straight forward.
git clone https://github.com/alseambusher/crypt-editor
cp crypt-editor/crypt-editor /usr/bin
If you want to use mcrypt instead of gpg, you have to install mcrypt.
apt-get install mcrypt

Say Thanks to birthday wishes on Facebook automatically

One of the main reasons why people turn into computer geeks is because they are lazy :P Yesterday was my birthday. Again, thanks for all the wishes :) However I was lazy to manually thank each and every post on my Facebook wall. So I wrote a simple python script using Facebook graph API to say thanks to each of them. I didn't stop there. I am aware that many people think that thanking people manually is something that has always been very tiring. So I searched for all the simpler alternatives available to do this task and found that there was a Facebook app called "Say Thank You". It is simple and neat. However, it requires people to give access to post, like, get friend list..etc. Well, that is a mini privacy invasion :P. So it is a not a good alternative. Also in future Facebook might think that it is doing something against their policies..blah blah blah and bring it down. So not a permanent solution either.
Hence I decided to rewrite the script I had written in python to javascript to make it accessible online. Well, here it is:

http://alseambusher.github.io/say-thanks/

For this you will need to get the access token. Getting access token is simple:

  • Go to developers.facebook.com.
  • Under Tools in the menu, go to Graph explorer.
  • Click on Get Access Token if access token isn't there already.

Note that as this runs completely on the client side, users can safely use it without giving access to anybody (Although it requires you to give access token, it is not stored anywhere. See source ). And access tokens expire after sometime.