47 lines
974 B
Bash
47 lines
974 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
function main() {
|
||
|
exec 3>&1
|
||
|
MENU=$(dialog --title "DarkCrypt" \
|
||
|
--menu "\nControls - UP/DOWN/[Enter]\n" 10 25 0 \
|
||
|
"S" "Save New Entry" \
|
||
|
"G" "Get Old Entry" \
|
||
|
"E" "Exit" 2>&1 1>&3);
|
||
|
|
||
|
case "${MENU}" in
|
||
|
"S" ) saveToDB
|
||
|
;;
|
||
|
"G" ) ##getPasswd
|
||
|
;;
|
||
|
"G" ) exit;
|
||
|
;;
|
||
|
esac
|
||
|
}
|
||
|
|
||
|
function saveToDB() {
|
||
|
# height, width, formheight
|
||
|
exec 3>&1
|
||
|
DATA=$(dialog --backtitle "DarkCrypt" --title "Save" \
|
||
|
--form "" 14 48 0 \
|
||
|
"Title:" 1 1 "" 1 20 20 30 \
|
||
|
"Description:" 2 1 "" 2 20 20 30 \
|
||
|
"Username:" 3 1 "" 3 20 20 30 \
|
||
|
"Password:" 4 1 "" 4 20 20 30 \
|
||
|
"URL:" 5 1 "" 5 20 20 30 \
|
||
|
"Tags:" 6 1 "" 6 20 20 30 2>&1 1>&3)
|
||
|
|
||
|
if test $? -eq 0
|
||
|
then
|
||
|
runSave $DATA;
|
||
|
main;
|
||
|
else
|
||
|
main;
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
function runSave() {
|
||
|
echo "$1" > result.txt
|
||
|
}
|
||
|
|
||
|
main;
|