ADD: Added copy command

main
brejela 4 years ago
parent 0e55411c0c
commit 6a033f2b20

@ -11,4 +11,6 @@
· Added delete command when on the main window · Added delete command when on the main window
- 0.4: - 0.4:
· Minor UI tweaks · Minor UI tweaks
· Added 'modify' command · Added 'modify' command
- 0.5:
· Added "copy password to clipboard" command

@ -9,6 +9,15 @@ Steelbox is a password manager that uses the curses library for interactive term
### Installation (and upgrade): ### Installation (and upgrade):
Just run `install.sh` **WITHOUT SUDO** Just run `install.sh` **WITHOUT SUDO**
If you're upgrading Steelbox, don't worry: `install.sh` will do it automatically without messing with your password file If you're upgrading Steelbox, don't worry: `install.sh` will do it automatically without messing with your password file
#### Dependencies: #### 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 As of V0.5, you need the [pyperclip](https://pypi.org/project/pyperclip/) module. You can install it with [pip](https://pypi.org/project/pip/):
`pip3 install pyperclip`
Also, for clipboard support to work, you need [xclip](https://github.com/astrand/xclip) or [xsel](https://github.com/kfish/xsel) on your machine.
This program has no support for the wayland clipboard.
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.

@ -4,6 +4,7 @@ from curses import wrapper
from curses.textpad import Textbox from curses.textpad import Textbox
import sys import sys
import os import os
import pyperclip as pc
version = sys.argv[1] version = sys.argv[1]
## Initialization of bottomline dependencies ## Initialization of bottomline dependencies
@ -155,7 +156,7 @@ def main(stdscr):
COLUMN+=16 COLUMN+=16
NROWS+=1 NROWS+=1
mainwin.refresh() mainwin.refresh()
STATUS_MESSAGE = "cmds: PrvPage(F1),NxtPage(F2),(d|el)ete,(e)xamine,(n)ew, (m)odify,(q)uit" STATUS_MESSAGE = "cmds: PrvPage(F1),NxtPage(F2),(d|el)ete,(e)xamine,(n)ew,(c)opy,(m)odify,(q)uit"
statusWin.addstr(0,0, STATUS_MESSAGE) statusWin.addstr(0,0, STATUS_MESSAGE)
statusWin.refresh() statusWin.refresh()
@ -193,6 +194,14 @@ 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('c') or c == curses.KEY_F3:
pc.copy(files[GLOBAL_CURSOR]['pswd'])
statusWin.border()
STATUS_MESSAGE = "Copied password for " + files[GLOBAL_CURSOR]['service']
statusWin.addstr(0,0, STATUS_MESSAGE)
statusWin.refresh()
mainwin.getch()
elif c == ord('d') or c == curses.KEY_DC: elif c == ord('d') or c == curses.KEY_DC:
dlWin = curses.newwin(3, 22, int(TERM_LINES/2), int(TERM_COLS/2)) dlWin = curses.newwin(3, 22, int(TERM_LINES/2), int(TERM_COLS/2))
@ -241,7 +250,7 @@ def main(stdscr):
fileWin.addstr(2, 1, "NAME: " + passUser) fileWin.addstr(2, 1, "NAME: " + passUser)
fileWin.addstr(3, 1, "PSWD: " + passPswd) fileWin.addstr(3, 1, "PSWD: " + passPswd)
statusWin.border() statusWin.border()
STATUS_MESSAGE = "cmds:(d|DEL)ete,(m)odify " STATUS_MESSAGE = "cmds:(d|DEL)ete,(m)odify, (c)opy "
statusWin.addstr(0,0, STATUS_MESSAGE) statusWin.addstr(0,0, STATUS_MESSAGE)
statusWin.refresh() statusWin.refresh()
fileWin.refresh() fileWin.refresh()
@ -291,8 +300,7 @@ def main(stdscr):
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)
# Clears the 'modify password' window # Clears the 'modify password' window
modWin.border() modWin.border()
modWin.border() modWin.border()
@ -338,7 +346,14 @@ def main(stdscr):
csvreader=csv.DictReader(pasfile) csvreader=csv.DictReader(pasfile)
for ids in csvreader: for ids in csvreader:
files.append(ids) files.append(ids)
elif c == ord('c') or c == curses.KEY_F3:
pc.copy(files[GLOBAL_CURSOR]['pswd'])
statusWin.border()
STATUS_MESSAGE = "Copied password for " + files[GLOBAL_CURSOR]['service']
statusWin.addstr(0,0, STATUS_MESSAGE)
statusWin.refresh()
mainwin.getch()
elif c == ord('n'): elif c == ord('n'):

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

Loading…
Cancel
Save