Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Wed 27 Aug 2014, 07:13
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Security/Privacy
800 byte "daemon tools"-like wrapper for luks dm-crypt
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 1 Posts_count_1  
Author Message
aaa3

Joined: 02 Oct 2013
Posts: 10

PostPosted: Thu 29 May 2014, 08:11    Post_subject:  800 byte "daemon tools"-like wrapper for luks dm-crypt
Sub_title: luks quick mounter - download crypto virtual disk file iso opener linux - keyword spamming :)
 

command line script, extremely noob-friendly code text, compared to 4ex. the hyper-complex /usr/sbin/filemnt
takes file with full path as argument, automatically chooses all things and does all 3 commands in forward and reverse order, same action for both directions,
much faster than manually typing everything for every file. this is my first script so may contain bugs; atm very feature-poor but already includes checks for no-loopdev-escalation (as visible just an afterthought - such luxuries can be removed if bothering ur need for clean code... main logic at left, trash is at side; left can (and should at first) be read alone and right only tooken care at second pass read)

cryptmontools.sh - goddam codequoter-font is not monospaced...
Code:
#!/bin/sh
 

dir=$( echo $1 | tr / _ | tr [:space:] . )                      #translate chars in arg

if test "$( cat /proc/mounts | grep $dir )" = ""                ;then mkdir "/mnt/$dir" ; if test "$( losetup | grep "$1" )" = "" ;then    #| chains commands, grep searches for lines
     whichlo=$( losetup -f ) ; loop=$whichlo                    ;else loop=$( losetup | grep "$1" | head -n 1 | cut --delimiter=: --fields=1 ) ;fi    #first free, or used aft faild mnt - take just 1 line; take part of a grep line
     losetup $loop "$1"                                         ;pkill udev
     cryptsetup luksOpen $loop $dir
     mount "/dev/mapper/$dir" "/mnt/$dir"                       ;echo mounted to "/mnt/$dir"
else umount "/mnt/$dir"
     cryptsetup luksClose $dir
     rmdir "/mnt/$dir"                                          ;loop=$( losetup | grep "$1" | tail -n 1 | cut --delimiter=: --fields=1 )
     losetup -d $loop                                           ;echo unmounted ;fi



# (pubdm) by aaa3 @2014-05-30

(copypaste) loot it now! Very Happy












--------

1 day later edit: new version, nothing changes.
read these pasted into a monospace notepad, not here; also with line wrapping temporarily off
Code:
#!/bin/sh


dir=$( echo $1 | tr / _ | tr [:space:] . )                      #translate chars in arg

if test "$( cat /proc/mounts | grep $dir )" = ""                ;then mkdir "/mnt/$dir" ; if test "$( losetup | grep "$1" )" = "" ;then    #| chains commands, grep searches for lines
     whichlo=$( losetup -f ) ; loop=$whichlo                    ;else loop=$( losetup | grep "$1" | head -n 1 | cut --delimiter=: --fields=1 ) ;fi; losetup $loop "$1" ; name=$dir ; pkill udev    #first free, or used aft faild mnt; #take just 1 line; take part of a grep line; #name added just for understanding, it was perfectly fine as dir; just like "loop"&"w" is 2 name for one thing; also, imagine ls syntax as "losetup $1 loop" to align w rest
     #losetup "$1" $loop
     cryptsetup luksOpen $loop $name
     mount "/dev/mapper/$name" "/mnt/$dir"                      ;echo mounted to "/mnt/$dir"
else umount "/mnt/$dir"
     cryptsetup luksClose $name
     rmdir "/mnt/$dir"                                          ;loop=$( losetup | grep "$1" | tail -n 1 | cut --delimiter=: --fields=1 )
     losetup -d $loop                                           ;echo unmounted ;fi



# (pubdm) by me @2014-05-30,31
Back to top
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 1 of 1 Posts_count_1  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Security/Privacy
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0467s ][ Queries: 11 (0.0034s) ][ GZIP on ]