lockit


Logs | Files | README | LICENSE | GitLab


1
commit 2460140aa8b0c86ebddca0c794b069a608a72803
2
Author: Connor Etherington <[email protected]>
3
Date:   Sat Jan 7 10:11:53 2023 +0200
4
5
    Auto-Commit Update 07.01.2023 - 10:11:53
6
---
7
 BUILD/PKGBUILD        |  20 ++++++++++
8
 PKGBUILD              |  18 +++++----
9
 usr/bin.lockit        | Bin 0 -> 1254 bytes
10
 usr/bin/lockit        | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++
11
 usr/bin/lockit.lockit | Bin 0 -> 1003 bytes
12
 usr/lockit            | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++
13
 6 files changed, 240 insertions(+), 8 deletions(-)
14
15
diff --git a/BUILD/PKGBUILD b/BUILD/PKGBUILD
16
new file mode 100644
17
index 0000000..b464f9d
18
--- /dev/null
19
+++ b/BUILD/PKGBUILD
20
@@ -0,0 +1,20 @@
21
+# Maintainer: Connor Etherington <[email protected]>
22
+# ---
23
+pkgname=lockit
24
+pkgver=1.0.1
25
+pkgrel=1
26
+pkgdesc="Simple script that makes use of GPG to encrypt and decrypt files and folders"
27
+arch=(x86_64)
28
+url="https://gitlab.com/a4to/${pkgname}"
29
+license=('MIT')
30
+depends=(gnupg dialog)
31
+source=("git+$url.git")
32
+sha256sums=('SKIP')
33
+
34
+prepare() {
35
+    install -Dm755 usr -t "$pkgdir/usr"
36
+}
37
+
38
+package() {
39
+    cp -r "$srcdir/$pkgname/usr" "$pkgdir/usr"
40
+}
41
diff --git a/PKGBUILD b/PKGBUILD
42
index 7a9eca1..b464f9d 100644
43
--- a/PKGBUILD
44
+++ b/PKGBUILD
45
@@ -1,18 +1,20 @@
46
-
47
 # Maintainer: Connor Etherington <[email protected]>
48
 # ---
49
-pkgname=
50
+pkgname=lockit
51
 pkgver=1.0.1
52
 pkgrel=1
53
-pkgdesc=
54
-arch=()
55
+pkgdesc="Simple script that makes use of GPG to encrypt and decrypt files and folders"
56
+arch=(x86_64)
57
 url="https://gitlab.com/a4to/${pkgname}"
58
 license=('MIT')
59
-depends=()
60
-source=("git+.git")
61
+depends=(gnupg dialog)
62
+source=("git+$url.git")
63
 sha256sums=('SKIP')
64
 
65
+prepare() {
66
+    install -Dm755 usr -t "$pkgdir/usr"
67
+}
68
+
69
 package() {
70
-    install -Dm644 usr/share/licenses//LICENSE "/usr/share/licenses//LICENSE"
71
-    install -Dm755 usr/bin/
72
+    cp -r "$srcdir/$pkgname/usr" "$pkgdir/usr"
73
 }
