diff --git a/CHANGELOG b/CHANGELOG index 11907c9..10464e8 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -42,4 +42,7 @@ · Fixed GLOBAL_CURSOR position when a file is deleted · Fixed bug when trying to read a password in an empty database (Database now avoids being empty by populating itself with at lest one file) · Changed MANUAL and sbhelp accordingly, and made some changes to the licenses section - · Also, deleted the plaintext version \ No newline at end of file + · Also, deleted the plaintext version +- 1.1 + · Added license to source code to better comply with GPLv2; + · Added confirmation dialog for modification of passwords \ No newline at end of file diff --git a/sbhelp b/sbhelp index 0421f8c..9db3b72 100644 --- a/sbhelp +++ b/sbhelp @@ -27,4 +27,17 @@ CTRL+F to move the cursor once to the right CTRL+H to remove one character (Backspace) ││ CTRL+D to remove highlghted character (Delete) ││ CTRL+O to clear the field ------------------------------------------------------------------------- \ No newline at end of file +------------------------------------------------------------------------ +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published +by the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty +of MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR- +POSE. See the GNU General Public License for more details. +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software Founda- +tion, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +USA. +You can contact the developer by sending an email to kamalcuri@outlook.com \ No newline at end of file diff --git a/steelbox.py b/steelbox.py index f19afce..be45cdd 100644 --- a/steelbox.py +++ b/steelbox.py @@ -1,3 +1,20 @@ +# Steelbox, the password manager for your terminal. +# Full license inside the manual at doc/ +# Copyright (C) 2022 Kamal Curi +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published +# by the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty +# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR- +# POSE. See the GNU General Public License for more details. +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Founda- +# tion, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. +# You can contact the developer by sending an email to kamalcuri@outlook.com + import csv import curses from curses.textpad import Textbox @@ -6,7 +23,7 @@ import os import pyperclip as pc import random -version = sys.argv[1] +version = "200d" ## Initialization of bottomline dependencies @@ -20,7 +37,7 @@ fields = ["service", "user", "pswd"] # Password file HOMEDIR = os.environ['HOME'] -PASFILE=HOMEDIR+"/.pasfile.csv" +PASFILE="pasfile.csv" def reloadFiles(): files.clear() @@ -255,7 +272,6 @@ def command(): globals() init() - def newFile(): # Initializes the 'new password' window npWin = curses.newwin(5, 60,int(TERM_LINES/2)-2, int(TERM_COLS/2)-18) @@ -419,13 +435,23 @@ def modFile(): pSize = 45 passPswd = randString(pSize) modFile = {'service' : passService, 'user' : passUser, 'pswd' : passPswd} - files.insert(GLOBAL_CURSOR, modFile) - with open(PASFILE, mode='w') as pasfile: - # Creates writer object and writes to the csv file - csvwriter = csv.DictWriter(pasfile, fields) - csvwriter.writeheader() - csvwriter.writerows(files) - reloadFiles() + + # This is just a copy of delfile's confirmation routine + dlWin = curses.newwin(3, 22, int(TERM_LINES/2), int(TERM_COLS/2)) + dlWin.border() + dlWin.refresh() + STATUS_MESSAGE = "Modify " + displayList[GLOBAL_CURSOR] + "?" + displayStatus(STATUS_MESSAGE) + dlWin.addstr(1, 1, "Are you sure? (y/N)") + c = dlWin.getch() + if c == ord('y'): + files.insert(GLOBAL_CURSOR, modFile) + with open(PASFILE, mode='w') as pasfile: + # Creates writer object and writes to the csv file + csvwriter = csv.DictWriter(pasfile, fields) + csvwriter.writeheader() + csvwriter.writerows(files) + reloadFiles() def delFile(): @@ -488,6 +514,7 @@ def displayStatus(msg): statuswin.addstr(0,0, msg) statuswin.refresh() +# Displays the help file def sbhelp(): helpwin = curses.newwin(TERM_LINES - 1, TERM_COLS - 1, 0, 0) helpwin.border() @@ -502,8 +529,6 @@ def sbhelp(): helpwin.addstr(line, 1, "PRESS ANY KEY TO CONTINUE", curses.A_REVERSE) helpwin.getch() - - # Returns a random string of length 45 def randString(size): result = '' @@ -514,8 +539,6 @@ def randString(size): result += chr(ascNum) return(result) - - # Finishes the application def close(error = ''): curses.nocbreak() diff --git a/steelbox.sh b/steelbox.sh index 12c07f0..fca7516 100755 --- a/steelbox.sh +++ b/steelbox.sh @@ -1,8 +1,12 @@ +# Copyright (C) 2022 Kamal Curi +# Full license inside the manual at doc/ + #!/usr/bin/env bash version="1.04" -echo Steelbox V$version +echo "Steelbox V$version, Copyright (C) 2022 Kamal Curi" +echo "Read the manual in doc/ for the GPL2 License's details." if [ -f $HOME/.pasfile.csv.gpg ]