Show domains with password

This commit is contained in:
Bob Mottram 2016-11-21 10:20:30 +00:00
parent c26f366e31
commit 361742f564
2 changed files with 32 additions and 12 deletions

View File

@ -108,6 +108,15 @@ function any_key {
read -n1 -r -p $"Press any key to continue..." key
}
function get_app_icann_address {
app_name="$1"
icann_address=""
if grep -q "${app_name} domain" $COMPLETION_FILE; then
icann_address=$(cat ${COMPLETION_FILE} | grep "${app_name} domain" | head -n 1 | awk -F ':' '{print $2}')
fi
echo "$icann_address"
}
function passwords_select_user {
SELECTED_USERNAME=
@ -176,11 +185,19 @@ function view_or_change_passwords {
CURR_PASSWORD=$(${PROJECT_NAME}-pass -u ${SELECTED_USERNAME} -a ${SELECTED_APP})
icann_address=$(get_app_icann_address "$app_name")
onion_address=$(get_app_onion_address "${SELECTED_APP}")
if [ ${#onion_address} -gt 0 ]; then
viewstr=$"${SELECTED_APP} password for ${SELECTED_USERNAME} on $icann_address or $onion_address.\n\nCopy or change it if you wish."
else
viewstr=$"${SELECTED_APP} password for ${SELECTED_USERNAME} on $icann_address\n\nCopy or change it if you wish."
fi
data=$(tempfile 2>/dev/null)
trap "rm -f $data" 0 1 2 5 15
dialog --title $"View or Change Password" \
--backtitle $"Freedombone Control Panel" \
--inputbox $"${SELECTED_APP} password for ${SELECTED_USERNAME}. Copy or change it if you wish." 8 60 "$CURR_PASSWORD" 2>$data
--inputbox "$viewstr" 12 60 "$CURR_PASSWORD" 2>$data
sel=$?
case $sel in
0)
@ -347,23 +364,15 @@ function show_domains {
fi
if [ ${#app_name} -gt 0 ]; then
if grep -q "${app_name} domain" $COMPLETION_FILE; then
icann_address=$(cat ${COMPLETION_FILE} | grep "${app_name} domain" | head -n 1 | awk -F ':' '{print $2}')
fi
if grep -q "${app_name} onion domain" $COMPLETION_FILE; then
onion_address=$(cat ${COMPLETION_FILE} | grep "${app_name} onion domain" | head -n 1 | awk -F ':' '{print $2}')
fi
icann_address=$(get_app_icann_address "$app_name")
onion_address=$(get_app_onion_address "$app_name")
echo -n -e "$(pad_string "${app_name}")"
echo -n -e "$(pad_string "${icann_address}")"
echo "${onion_address}"
if grep -q "${app_name}_mobile onion domain" $COMPLETION_FILE; then
if grep -q "${app_name}_mobile onion domain" $COMPLETION_FILE; then
onion_address=$(cat ${COMPLETION_FILE} | grep "${app_name}_mobile onion domain" | head -n 1 | awk -F ':' '{print $2}')
fi
onion_address=$(get_app_onion_address "${app_name}")
echo -n -e "$(pad_string "${app_name} (mobile)")"
echo -n -e "$(pad_string "${icann_address}")"
echo "${onion_address}"

View File

@ -380,4 +380,15 @@ function route_outgoing_traffic_through_tor {
mark_completed $FUNCNAME
}
function get_app_onion_address {
app_name="$1"
if grep -q "${app_name}_mobile onion domain" $COMPLETION_FILE; then
if grep -q "${app_name}_mobile onion domain" $COMPLETION_FILE; then
echo $(cat ${COMPLETION_FILE} | grep "${app_name}_mobile onion domain" | head -n 1 | awk -F ':' '{print $2}')
return
fi
fi
echo ""
}
# NOTE: deliberately no exit 0