Skip to content

Commit d12c250

Browse files
authored
Merge pull request #39 from pythonhacker/development
Development
2 parents 78c17d5 + f81a7ee commit d12c250

File tree

2 files changed

+94
-65
lines changed

2 files changed

+94
-65
lines changed

README.md

Lines changed: 93 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -69,43 +69,44 @@ The binary will be installed in `/usr/local/bin` folder.
6969
Usage
7070
=====
7171

72-
$ varuh -h
73-
usage: varuh [-h|--help] [-I|--init "<value>"] [-d|--decrypt "<value>"]
74-
[-C|--clone "<value>"] [-R|--remove "<value>"] [-U|--use-db
75-
"<value>"] [-E|--edit "<value>"] [-l|--list-entry "<value>"]
76-
[-x|--export "<value>"] [-f|--find "<value>" [-f|--find "<value>"
77-
...]] [-e|--encrypt] [-A|--add] [-p|--path] [-a|--list-all]
78-
[-g|--genpass] [-s|--show] [-c|--copy] [-y|--assume-yes]
79-
[-v|--version]
80-
81-
Password manager for the command line for Unix like operating
82-
systems
83-
84-
Options:
85-
86-
-h --help Print help information
87-
-I --init <path> Initialize a new database
88-
-d --decrypt <path> Decrypt password database
89-
-C --clone <id> Clone an entry with <id>
90-
-R --remove <id> Remove an entry with <id> or <id-range>
91-
-U --use-db <path> Set <path> as active database
92-
-E --edit <id> Edit entry by <id>
93-
-l --list-entry <id> List entry by <id>
94-
-x --export <filename> Export all entries to <filename>
95-
-f --find <t1> <t2> ... Search entries with terms
96-
-e --encrypt Encrypt the current database
97-
-A --add Add a new entry
98-
-p --path Show current database path
99-
-a --list-all List all entries in current database
100-
-g --genpass Generate a strong password (length: 12 - 16)
101-
-s --show Show passwords when listing entries
102-
-c --copy Copy password to clipboard
103-
-y --assume-yes Assume yes to actions requiring confirmation
104-
-v --version Show version information and exit
105-
106-
107-
AUTHORS
108-
Copyright (C) 2021 Anand B Pillai <abpillai@gmail.com>
72+
$ varuh -h
73+
usage: varuh [-h|--help] [-I|--init "<value>"] [-d|--decrypt "<value>"]
74+
[-C|--clone "<value>"] [-R|--remove "<value>"] [-U|--use-db
75+
"<value>"] [-E|--edit "<value>"] [-l|--list-entry "<value>"]
76+
[-x|--export "<value>"] [-m|--migrate "<value>"] [-f|--find
77+
"<value>" [-f|--find "<value>" ...]] [-e|--encrypt] [-A|--add]
78+
[-p|--path] [-a|--list-all] [-g|--genpass] [-s|--show] [-c|--copy]
79+
[-y|--assume-yes] [-v|--version]
80+
81+
Password manager for the command line for Unix like operating
82+
systems
83+
84+
Options:
85+
86+
-h --help Print help information
87+
-I --init <path> Initialize a new database
88+
-d --decrypt <path> Decrypt password database
89+
-C --clone <id> Clone an entry with <id>
90+
-R --remove <id> Remove an entry with <id> or <id-range>
91+
-U --use-db <path> Set <path> as active database
92+
-E --edit <id> Edit entry by <id>
93+
-l --list-entry <id> List entry by <id>
94+
-x --export <filename> Export all entries to <filename>
95+
-m --migrate <path> Migrate a database to latest schema
96+
-f --find <t1> <t2> ... Search entries with terms
97+
-e --encrypt Encrypt the current database
98+
-A --add Add a new entry
99+
-p --path Show current database path
100+
-a --list-all List all entries in current database
101+
-g --genpass Generate a strong password (length: 12 - 16)
102+
-s --show Show passwords when listing entries
103+
-c --copy Copy password to clipboard
104+
-y --assume-yes Assume yes to actions requiring confirmation
105+
-v --version Show version information and exit
106+
107+
108+
AUTHORS
109+
Copyright (C) 2022 Anand B Pillai <abpillai@gmail.com>
109110

110111

111112
Encryption and Security
@@ -149,22 +150,24 @@ The password database is created and is active now. You can start adding entries
149150
Username: mememe
150151
Password (enter to generate new):
151152
Generating password ...done
153+
Tags (separated by space): testing test website
152154
Notes: Website uses Nginx auth
153155
Do you want to add custom fields [y/N]:
154156
Created new entry with id: 1
155157

156158
You can now list the entry with one of the list options.
157159

