Made oathtool configurable

pull/59/head
Alex 2019-07-08 21:12:09 +02:00
parent 7a69d45dad
commit ca7a12deb1
3 changed files with 22 additions and 15 deletions

View File

@ -13,6 +13,7 @@ ALEXA - the URL you would use for the Alexa Web App
CURL - location of your cURL binary
OPTS - any cURL options you require
TMP - location of the temp dir
OATHTOOL - command line for oathtool MFA
```
You will very likely want to set the language to:
```
@ -51,9 +52,3 @@ alexa-remote-control [-d <device>|ALL] -e <pause|play|next|prev|fwd|rwd|shuffle|
There's also a "plain" version, which lacks some functionality (-i, -p, -P, -S and no radio station names and no routines) but doesn't require 'jq' for JSON processing.
http://blog.loetzimmer.de/2017/10/amazon-alexa-hort-auf-die-shell-echo.html

12
alexa_remote_control.sh Normal file → Executable file
View File

@ -56,7 +56,9 @@
SET_EMAIL='amazon_account@email.address'
SET_PASSWORD='Very_Secret_Amazon_Account_Password'
#SET_MFA_SECRET='1234 5678 9ABC DEFG HIJK LMNO PQRS TUVW XYZ0 1234 5678 9ABC DEFG'
SET_MFA_SECRET=''
# something like:
# 1234 5678 9ABC DEFG HIJK LMNO PQRS TUVW XYZ0 1234 5678 9ABC DEFG
SET_LANGUAGE='de,en-US;q=0.7,en;q=0.3'
#SET_LANGUAGE='en-US'
@ -83,6 +85,9 @@ SET_OPTS='--compressed --http1.1'
SET_BROWSER='Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:1.0) bash-script/1.0'
#SET_BROWSER='Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:65.0) Gecko/20100101 Firefox/65.0'
# oathtool command line
SET_OATHTOOL='oathtool --base32 --totp'
# tmp path
SET_TMP="/tmp"
@ -102,6 +107,7 @@ CURL=${CURL:-$SET_CURL}
OPTS=${OPTS:-$SET_OPTS}
TTS_LOCALE=${TTS_LOCALE:-$SET_TTS_LOCALE}
TMP=${TMP:-$SET_TMP}
OATHTOOL=${OOATHTOOL:-$SET_OATHTOOL}
COOKIE="${TMP}/.alexa.cookie"
DEVLIST="${TMP}/.alexa.devicelist.json"
@ -407,8 +413,8 @@ ${CURL} ${OPTS} -s -c ${COOKIE} -b ${COOKIE} -A "${BROWSER}" -H "Accept-Language
#
# add OTP if using MFA
#
if [ ! -z "${MFA_SECRET}" ] ; then
OTP=$(oathtool --base32 --totp "${MFA_SECRET}")
if [ -n "${MFA_SECRET}" ] ; then
OTP=$(${OATHTOOL} "${MFA_SECRET}")
PASSWORD="${PASSWORD}${OTP}"
fi

12
alexa_remote_control_plain.sh Normal file → Executable file
View File

@ -15,7 +15,9 @@
SET_EMAIL='amazon_account@email.address'
SET_PASSWORD='Very_Secret_Amazon_Account_Password'
#SET_MFA_SECRET='1234 5678 9ABC DEFG HIJK LMNO PQRS TUVW XYZ0 1234 5678 9ABC DEFG'
SET_MFA_SECRET=''
# something like:
# 1234 5678 9ABC DEFG HIJK LMNO PQRS TUVW XYZ0 1234 5678 9ABC DEFG
SET_LANGUAGE='de,en-US;q=0.7,en;q=0.3'
#SET_LANGUAGE='en-US'
@ -42,6 +44,9 @@ SET_OPTS='--compressed --http1.1'
SET_BROWSER='Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:1.0) bash-script/1.0'
#SET_BROWSER='Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:65.0) Gecko/20100101 Firefox/65.0'
# oathtool command line
SET_OATHTOOL='oathtool --base32 --totp'
# tmp path
SET_TMP="/tmp"
@ -61,6 +66,7 @@ CURL=${CURL:-$SET_CURL}
OPTS=${OPTS:-$SET_OPTS}
TTS_LOCALE=${TTS_LOCALE:-$SET_TTS_LOCALE}
TMP=${TMP:-$SET_TMP}
OATHTOOL=${OOATHTOOL:-$SET_OATHTOOL}
COOKIE="${TMP}/.alexa.cookie"
DEVLIST="${TMP}/.alexa.devicelist.json"
@ -347,8 +353,8 @@ ${CURL} ${OPTS} -s -c ${COOKIE} -b ${COOKIE} -A "${BROWSER}" -H "Accept-Language
#
# add OTP if using MFA
#
if [ ! -z "${MFA_SECRET}" ] ; then
OTP=$(oathtool --base32 --totp "${MFA_SECRET}")
if [ -n "${MFA_SECRET}" ] ; then
OTP=$(${OATHTOOL} "${MFA_SECRET}")
PASSWORD="${PASSWORD}${OTP}"
fi