[shell] decrypt to clipboard

Questions about programming languages and debugging
Post Reply
User avatar
lilrofl
Siliconoclast
Siliconoclast
Posts: 1363
Joined: 28 Jan 2009, 17:00
15
Location: California, USA
Contact:

[shell] decrypt to clipboard

Post by lilrofl »

command line script to decrypt files encrypted with ccrypt and store the data in your clipboard for 10 seconds before clearing the clipboard by writing /dev/null into it. Might not clear successive histories if you use a clipboard manager... which I don't :)

You need xsel and ccrypt to run.

Code: Select all

#!/bin/bash

if [ $# -ne 1 ]; then
     echo "Usage: `basename $0` {myfile.cpt}"
     exit 1
else
     ccat $1 | xsel --clipboard
     if [ ${PIPESTATUS[0]} -ne "0" ]; then
          exit 1
     else
          echo "Data available for 10 seconds"
          sleep 10s
          cat /dev/null | xsel --clipboard
          echo "Clipboard cleared"
          exit 0
     fi
fi
knuffeltjes voor mijn knuffel
[img]http://i911.photobucket.com/albums/ac320/stuphsack/Sig.jpg[/img]

User avatar
ayu
Staff
Staff
Posts: 8109
Joined: 27 Aug 2005, 16:00
18
Contact:

Re: [shell] decrypt to clipboard

Post by ayu »

ah cool :D
"The best place to hide a tree, is in a forest"

User avatar
lilrofl
Siliconoclast
Siliconoclast
Posts: 1363
Joined: 28 Jan 2009, 17:00
15
Location: California, USA
Contact:

Re: [shell] decrypt to clipboard

Post by lilrofl »

lol, yeah certainly not going to win any awards for it, but I needed the functionality on my netbook last night :D
knuffeltjes voor mijn knuffel
[img]http://i911.photobucket.com/albums/ac320/stuphsack/Sig.jpg[/img]

User avatar
bad_brain
Site Owner
Site Owner
Posts: 11636
Joined: 06 Apr 2005, 16:00
19
Location: In your eye floaters.
Contact:

Re: [shell] decrypt to clipboard

Post by bad_brain »

yep, cool script....I like the functionality itself, but may I ask what you actually used it for? because honestly speaking I have not the slightest clue....which might also be because I am done from biking and can only hardly keep my eyes open, but I wouldn't count on that. :lol:
Image

User avatar
ph0bYx
Staff Member
Staff Member
Posts: 2039
Joined: 22 Sep 2008, 16:00
15
Contact:

Re: [shell] decrypt to clipboard

Post by ph0bYx »

I've used ccrypt before I managed to install and use TrueCrypt. It's a nice application to encrypt a file or two, no idea how it's for encrypting multiple files.

As for the functionality - every time you use ccrypt to encrypt or decrypt it asks for the password, and if I'm not mistaken, this script allows you to enter the password once and have it stored for the next 10 minutes so you don't have to enter it repeatedly, something like the sudo command.


EDIT: Ok, it's 10 seconds so beats me :D

User avatar
bad_brain
Site Owner
Site Owner
Posts: 11636
Joined: 06 Apr 2005, 16:00
19
Location: In your eye floaters.
Contact:

Re: [shell] decrypt to clipboard

Post by bad_brain »

ahhhh....makes sense. thanks for the explanation. :)
Image

User avatar
lilrofl
Siliconoclast
Siliconoclast
Posts: 1363
Joined: 28 Jan 2009, 17:00
15
Location: California, USA
Contact:

Re: [shell] decrypt to clipboard

Post by lilrofl »

I was trying out a bunch of linux distros and got tired of typing out my passwords to connect to WiFi. Instead of installing a password manager, and fetching my database every time, I cut and paste the passwords into text files and threw em on a thumb drive.

So then I got the thinking that it was a pretty simple and fast way to store a bunch of randomly generated password keys, but it would be nice if I could just put them into the clipboard.... followed by, 'hey this works pretty well... but it's not very secure'

It met my needs for the night, and to be honest it's actually ended up being a faster way to access passwords then the password manager I've been using, since I use a drop down terminal emulator it totally removes all the mousing around.

Lastly I didn't really want my passwords in my clipboard after I used them cause I have a tendency to cot and past without looking.
knuffeltjes voor mijn knuffel
[img]http://i911.photobucket.com/albums/ac320/stuphsack/Sig.jpg[/img]

User avatar
bad_brain
Site Owner
Site Owner
Posts: 11636
Joined: 06 Apr 2005, 16:00
19
Location: In your eye floaters.
Contact:

Re: [shell] decrypt to clipboard

Post by bad_brain »

alright, also thanks to you for explaining it. :D
I simply could not really imagine what it's been used for because my password habits/strategy is different: good old text files in one folder. :lol:
might sound very insecure, but the most important password, which is the one for booting from the encrypted FS, only exists in my head...and without that one access to the other passes is not possible anyway. really sensitive passes are also only stored on an USB stick.
Image

User avatar
maboroshi
Dr. Mab
Dr. Mab
Posts: 1624
Joined: 28 Aug 2005, 16:00
18

Re: [shell] decrypt to clipboard

Post by maboroshi »

My password and the password to the shield around planet earth (You know to prevent death stars and such)

Code: Select all

1 2 3 4 5

User avatar
lilrofl
Siliconoclast
Siliconoclast
Posts: 1363
Joined: 28 Jan 2009, 17:00
15
Location: California, USA
Contact:

Re: [shell] decrypt to clipboard

Post by lilrofl »

Just cause I was especially board today, how about a random password generator to go with that decryption to clipboard :D

Code: Select all

http://pastebin.suck-o.com/42485
knuffeltjes voor mijn knuffel
[img]http://i911.photobucket.com/albums/ac320/stuphsack/Sig.jpg[/img]

User avatar
ph0bYx
Staff Member
Staff Member
Posts: 2039
Joined: 22 Sep 2008, 16:00
15
Contact:

Re: [shell] decrypt to clipboard

Post by ph0bYx »

Ah damn, I wanted to make a password generator :(

Post Reply