158160
$ varuh -l 1
159-
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
161+
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
160162
ID: 1
161163
Title: My Website Login
162164
User: mememe
163165
URL: http://mywebsite.name
164166
Password: ****************
167+
Tags: testing test website
165168
Notes: Website uses Nginx auth
166169
Modified: 2021-21-09 23:12:35
167-
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
170+
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
168171

169172
## Add an entry with custom fields
170173

@@ -175,6 +178,7 @@ From version 0.3 onwards, custom fields are supported.
175178
URL: https://github.com/mydev/myproject
176179
Username: mydev
177180
Password (enter to generate new): ghp_ipQrStuVwxYz1a2b3cdEF10ghI689kLaMnOp
181+
Tags (separated by space): token github
178182
Notes: Never Expires
179183
Do you want to add custom fields [y/N]: y
180184
Field Name: Domain
@@ -190,12 +194,12 @@ From version 0.3 onwards, custom fields are supported.
190194
User: mydev
191195
URL: https://github.com/mydev/myproject
192196
Password: ghp_ipQrStuVwxYz1a2b3cdEF10ghI689kLaMnOp
197+
Tags: token github
193198
Notes: Never Expires
194199
Domain: github.com
195200
Type: Auth Token
196201
Modified: 2021-21-13 00:07:18
197202