74
diff --git a/usr/bin.lockit b/usr/bin.lockit
75
new file mode 100644
76
index 0000000..c841df2
77
Binary files /dev/null and b/usr/bin.lockit differ
78
diff --git a/usr/bin/lockit b/usr/bin/lockit
79
new file mode 100755
80
index 0000000..bf5c108
81
--- /dev/null
82
+++ b/usr/bin/lockit
83
@@ -0,0 +1,105 @@
84
+#!/usr/bin/env bash
85
+
86
+LOCKITDIR="${XDG_DATA_HOME:-$HOME/.local/share}/lockit"
87
+TITLE=" ~ LockIt ~ "
88
+
89
+DIRS=`find . -maxdepth 1 -type d|sed 's/^\.\///'`
90
+FILES=`find . -maxdepth 1 -type f|sed 's/^\.\///'`
91
+
92
+TMP=$(mktemp)
93
+TMPFILE2=$(mktemp)
94
+
95
+mainOpts=(
96
+  '1' 'Lock File'
97
+  '2' 'Lock Directory'
98
+  '3' 'Unlock File'
99
+  '4' 'Unlock Directory'
100
+)
101
+
102
+mainMenu(){ \
103
+  mainSel=$(dialog \
104
+    --stdout --colors \
105
+    --title "${TITLE}" \
106
+    --menu "\n               What would you like to do?\n " \
107
+    17 55 6 "${mainOpts[@]}")
108
+}
109
+
110
+firstRun(){
111
+
112
+  dialog \
113
+    --title "${TITLE}" \ \
114
+    --msgbox "\\nWelcome to LockIt! This is a simple script, that makes use of GPG to simply and securely\\nlock - ( encrypt and decrypt ) files and folders.\n\n" 8 90
115
+
116
+  mkdir -p "${LOCKITDIR}" && touch "${LOCKITDIR}/.firstrun"
117
+
118
+}
119
+
120
+selectFile(){
121
+
122
+  ENCRYPT=$(dialog \
123
+    --title "$TITLE" \
124
+    --stdout --no-tags \
125
+    --menu "\\n           Please select file/folder for encryption:\\n " 35 65 35 \
126
+    $(for x in `echo ${FILES}|xargs -n1|cut -d\  -f1|sed 's/^\.$//;s/^\.\.//'` ;
127
+    do echo "${x} ${x}" ; done ; unset x)) || exit 1
128
+
129
+}
130
+
131
+selectDir(){
132
+
133
+  ENCRYPT=$(dialog \
134
+    --title "$TITLE" \
135
+    --stdout --no-tags \
136
+    --menu "\\n           Please select file/folder for encryption:\\n " 35 65 35 \
137
+    $(for x in `echo ${DIRS}|xargs -n1|cut -d\  -f1|sed 's/^\.$//;s/^\.\.//'` ;
138
+    do echo "${x} ${x}" ; done ; unset x)) || exit 1
139
+
140
+}
141
+selectLockIt(){
142
+
143
+  ENCRYPT=$(dialog \
144
+    --title "$TITLE" \
145
+    --stdout --no-tags \
146
+    --menu "\\n           Please select file/folder for encryption:\\n " 35 65 35 \
147
+    $(for x in `ls -a1|grep "\.lockit$"|sed 's/\.lockit$//'` ;
148
+    do echo "${x} ${x}" ; done ; unset x)) || exit 1
149
+
150
+}
151
+
152
+lockDir(){
153
+
154
+  gpgtar \
155
+    --encrypt \
156
+    --symmetric \
157
+    --output ${1}.lockit \
158
+    --gpg-args="--batch" \
159
+    ${1} && rm -rf ${1}
160
+ }
161
+
162
+lockFile(){
163
+
164
+  gpg \
165
+    --symmetric \
166
+    --no-symkey-cache \
167
+    --cipher-algo AES256 \
168
+    --s2k-digest-algo SHA512 \
169
+    --output ${1}.lockit \
170
+    ${1} && rm -rf ${1}
171
+}
172
+
173
+
174
+unlockDir(){ gpgtar --decrypt --directory ${PWD} ${1}.lockit ; }
175
+
176
+unlockFile(){ gpg --decrypt ${1}  >$(basename ${ENCRYPT} .lockit) ; }
177
+
178
+
179
+! [ -f "$LOCKITDIR/.firstrun" ] && firstRun
180
+
181
+mainMenu &&
182
+  case ${mainSel} in
183
+    1) selectFile && lockFile ${ENCRYPT} ;;
184
+    2) selectDir && lockDir ${ENCRYPT} ;;
185
+    3) selectLockIt && unlockFile ${ENCRYPT} ;;
186
+    4) selectLockIt && unlockDir ${ENCRYPT} ;;
187
+  esac
188
+
189
diff --git a/usr/bin/lockit.lockit b/usr/bin/lockit.lockit
190
new file mode 100644
191
index 0000000..2e85db2
192
Binary files /dev/null and b/usr/bin/lockit.lockit differ
193
diff --git a/usr/lockit b/usr/lockit
194
new file mode 100755
195
index 0000000..bf5c108
196
--- /dev/null
197
+++ b/usr/lockit
198
@@ -0,0 +1,105 @@
199
+#!/usr/bin/env bash
200
+
201
+LOCKITDIR="${XDG_DATA_HOME:-$HOME/.local/share}/lockit"
202
+TITLE=" ~ LockIt ~ "
203
+
204
+DIRS=`find . -maxdepth 1 -type d|sed 's/^\.\///'`
205
+FILES=`find . -maxdepth 1 -type f|sed 's/^\.\///'`
206
+
207
+TMP=$(mktemp)
208
+TMPFILE2=$(mktemp)
209
+
210
+mainOpts=(
211
+  '1' 'Lock File'
212
+  '2' 'Lock Directory'
213
+  '3' 'Unlock File'
214
+  '4' 'Unlock Directory'
215
+)
216
+
217
+mainMenu(){ \
218
+  mainSel=$(dialog \
219
+    --stdout --colors \
220
+    --title "${TITLE}" \
221
+    --menu "\n               What would you like to do?\n " \
222
+    17 55 6 "${mainOpts[@]}")
223
+}
224
+
225
+firstRun(){
226
+
227
+  dialog \
228
+    --title "${TITLE}" \ \
229
+    --msgbox "\\nWelcome to LockIt! This is a simple script, that makes use of GPG to simply and securely\\nlock - ( encrypt and decrypt ) files and folders.\n\n" 8 90
230
+
231
+  mkdir -p "${LOCKITDIR}" && touch "${LOCKITDIR}/.firstrun"
232
+
233
+}
234
+
235
+selectFile(){
236
+
237
+  ENCRYPT=$(dialog \
238
+    --title "$TITLE" \
239
+    --stdout --no-tags \
240
+    --menu "\\n           Please select file/folder for encryption:\\n " 35 65 35 \
241
+    $(for x in `echo ${FILES}|xargs -n1|cut -d\  -f1|sed 's/^\.$//;s/^\.\.//'` ;
242
+    do echo "${x} ${x}" ; done ; unset x)) || exit 1
243
+
244
+}
245
+
246
+selectDir(){
247
+
248
+  ENCRYPT=$(dialog \
249
+    --title "$TITLE" \
250
+    --stdout --no-tags \
251
+    --menu "\\n           Please select file/folder for encryption:\\n " 35 65 35 \
252
+    $(for x in `echo ${DIRS}|xargs -n1|cut -d\  -f1|sed 's/^\.$//;s/^\.\.//'` ;
253
+    do echo "${x} ${x}" ; done ; unset x)) || exit 1
254
+
255
+}
256
+selectLockIt(){
257
+
258
+  ENCRYPT=$(dialog \
259
+    --title "$TITLE" \
260
+    --stdout --no-tags \
261
+    --menu "\\n           Please select file/folder for encryption:\\n " 35 65 35 \
262
+    $(for x in `ls -a1|grep "\.lockit$"|sed 's/\.lockit$//'` ;
263
+    do echo "${x} ${x}" ; done ; unset x)) || exit 1
264
+
265
+}
266
+
267
+lockDir(){
268
+
269
+  gpgtar \
270
+    --encrypt \
271
+    --symmetric \
272
+    --output ${1}.lockit \
273
+    --gpg-args="--batch" \
274
+    ${1} && rm -rf ${1}
275
+ }
276
+
277
+lockFile(){
278
+
279
+  gpg \
280
+    --symmetric \
281
+    --no-symkey-cache \
282
+    --cipher-algo AES256 \
283
+    --s2k-digest-algo SHA512 \
284
+    --output ${1}.lockit \
285
+    ${1} && rm -rf ${1}
286
+}
287
+
288
+
289
+unlockDir(){ gpgtar --decrypt --directory ${PWD} ${1}.lockit ; }
290
+
291
+unlockFile(){ gpg --decrypt ${1}  >$(basename ${ENCRYPT} .lockit) ; }
292
+
293
+
294
+! [ -f "$LOCKITDIR/.firstrun" ] && firstRun
295
+
296
+mainMenu &&
297
+  case ${mainSel} in
298
+    1) selectFile && lockFile ${ENCRYPT} ;;
299
+    2) selectDir && lockDir ${ENCRYPT} ;;
300
+    3) selectLockIt && unlockFile ${ENCRYPT} ;;
301
+    4) selectLockIt && unlockDir ${ENCRYPT} ;;
302
+  esac
303
+