FIX: Version 0.3

main
Kamal Curi 4 years ago
parent 4b55334669
commit 59699b5c15

@ -0,0 +1,11 @@
- 0.2:
· Implemented install and launch shell scripts
· Implemented GPG encryption on password file
· Minor UI tweaks
· Some bug fixes
- 0.3:
· Fixed major bug with delete command
· Fixed bug with the cursor for when pressing down on the last item
· Minor UI tweaks:
· Fixed 'view password' window for large passwords
· Added delete command when on the main window

@ -1,2 +1,10 @@
# steelbox # Steelbox
Because sometimes you just want a password manager ![Steel box](https://static.wikia.nocookie.net/elderscrolls/images/6/6a/Skyrim-strongbox.png)
## Because sometimes you just want a password manager
Steelbox is a password manager that uses the curses library for interactive terminals
### Installation:
Just run `install.sh` **WITHOUT SUDO**
#### Dependencies:
The standard ( this program was made with 3.10 ) python installation comes with the `curses` and `csv` modules, just make sure you have [GnuPG](https://gnupg.org/) installed

@ -46,6 +46,8 @@ then
fi fi
fi fi
if [ ! -f $HOME/.pasfile.csv.gpg ] && [ ! -f $HOME/.pasfile.csv ]
then
echo Creating initial password file echo Creating initial password file
touch $HOME/.pasfile.csv touch $HOME/.pasfile.csv
if [ $? -gt 0 ] if [ $? -gt 0 ]
@ -84,3 +86,4 @@ then
exit 1 exit 1
fi fi
rm $HOME/.pasfile.csv rm $HOME/.pasfile.csv
fi

@ -25,7 +25,7 @@ PASFILE=HOMEDIR+"/.pasfile.csv"
def main(stdscr): def main(stdscr):
# Opens password file # Opens password file
with open(PASFILE, mode='r') as pasfile: with open(PASFILE, mode='r') as pasfile:
# Creates reader and writer objects # Creates reader object
csvreader=csv.DictReader(pasfile) csvreader=csv.DictReader(pasfile)
for ids in csvreader: for ids in csvreader:
files.append(ids) files.append(ids)
@ -42,11 +42,11 @@ def main(stdscr):
# Determines terminal size # Determines terminal size
global TERM_LINES global TERM_LINES
TERM_LINES=curses.LINES - 1 TERM_LINES=curses.LINES - 1
if TERM_LINES <= 15: if TERM_LINES <= 20:
sys.exit("ERROR: Your terminal is too small!") sys.exit("ERROR: Your terminal is too small!")
global TERM_COLS global TERM_COLS
TERM_COLS=curses.COLS - 1 TERM_COLS=curses.COLS - 1
if TERM_COLS <=60: if TERM_COLS <=80:
sys.exit("ERROR: Your terminal is too small!") sys.exit("ERROR: Your terminal is too small!")
# Global (program-wide) variables for cursor position # Global (program-wide) variables for cursor position
global LINE global LINE
@ -148,7 +148,7 @@ def main(stdscr):
COLUMN+=16 COLUMN+=16
NROWS+=1 NROWS+=1
mainwin.refresh() mainwin.refresh()
STATUS_MESSAGE = "cmds: PrvPage(F1),NxtPage(F2),(q)uit,(e)xmn,(n)ew" STATUS_MESSAGE = "cmds: PrvPage(F1),NxtPage(F2),(d|el)ete,(e)xmn,(n)ew,(q)uit"
statusWin.addstr(0,0, STATUS_MESSAGE) statusWin.addstr(0,0, STATUS_MESSAGE)
statusWin.refresh() statusWin.refresh()
@ -160,7 +160,7 @@ def main(stdscr):
if c == ord('q'): if c == ord('q'):
return(0) return(0)
elif c == curses.KEY_DOWN: elif c == curses.KEY_DOWN:
if GLOBAL_CURSOR < len(files): if GLOBAL_CURSOR < len(files) - 1:
ITEM_CURSOR+=1 ITEM_CURSOR+=1
GLOBAL_CURSOR+=1 GLOBAL_CURSOR+=1
elif c == curses.KEY_UP: elif c == curses.KEY_UP:
@ -186,6 +186,28 @@ def main(stdscr):
if CURR_PAGE < MAX_PAGES: if CURR_PAGE < MAX_PAGES:
CURR_PAGE+=1 CURR_PAGE+=1
GLOBAL_CURSOR+=MAX_ITEMS GLOBAL_CURSOR+=MAX_ITEMS
elif c == ord('d') or c == curses.KEY_DC:
dlWin = curses.newwin(3, 22, int(TERM_LINES/2), int(TERM_COLS/2))
dlWin.border()
dlWin.refresh()
statusWin.clear()
STATUS_MESSAGE = "Delete " + displayList[GLOBAL_CURSOR] + "?"
statusWin.addstr(0,0, STATUS_MESSAGE)
statusWin.refresh()
dlWin.addstr(1, 1, "Are you sure? (y/N)")
c = dlWin.getch()
if c == ord('y'):
files.pop(GLOBAL_CURSOR)
with open(PASFILE, mode='w') as pasfile:
csvwriter = csv.DictWriter(pasfile, fields)
csvwriter.writeheader()
csvwriter.writerows(files)
files.clear()
with open(PASFILE, mode='r') as pasfile:
# Creates reader object
csvreader=csv.DictReader(pasfile)
for ids in csvreader:
files.append(ids)
# For some reason, KEY_UP is 10, instead of the 343 the debbuger flags... Welp ¯\_(ツ)_/¯ # For some reason, KEY_UP is 10, instead of the 343 the debbuger flags... Welp ¯\_(ツ)_/¯
elif c == 10 or c == curses.KEY_ENTER or c == ord('e'): elif c == 10 or c == curses.KEY_ENTER or c == ord('e'):
@ -198,7 +220,7 @@ def main(stdscr):
if LINE+10 > TERM_LINES: if LINE+10 > TERM_LINES:
LINE-=10 LINE-=10
# Initializes the file viewer window # Initializes the file viewer window
fileWin = curses.newwin(5, 40, LINE+5, COLUMN) fileWin = curses.newwin(5, 60, LINE+5, COLUMN)
# Clears the window # Clears the window
fileWin.clear() fileWin.clear()
fileWin.border() fileWin.border()
@ -229,16 +251,22 @@ def main(stdscr):
c = dlWin.getch() c = dlWin.getch()
if c == ord('y'): if c == ord('y'):
files.pop(GLOBAL_CURSOR) files.pop(GLOBAL_CURSOR)
with open(PASFILE, mode='r+') as pasfile: with open(PASFILE, mode='w') as pasfile:
csvwriter = csv.DictWriter(pasfile, fields) csvwriter = csv.DictWriter(pasfile, fields)
csvwriter.writeheader() csvwriter.writeheader()
csvwriter.writerows(files) csvwriter.writerows(files)
files.clear()
with open(PASFILE, mode='r') as pasfile:
# Creates reader object
csvreader=csv.DictReader(pasfile)
for ids in csvreader:
files.append(ids)
elif c == ord('n'): elif c == ord('n'):
# Initializes the 'new password' window # Initializes the 'new password' window
npWin = curses.newwin(5, 52,int(TERM_LINES/2)-2, int(TERM_COLS/2)-18) npWin = curses.newwin(5, 60,int(TERM_LINES/2)-2, int(TERM_COLS/2)-18)
nwCord = npWin.getbegyx() nwCord = npWin.getbegyx()
# Initializes the windows in which the textboxes will reside for input # Initializes the windows in which the textboxes will reside for input
svWin = curses.newwin(1, 45, nwCord[0]+1, nwCord[1]+6) svWin = curses.newwin(1, 45, nwCord[0]+1, nwCord[1]+6)

@ -1,6 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
version="0.2" version="0.3"
echo Steelbox V$version
if [ -f $HOME/.pasfile.csv.gpg ] if [ -f $HOME/.pasfile.csv.gpg ]
then then

Loading…
Cancel
Save