Do not remove lock file on decryption.

Add warning to unlock file if unlocked file is missing.
More explanation on encryption.

Signed-off-by: Arun Prakash Jana <engineerarun@gmail.com>
This commit is contained in:
Arun Prakash Jana 2015-12-20 00:19:44 +05:30
parent afe3ab8a36
commit 90123b9d59
3 changed files with 10 additions and 6 deletions

View File

@ -75,7 +75,7 @@ OR, on Ubuntu,
- `-s` : match any of the keywords in URL or title. Order is irrelevant.
- `-S` : match all the keywords in URL or title. Order is irrelevant.
- Search results are indexed serially. This index is different from actual database index of a bookmark reord which is shown within `()` after the URL.
- Encryption support is manual. Database file should be unlocked (`-k`) before using markit and locked (`-l`) afterwards. Note that the database file is <i>unecrypted on creation</i>. AES256 is used for encryption.
- Encryption support is manual. Database file should be unlocked (`-k`) before using markit and locked (`-l`) afterwards. Note that the database file is <i>unecrypted on creation</i>. AES256 is used for encryption. Even a wrong password leads to (mathematically) successful decryption. So keep your encrypted database file safe i.e. do not overwrite it without verifying the file is decrypted correctly.
<b>Cmdline help:</b>

10
markit
View File

@ -86,7 +86,7 @@ def usage():
print(" any other option shows help and exits markit\n")
print("Keys")
print(" 1-N open Nth search result in browser. Enter exits markit.\n")
print("Version 1.4")
print("Version 1.5")
print("Copyright (C) 2015 Arun Prakash Jana <engineerarun@gmail.com>")
print("Webpage: https://github.com/jarun/markit")
sys.exit(1)
@ -100,6 +100,11 @@ def initdb():
if not os.path.exists(dbpath):
os.makedirs(dbpath)
encpath = os.path.join(dbpath, 'bookmarks.db.enc')
if os.path.exists(encpath) and not os.path.exists(os.path.join(dbpath, 'bookmarks.db')):
print("Unlock database first")
sys.exit(1)
# Create a connection
conn = sqlite3.connect(os.path.join(dbpath, 'bookmarks.db'))
cur = conn.cursor()
@ -455,7 +460,7 @@ def browser_open(url):
def encrypt_file():
dbpath = os.path.join(os.environ.get('HOME'), '.cache', 'markit', 'bookmarks.db')
if not os.path.exists(dbpath):
print("Error: %s missing" % dbpath)
print("%s missing. Already encrypted?" % dbpath)
sys.exit(1)
password = ''
@ -528,7 +533,6 @@ def decrypt_file():
outfile.truncate(origsize)
os.remove(encpath)
print("File decrypted")
sys.exit(0)

View File

@ -1,4 +1,4 @@
.TH "MARKIT" "1" "November 2015" "Version 1.4" "User Commands"
.TH "MARKIT" "1" "December 2015" "Version 1.5" "User Commands"
.SH NAME
markit \- Bookmark manager. Your private Google.
.SH SYNOPSIS
@ -26,7 +26,7 @@ Search works in mysterious ways:
- '-S' : match all the keywords in URL or title. Order is irrelevant.
- Search results are indexed serially. This index is different from actual database index of a bookmark reord which is shown within '()' after the URL.
.PP
Encryption support is manual. Database file should be unlocked ('-k') before using markit and locked ('-l') afterwards. Note that the database file is unecrypted on creation. AES256 is used for encryption.
Encryption support is manual. Database file should be unlocked ('-k') before using markit and locked ('-l') afterwards. Note that the database file is unecrypted on creation. AES256 is used for encryption. Even a wrong password leads to (mathematically) successful decryption. So keep your encrypted database file safe i.e. do not overwrite it without verifying the file is decrypted correctly.
.SH OPTIONS
.TP
.BI \-a " URL" " " "tag 1", " tag 2", " ..."