FIX: Version 1.01

main
Kamal Curi 4 years ago
parent ca5d4969c3
commit a946025ab9

1
.gitignore vendored

@ -3,3 +3,4 @@ test.py
pasfile.csv pasfile.csv
poptest.sh poptest.sh
what.sh what.sh
.pasfile.csv

@ -22,4 +22,9 @@
· Added 'help' command · Added 'help' command
· Minor bug fixes: · Minor bug fixes:
· ITEM_CURSOR and GLOBAL_CURSOR now behave properly under all(tested) circumstances · ITEM_CURSOR and GLOBAL_CURSOR now behave properly under all(tested) circumstances
· Added random string to modify password · Added random string to modify password
- 1.01
· Major bug fixes:
· Fixed 'help command' bug
· Fixed 'password modify' bug
· Fixed bug with window resizing

@ -20,7 +20,16 @@ then
sudo rm /opt/steelbox.sh sudo rm /opt/steelbox.sh
exit 1 exit 1
fi fi
echo Copying Help file
sudo cp -f sbhelp /opt/sbhelp
if [ $? -gt 0 ]
then
echo COULD NOT COPY HELP FILE
echo QUITTING
sudo rm /opt/steelbox.sh
sudo rm /opt/steelbox.py
exit 1
fi
echo Setting up permissions echo Setting up permissions
sudo chmod +x /opt/steelbox.sh sudo chmod +x /opt/steelbox.sh
if [ $? -gt 0 ] if [ $? -gt 0 ]
@ -29,6 +38,7 @@ then
echo QUITTING echo QUITTING
sudo rm /opt/steelbox.sh sudo rm /opt/steelbox.sh
sudo rm /opt/steelbox.py sudo rm /opt/steelbox.py
sudo rm /opt/sbhelp
exit 1 exit 1
fi fi
@ -42,6 +52,7 @@ then
echo QUITTING echo QUITTING
sudo rm /opt/steelbox.sh sudo rm /opt/steelbox.sh
sudo rm /opt/steelbox.py sudo rm /opt/steelbox.py
sudo rm /opt/sbhelp
exit 1 exit 1
fi fi
fi fi
@ -57,6 +68,7 @@ then
sudo rm /opt/steelbox.sh sudo rm /opt/steelbox.sh
sudo rm /opt/steelbox.py sudo rm /opt/steelbox.py
sudo rm /usr/bin/steelbox sudo rm /usr/bin/steelbox
sudo rm /opt/sbhelp
exit 1 exit 1
fi fi
echo Setting up password file echo Setting up password file
@ -82,6 +94,7 @@ then
sudo rm /opt/steelbox.sh sudo rm /opt/steelbox.sh
sudo rm /opt/steelbox.py sudo rm /opt/steelbox.py
sudo rm /usr/bin/steelbox sudo rm /usr/bin/steelbox
sudo rm /opt/sbhelp
rm $HOME/.pasfile.csv rm $HOME/.pasfile.csv
exit 1 exit 1
fi fi

@ -22,7 +22,6 @@ fields = ["service", "user", "pswd"]
HOMEDIR = os.environ['HOME'] HOMEDIR = os.environ['HOME']
PASFILE=HOMEDIR+"/.pasfile.csv" PASFILE=HOMEDIR+"/.pasfile.csv"
def reloadFiles(): def reloadFiles():
files.clear() files.clear()
with open(PASFILE, mode='r') as pasfile: with open(PASFILE, mode='r') as pasfile:
@ -55,9 +54,10 @@ def steelbox():
cleanWins() cleanWins()
while True: while True:
termGlobals()
reloadFiles() reloadFiles()
displayItems() displayItems()
stdscr.move(TERM_LINES, TERM_COLS) stdscr.move(0, 0)
command() command()
@ -120,6 +120,17 @@ def globals():
global PPSWD global PPSWD
PPSWD = "" PPSWD = ""
# This makes sure that if anyone resizes the terminal window, it won't be smaller than the maximum size
def termGlobals():
global TERM_LINES
TERM_LINES=curses.LINES - 1
if TERM_LINES <= 20:
close("ERROR: Your terminal is too small!")
global TERM_COLS
TERM_COLS=curses.COLS - 1
if TERM_COLS <=80:
close("ERROR: Your terminal is too small!")
# Gets user command # Gets user command
def command(): def command():
# The GLOBAL_CURSOR points to the main files object, so that it gets the right file. # The GLOBAL_CURSOR points to the main files object, so that it gets the right file.
@ -266,15 +277,15 @@ def modFile():
# Gets the coordinates for the top left corner of said window # Gets the coordinates for the top left corner of said window
nwCord = modWin.getbegyx() nwCord = modWin.getbegyx()
# Creates the fields in which the password will be edited # Creates the fields in which the password will be edited
svWin = curses.newwin(1, 45, nwCord[0]+1, nwCord[1]+6) svWin = curses.newwin(1, 46, nwCord[0]+1, nwCord[1]+6)
svWin.addstr(0, 0, modFile['service']) svWin.addstr(0, 0, modFile['service'])
svWin.move(0, 0) svWin.move(0, 0)
svBox = Textbox(svWin) svBox = Textbox(svWin)
usWin = curses.newwin(1, 45, nwCord[0]+2, nwCord[1]+6) usWin = curses.newwin(1, 46, nwCord[0]+2, nwCord[1]+6)
usWin.addstr(0, 0, modFile['user']) usWin.addstr(0, 0, modFile['user'])
usWin.move(0, 0) usWin.move(0, 0)
usBox = Textbox(usWin) usBox = Textbox(usWin)
psWin = curses.newwin(1, 45, nwCord[0]+3, nwCord[1]+6) psWin = curses.newwin(1, 46, nwCord[0]+3, nwCord[1]+6)
psWin.addstr(0, 0, modFile['pswd']) psWin.addstr(0, 0, modFile['pswd'])
psWin.move(0, 0) psWin.move(0, 0)
psBox = Textbox(psWin) psBox = Textbox(psWin)
@ -403,7 +414,7 @@ def displayItems():
LINE = 0 LINE = 0
COLUMN+=16 COLUMN+=16
NROWS+=1 NROWS+=1
STATUS_MESSAGE = "PrvPage(F1),NxtPage(F2),(d|el),(e)xamine,(n)ew,(c)opy,(m)odify,(r)andom,(q)uit" STATUS_MESSAGE = "PrvPage(F1),NxtPage(F2),(d|el),(n)ew,(c)opy,(m)odify,(r)andom,(q)uit"
displayStatus(STATUS_MESSAGE) displayStatus(STATUS_MESSAGE)
mainwin.refresh() mainwin.refresh()
@ -419,7 +430,7 @@ def sbhelp():
helpwin.border() helpwin.border()
helpwin.addstr(1, 1, "Steelbox V." + version) helpwin.addstr(1, 1, "Steelbox V." + version)
line = 2 line = 2
with open("sbhelp", mode='r') as sbhfile: with open("/opt/sbhelp", mode='r') as sbhfile:
sbh = sbhfile.readlines() sbh = sbhfile.readlines()
for lines in sbh: for lines in sbh:
helpwin.addstr(line, 1, lines) helpwin.addstr(line, 1, lines)

@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
version="1.0" version="1.01"
echo Steelbox V$version echo Steelbox V$version

Loading…
Cancel
Save