dialog can now be black/white, lockfile, cheap password protection
This commit is contained in:
parent
4a637a9b39
commit
1d71a42d3c
4
.pw/README.md
Normal file
4
.pw/README.md
Normal file
@ -0,0 +1,4 @@
|
||||
# IRO's insecure passwords
|
||||
|
||||
- Filename: username
|
||||
- File's content: password, plain text!
|
144
dialogrc
Normal file
144
dialogrc
Normal file
@ -0,0 +1,144 @@
|
||||
#
|
||||
# Run-time configuration file for dialog
|
||||
#
|
||||
# Automatically generated by "dialog --create-rc <file>"
|
||||
#
|
||||
#
|
||||
# Types of values:
|
||||
#
|
||||
# Number - <number>
|
||||
# String - "string"
|
||||
# Boolean - <ON|OFF>
|
||||
# Attribute - (foreground,background,highlight?,underline?,reverse?)
|
||||
|
||||
# Set aspect-ration.
|
||||
aspect = 0
|
||||
|
||||
# Set separator (for multiple widgets output).
|
||||
separate_widget = ""
|
||||
|
||||
# Set tab-length (for textbox tab-conversion).
|
||||
tab_len = 0
|
||||
|
||||
# Make tab-traversal for checklist, etc., include the list.
|
||||
visit_items = OFF
|
||||
|
||||
# Shadow dialog boxes? This also turns on color.
|
||||
use_shadow = OFF
|
||||
|
||||
# Turn color support ON or OFF
|
||||
use_colors = OFF
|
||||
|
||||
# Screen color
|
||||
screen_color = (CYAN,BLUE,OFF)
|
||||
|
||||
# Shadow color
|
||||
shadow_color = (BLACK,BLACK,ON)
|
||||
|
||||
# Dialog box color
|
||||
dialog_color = (BLACK,WHITE,OFF)
|
||||
|
||||
# Dialog box title color
|
||||
title_color = (BLUE,WHITE,OFF)
|
||||
|
||||
# Dialog box border color
|
||||
border_color = (WHITE,WHITE,ON)
|
||||
|
||||
# Active button color
|
||||
button_active_color = (WHITE,BLACK,ON)
|
||||
|
||||
# Inactive button color
|
||||
button_inactive_color = dialog_color
|
||||
|
||||
# Active button key color
|
||||
button_key_active_color = button_active_color
|
||||
|
||||
# Inactive button key color
|
||||
button_key_inactive_color = (RED,WHITE,OFF)
|
||||
|
||||
# Active button label color
|
||||
button_label_active_color = (YELLOW,BLUE,OFF)
|
||||
|
||||
# Inactive button label color
|
||||
button_label_inactive_color = (BLACK,WHITE,ON)
|
||||
|
||||
# Input box color
|
||||
inputbox_color = dialog_color
|
||||
|
||||
# Input box border color
|
||||
inputbox_border_color = dialog_color
|
||||
|
||||
# Search box color
|
||||
searchbox_color = dialog_color
|
||||
|
||||
# Search box title color
|
||||
searchbox_title_color = title_color
|
||||
|
||||
# Search box border color
|
||||
searchbox_border_color = border_color
|
||||
|
||||
# File position indicator color
|
||||
position_indicator_color = title_color
|
||||
|
||||
# Menu box color
|
||||
menubox_color = dialog_color
|
||||
|
||||
# Menu box border color
|
||||
menubox_border_color = border_color
|
||||
|
||||
# Item color
|
||||
item_color = dialog_color
|
||||
|
||||
# Selected item color
|
||||
item_selected_color = button_active_color
|
||||
|
||||
# Tag color
|
||||
tag_color = title_color
|
||||
|
||||
# Selected tag color
|
||||
tag_selected_color = button_label_active_color
|
||||
|
||||
# Tag key color
|
||||
tag_key_color = button_key_inactive_color
|
||||
|
||||
# Selected tag key color
|
||||
tag_key_selected_color = (RED,BLUE,ON)
|
||||
|
||||
# Check box color
|
||||
check_color = dialog_color
|
||||
|
||||
# Selected check box color
|
||||
check_selected_color = button_active_color
|
||||
|
||||
# Up arrow color
|
||||
uarrow_color = (GREEN,WHITE,ON)
|
||||
|
||||
# Down arrow color
|
||||
darrow_color = uarrow_color
|
||||
|
||||
# Item help-text color
|
||||
itemhelp_color = (WHITE,BLACK,OFF)
|
||||
|
||||
# Active form text color
|
||||
form_active_text_color = button_active_color
|
||||
|
||||
# Form text color
|
||||
form_text_color = (WHITE,CYAN,OFF)
|
||||
|
||||
# Readonly form item color
|
||||
form_item_readonly_color = (CYAN,WHITE,OFF)
|
||||
|
||||
# Dialog box gauge color
|
||||
gauge_color = title_color
|
||||
|
||||
# Dialog box border2 color
|
||||
border2_color = dialog_color
|
||||
|
||||
# Input box border2 color
|
||||
inputbox_border2_color = dialog_color
|
||||
|
||||
# Search box border2 color
|
||||
searchbox_border2_color = dialog_color
|
||||
|
||||
# Menu box border2 color
|
||||
menubox_border2_color = dialog_color
|
73
start
73
start
@ -1,10 +1,26 @@
|
||||
#!/bin/bash
|
||||
export EVENT=DiVOC
|
||||
|
||||
export DIALOGRC=dialogrc
|
||||
|
||||
LOCKFILE=/tmp/irolock
|
||||
TMP=/tmp/$RANDOM
|
||||
BT="Intergalactic Registration Office - v0.3"
|
||||
|
||||
|
||||
function infoBox() {
|
||||
h=8
|
||||
w=60
|
||||
if [ -n "$3" ]; then
|
||||
h=$3
|
||||
fi
|
||||
if [ -n "$4" ]; then
|
||||
w=$4
|
||||
fi
|
||||
dialog --title "$1" \
|
||||
--backtitle "$BT" \
|
||||
--infobox "$2" $h $w
|
||||
}
|
||||
|
||||
function diaBox() {
|
||||
h=8
|
||||
@ -54,6 +70,24 @@ function askStr() {
|
||||
return $?
|
||||
}
|
||||
|
||||
function askPw() {
|
||||
h=12
|
||||
w=60
|
||||
if [ -n "$5" ]; then
|
||||
h=$5
|
||||
fi
|
||||
if [ -n "$6" ]; then
|
||||
w=$6
|
||||
fi
|
||||
|
||||
dialog --title "$2" \
|
||||
--backtitle "$BT" \
|
||||
--max-input $1 \
|
||||
--insecure \
|
||||
--passwordbox "$3" $h $w "$4" 2> $TMP
|
||||
return $?
|
||||
}
|
||||
|
||||
function confirm() {
|
||||
h=12
|
||||
w=60
|
||||
@ -143,13 +177,23 @@ function enterGPG() {
|
||||
fi
|
||||
}
|
||||
|
||||
function checkLockFile() {
|
||||
while [ -f $LOCKFILE ]; do
|
||||
infoBox "Printer is in use..." "Printer is in use. Please wait."
|
||||
sleep 1
|
||||
done
|
||||
touch $LOCKFILE
|
||||
}
|
||||
|
||||
function printGPG() {
|
||||
askForField "GPG fingerprint" "$1"
|
||||
if [ $? -eq 0 ]; then
|
||||
checkLockFile
|
||||
diaBox "Insert Passport" "Please insert passport (Visas) into the printer."
|
||||
cd "$1"
|
||||
./gpgkey $FIELD $FP
|
||||
cd ..
|
||||
rm $LOCKFILE
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
@ -157,20 +201,24 @@ function printGPG() {
|
||||
}
|
||||
|
||||
function printReg() {
|
||||
checkLockFile
|
||||
diaBox "Insert Passport" "Please insert passport (First page, name, place) into the printer."
|
||||
cd "$1"
|
||||
./reg "$FNAME" "$SNAME" "$PLANET"
|
||||
cd ..
|
||||
rm $LOCKFILE
|
||||
return 0
|
||||
}
|
||||
|
||||
function printIROStamp() {
|
||||
askForField "IRO stamp" "$1"
|
||||
if [ $? -eq 0 ]; then
|
||||
checkLockFile
|
||||
diaBox "Insert Passport" "Please insert passport (Visas) into the printer."
|
||||
cd "$1"
|
||||
./iro $FIELD
|
||||
cd ..
|
||||
rm $LOCKFILE
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
@ -305,13 +353,34 @@ function menuFor() {
|
||||
unset FFP
|
||||
}
|
||||
|
||||
function askForFunnyUserCreds() {
|
||||
askStr 12 "Login" "Username:" ""
|
||||
username=$(cat $TMP)
|
||||
askPw 12 "Login" "Password:" ""
|
||||
password=$(cat $TMP)
|
||||
|
||||
if [ -f .pw/$username ]; then
|
||||
if [ "$password" != $(cat .pw/$username) ]; then
|
||||
clear
|
||||
echo "Wrong credentials."
|
||||
sleep 3
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Wrong credentials."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
askForFunnyUserCreds
|
||||
|
||||
while [ true ]; do
|
||||
|
||||
dialog --backtitle "$BT" \
|
||||
--menu "Select ID type:" 10 40 3 \
|
||||
1 "Junghackerpass" \
|
||||
2 "New Adafruit passport" \
|
||||
9 "Exit" 2> $TMP
|
||||
9 "Logout" 2> $TMP
|
||||
|
||||
if [ $? -eq 9 ]; then
|
||||
break
|
||||
@ -325,7 +394,7 @@ while [ true ]; do
|
||||
;;
|
||||
2) menuFor adafruit
|
||||
;;
|
||||
9) exit 0
|
||||
9) break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
Loading…
Reference in New Issue
Block a user