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
Because sometimes you just want a password manager
# Steelbox
![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,41 +46,44 @@ then
fi
fi
echo Creating initial password file
touch $HOME/.pasfile.csv
if [ $? -gt 0 ]
if [ ! -f $HOME/.pasfile.csv.gpg ] && [ ! -f $HOME/.pasfile.csv ]
then
echo COULD NOT CREATE PASSWORD FILE
echo QUITTING
sudo rm /opt/steelbox.sh
sudo rm /opt/steelbox.py
sudo rm /usr/bin/steelbox
exit 1
fi
echo Setting up password file
echo service,user,pswd > $HOME/.pasfile.csv &> /dev/null
echo Creating initial password file
touch $HOME/.pasfile.csv
if [ $? -gt 0 ]
then
echo COULD NOT CREATE PASSWORD FILE
echo QUITTING
sudo rm /opt/steelbox.sh
sudo rm /opt/steelbox.py
sudo rm /usr/bin/steelbox
exit 1
fi
echo Setting up password file
echo service,user,pswd > $HOME/.pasfile.csv &> /dev/null
echo Loading GPG to encrypt the file for the first time.
echo ===========================================================
echo YOU WILL BE ASKED TO GIVE A PASSWORD TO THE PASSWORD FILE
echo \(And yes, I\'m not immune to the irony\)
echo YOU WILL NEED THIS PASSWORD TO OPEN YOUR FILE
echo gpg-agent \(OR WHATEVER AGENT YOU USE\) WILL
echo HANDLE YOUR PASSWORDS UNTIL YOU REBOOT
echo ===========================================================
echo PRESS ENTER TO CONTINUE
read
echo Loading GPG to encrypt the file for the first time.
echo ===========================================================
echo YOU WILL BE ASKED TO GIVE A PASSWORD TO THE PASSWORD FILE
echo \(And yes, I\'m not immune to the irony\)
echo YOU WILL NEED THIS PASSWORD TO OPEN YOUR FILE
echo gpg-agent \(OR WHATEVER AGENT YOU USE\) WILL
echo HANDLE YOUR PASSWORDS UNTIL YOU REBOOT
echo ===========================================================
echo PRESS ENTER TO CONTINUE
read
gpg -c --cipher-algo AES256 $HOME/.pasfile.csv
if [ $? -gt 0 ]
then
echo ERROR ENCRYPTING THE FILE
echo YOU MUST TYPE A PASSWORD FOR THE INITIAL PASSWORD FILE
echo DELETING ALL INSTALATION FILES
sudo rm /opt/steelbox.sh
sudo rm /opt/steelbox.py
sudo rm /usr/bin/steelbox
gpg -c --cipher-algo AES256 $HOME/.pasfile.csv
if [ $? -gt 0 ]
then
echo ERROR ENCRYPTING THE FILE
echo YOU MUST TYPE A PASSWORD FOR THE INITIAL PASSWORD FILE
echo DELETING ALL INSTALATION FILES
sudo rm /opt/steelbox.sh
sudo rm /opt/steelbox.py
sudo rm /usr/bin/steelbox
rm $HOME/.pasfile.csv
exit 1
fi
rm $HOME/.pasfile.csv
exit 1
fi
rm $HOME/.pasfile.csv
fi

@ -25,7 +25,7 @@ PASFILE=HOMEDIR+"/.pasfile.csv"
def main(stdscr):
# Opens password file
with open(PASFILE, mode='r') as pasfile:
# Creates reader and writer objects
# Creates reader object
csvreader=csv.DictReader(pasfile)
for ids in csvreader:
files.append(ids)
@ -42,11 +42,11 @@ def main(stdscr):
# Determines terminal size
global TERM_LINES
TERM_LINES=curses.LINES - 1
if TERM_LINES <= 15:
if TERM_LINES <= 20:
sys.exit("ERROR: Your terminal is too small!")
global TERM_COLS
TERM_COLS=curses.COLS - 1
if TERM_COLS <=60:
if TERM_COLS <=80:
sys.exit("ERROR: Your terminal is too small!")
# Global (program-wide) variables for cursor position
global LINE
@ -148,7 +148,7 @@ def main(stdscr):
COLUMN+=16
NROWS+=1
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.refresh()
@ -160,7 +160,7 @@ def main(stdscr):
if c == ord('q'):
return(0)
elif c == curses.KEY_DOWN:
if GLOBAL_CURSOR < len(files):
if GLOBAL_CURSOR < len(files) - 1:
ITEM_CURSOR+=1
GLOBAL_CURSOR+=1
elif c == curses.KEY_UP:
@ -186,6 +186,28 @@ def main(stdscr):
if CURR_PAGE < MAX_PAGES:
CURR_PAGE+=1
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 ¯\_(ツ)_/¯
elif c == 10 or c == curses.KEY_ENTER or c == ord('e'):
@ -198,7 +220,7 @@ def main(stdscr):
if LINE+10 > TERM_LINES:
LINE-=10
# Initializes the file viewer window
fileWin = curses.newwin(5, 40, LINE+5, COLUMN)
fileWin = curses.newwin(5, 60, LINE+5, COLUMN)
# Clears the window
fileWin.clear()
fileWin.border()
@ -229,16 +251,22 @@ def main(stdscr):
c = dlWin.getch()
if c == ord('y'):
files.pop(GLOBAL_CURSOR)
with open(PASFILE, mode='r+') as pasfile:
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)
elif c == ord('n'):
# 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()
# Initializes the windows in which the textboxes will reside for input
svWin = curses.newwin(1, 45, nwCord[0]+1, nwCord[1]+6)

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

Loading…
Cancel
Save