198-
199203
For more on listing see the [Listing and Searching](#listing-and-searching) section below.
200204

201205
## Edit an entry
@@ -208,22 +212,25 @@ For more on listing see the [Listing and Searching](#listing-and-searching) sect
208212
Current Username: mememe
209213
New Username: meblog
210214
Current Password: lTzC2z9kRppnYsYl
211-
New Password ([y/Y] to generate new, enter will keep old one):
215+
New Password ([y/Y] to generate new, enter will keep old one):
216+
Current Tags: testing test website
217+
New Tags:
212218
Current Notes: Website uses Nginx auth
213219
New Notes: Website uses Apache
214220
Do you want to add custom fields [y/N]:
215221
Updated entry.
216222

217223
$ varuh -l 1 -s
218-
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
224+
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
219225
ID: 1
220226
Title: My Blog Login
221227
User: meblog
222228
URL: http://myblog.name
223229
Password: myblog123
230+
Tags: testing test website
224231
Notes: Website uses Apache
225232
Modified: 2021-21-09 23:15:29
226-
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
233+
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
227234

228235
## Edit an entry with custom fields
229236

@@ -242,7 +249,8 @@ When you edit an entry with custom fields, you get the option to change the name
242249
New Notes:
243250
Editing/deleting custom fields
244251
Field Name: Domain
245-
New Field Name (Enter to keep, "x" to delete): x
252+
New Field Name (Enter to keep, "x" to delete): x
253+
Deleting field: Domain
246254
Field Name: Type
247255
New Field Name (Enter to keep, "x" to delete): Token Type
248256
Field Value: Auth Token
@@ -257,6 +265,7 @@ When you edit an entry with custom fields, you get the option to change the name
257265
User: mydev
258266
URL: https://github.com/mydev/myproject
259267
Password: ghp_ipQrStuVwxYz1a2b3cdEF10ghI689kLaMnOp
268+
Tags: token github
260269
Notes: Never Expires
261270
Token Type: Auth Token
262271
Modified: 2021-21-13 00:16:41
@@ -273,12 +282,12 @@ To clone (copy) an entry,
273282
## Remove an entry
274283

275284
$ varuh -R 1
276-
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
285+
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
277286
Title: My Website Login
278287
User: mememe
279288
URL: https://mywebsite.name
280289
Modified: 2021-21-09 23:12:35
281-
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
290+
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
282291
Please confirm removal [Y/n]:
283292
Entry with id 1 was removed from the database
284293

@@ -336,7 +345,25 @@ If you want to switch back to a previous database, you can use the `-U` option.
336345
Password:
337346
Decryption complete.
338347
Switched active database successfully.
339-
348+
349+
## Database Migration
350+
351+
(New in version 0.4)
352+
353+
When new features are added - sometimes new fields would be required to be added in the database schema. To make sure your old databases work with the new features in such cases, the `--migrate` option can be used to migrate your existing databases.
354+
355+
$ ./varuh -m /home/anand/mypasswds
356+
Password:
357+
Decryption complete.
358+
Migrating tables ...
359+
360+
Encryption complete.
361+
Migration successful.
362+
363+
For migration you need to provide the database path - even for the active database. Once migrated, you can continue to use your database as before.
364+
365+
NOTE: It is suggested to make a backup copy of your current active database before migration.
366+
340367
## Manual encryption and decryption
341368

342369
You can manually encrypt the current database using the `-e` option.
@@ -360,15 +387,16 @@ Manually decrypt the database using `-d` option.
360387
Now the database is active again and you can see the listings.
361388

362389
$ varuh -l 3
363-
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
390+
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
364391
ID: 2
365392
Title: My Blog Login
366393
User: myblog.name
367394
URL: http://meblog
368395
Password: *********
396+
Tags: test testing website
369397
Notes: Website uses Apache
370398
Modified: 2021-21-09 23:21:32
371-
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
399+
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
372400

373401
## Always on encryption
374402

@@ -379,15 +407,16 @@ If the config param `encrypt_on` is set to `true` along with `auto_encrypt` (def
379407
$ varuh -f my -s
380408
Password:
381409
Decryption complete.
382-
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
410+
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
383411
ID: 2
384412
Title: MY LOCAL BANK
385413
User: banklogin
386414
URL: https://my.localbank.com
387415
Password: bankpass123
416+
Tags: bank banking finance
388417
Notes:
389418
Modified: 2021-21-18 12:44:10
390-
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
419+
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
391420

392421
Encryption complete.
393422

@@ -401,62 +430,62 @@ Listing and Searching
401430
To list an entry using its id,
402431

403432
$ varuh -l 8
404-
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
433+
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
405434
ID: 8
406435
Title: Google account
407436
User: anandpillai@alumni.iitm.ac.in
408437
URL:
409438
Password: ***********
410439
Notes:
411440
Modified: 2021-21-25 15:02:50
412-
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
441+
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
413442

414443
## To search an entry
415444

416445
An entry can be searched on its title, username, URL or notes. Search is case-insensitive.
417446

418447
$ varuh -f google
419-
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
448+
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
420449
ID: 8
421450
Title: Google account
422451
User: anandpillai@alumni.iitm.ac.in
423452
URL:
424453
Password: **********
425454
Notes:
426455
Modified: 2021-21-25 15:02:50
427-
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
456+
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
428457
ID: 9
429458
Title: Google account
430459
User: xyz@gmail.com
431460
URL:
432461
Password: ********
433462
Notes:
434463
Modified: 2021-21-25 15:05:36
435-
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
464+
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
436465
ID: 10
437466
Title: Google account
438467
User: somethingaboutme@gmail.com
439468
URL:
440469
Password: ***********
441470
Notes:
442471
Modified: 2021-21-25 15:09:51
443-
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
472+
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
444473

445474

446475
## To search using multiple terms
447476

448477
The `-f` option supports multiple terms, so you can specify this more than one time to narrow a search down to a specific entry.
449478

450479
$ varuh -f google -f anand
451-
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
480+
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
452481
ID: 8
453482
Title: Google account
454483
User: anandpillai@alumni.iitm.ac.in
455484
URL:
456485
Password: **********
457486
Notes:
458487
Modified: 2021-21-25 15:02:50
459-
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
488+
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
460489

461490
$ varuh -f google -f priya
462491
Entry for "google priya" not found
@@ -466,31 +495,31 @@ The `-f` option supports multiple terms, so you can specify this more than one t
466495
To list all entries, use the option `-a`.
467496

468497
$ varuh -a
469-
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
498+
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
470499
ID: 1
471500
Title: My Bank #1
472501
User: myusername1
473502
URL: https://mysuperbank1.com
474503
Password: ***********
475504
Notes:
476505
Modified: 2021-21-15 15:40:29
477-
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
506+
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
478507
ID: 2
479508
Title: My Digital Locker #1
480509
User: mylockerusername
481510
URL: https://mysuperlocker1.com
482511
Password: **********
483512
Notes:
484513
Modified: 2021-21-18 12:44:10
485-
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
514+
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
486515
ID: 3
487516
Title: My Bank Login #2
488517
User: mybankname2
489518
URL: https://myaveragebank.com
490519
Password: **********
491520
Notes:
492521
Modified: 2021-21-19 14:16:33
493-
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
522+
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
494523
...
495524

496525
By default the listing is in ascending ID order. This can be changed in the configuration (see below).
@@ -588,7 +617,7 @@ The config file is named *config.json*. It looks as follows.
588617
"encrypt_on": true,
589618
"path": "/home/anand/.config/varuh/config.json",
590619
"list_order": "id,asc",
591-
"delimiter": "+",
620+
"delimiter": ">",
592621
"color": "default",
593622
"bgcolor": "bgblack"
594623
}

utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ func getOrCreateLocalConfig(app string) (error, *Settings) {
123123

124124
} else {
125125
// fmt.Printf("Creating default configuration ...")
126-
settings = Settings{"", "aes", true, true, false, configFile, "id,asc", "+", "default", "bgblack"}
126+
settings = Settings{"", "aes", true, true, false, configFile, "id,asc", ">", "default", "bgblack"}
127127

128128
if err = writeSettings(&settings, configFile); err == nil {
129129
// fmt.Println(" ...done")

0 commit comments

Comments
 (0)