mirror of
https://github.com/thorsten-gehrig/alexa-remote-control.git
synced 2024-11-22 08:49:02 +01:00
PR #145 Explicitly use grep -E for whitespace matching
This commit is contained in:
commit
477cc05208
@ -575,7 +575,7 @@ else
|
|||||||
sed -e "$(cat ${COOKIE}.json | ${JQ} -r '.response.tokens.cookies | to_entries[] | .key as $domain | .value[] | .Expires' | awk '$3 >= 2038 { print "s/"$1" "$2" "$3" "$4" "$5"/"$1" "$2" "2037" "$4" "$5"/g" ;}')" ${COOKIE}.json |\
|
sed -e "$(cat ${COOKIE}.json | ${JQ} -r '.response.tokens.cookies | to_entries[] | .key as $domain | .value[] | .Expires' | awk '$3 >= 2038 { print "s/"$1" "$2" "$3" "$4" "$5"/"$1" "$2" "2037" "$4" "$5"/g" ;}')" ${COOKIE}.json |\
|
||||||
${JQ} -r '.response.tokens.cookies | to_entries[] | .key as $domain | .value[] | map_values(if . == true then "TRUE" elif . == false then "FALSE" else . end) | .Expires |= ( strptime("%d %b %Y %H:%M:%S %Z") | mktime ) | [(if .HttpOnly=="TRUE" then ("#HttpOnly_" + $domain) else $domain end), "TRUE", .Path, .Secure, .Expires, .Name, .Value] | @tsv' > ${COOKIE}
|
${JQ} -r '.response.tokens.cookies | to_entries[] | .key as $domain | .value[] | map_values(if . == true then "TRUE" elif . == false then "FALSE" else . end) | .Expires |= ( strptime("%d %b %Y %H:%M:%S %Z") | mktime ) | [(if .HttpOnly=="TRUE" then ("#HttpOnly_" + $domain) else $domain end), "TRUE", .Path, .Secure, .Expires, .Name, .Value] | @tsv' > ${COOKIE}
|
||||||
|
|
||||||
if [ -z "$(grep "\.${AMAZON}.*\sat-" ${COOKIE})" ] ; then
|
if [ -z "$(grep -E "\.${AMAZON}.*\sat-" ${COOKIE})" ] ; then
|
||||||
echo "ERROR: cookie retrieval with refresh_token didn't work"
|
echo "ERROR: cookie retrieval with refresh_token didn't work"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@ -589,21 +589,21 @@ ${CURL} ${OPTS} -s -c ${COOKIE} -b ${COOKIE} -A "${BROWSER}" -H "DNT: 1" -H "Con
|
|||||||
-H "Referer: https://alexa.${AMAZON}/spa/index.html" -H "Origin: https://alexa.${AMAZON}"\
|
-H "Referer: https://alexa.${AMAZON}/spa/index.html" -H "Origin: https://alexa.${AMAZON}"\
|
||||||
https://${ALEXA}/api/language > /dev/null
|
https://${ALEXA}/api/language > /dev/null
|
||||||
|
|
||||||
if [ -z "$(grep "\.${AMAZON}.*\scsrf" ${COOKIE})" ] ; then
|
if [ -z "$(grep -E "\.${AMAZON}.*\scsrf" ${COOKIE})" ] ; then
|
||||||
echo "trying to get CSRF from handlebars"
|
echo "trying to get CSRF from handlebars"
|
||||||
${CURL} ${OPTS} -s -c ${COOKIE} -b ${COOKIE} -A "${BROWSER}" -H "DNT: 1" -H "Connection: keep-alive" -L\
|
${CURL} ${OPTS} -s -c ${COOKIE} -b ${COOKIE} -A "${BROWSER}" -H "DNT: 1" -H "Connection: keep-alive" -L\
|
||||||
-H "Referer: https://alexa.${AMAZON}/spa/index.html" -H "Origin: https://alexa.${AMAZON}"\
|
-H "Referer: https://alexa.${AMAZON}/spa/index.html" -H "Origin: https://alexa.${AMAZON}"\
|
||||||
https://${ALEXA}/templates/oobe/d-device-pick.handlebars > /dev/null
|
https://${ALEXA}/templates/oobe/d-device-pick.handlebars > /dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$(grep "\.${AMAZON}.*\scsrf" ${COOKIE})" ] ; then
|
if [ -z "$(grep -E "\.${AMAZON}.*\scsrf" ${COOKIE})" ] ; then
|
||||||
echo "trying to get CSRF from devices-v2"
|
echo "trying to get CSRF from devices-v2"
|
||||||
${CURL} ${OPTS} -s -c ${COOKIE} -b ${COOKIE} -A "${BROWSER}" -H "DNT: 1" -H "Connection: keep-alive" -L\
|
${CURL} ${OPTS} -s -c ${COOKIE} -b ${COOKIE} -A "${BROWSER}" -H "DNT: 1" -H "Connection: keep-alive" -L\
|
||||||
-H "Referer: https://alexa.${AMAZON}/spa/index.html" -H "Origin: https://alexa.${AMAZON}"\
|
-H "Referer: https://alexa.${AMAZON}/spa/index.html" -H "Origin: https://alexa.${AMAZON}"\
|
||||||
https://${ALEXA}/api/devices-v2/device?cached=false > /dev/null
|
https://${ALEXA}/api/devices-v2/device?cached=false > /dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$(grep "\.${AMAZON}.*\scsrf" ${COOKIE})" ] ; then
|
if [ -z "$(grep -E "\.${AMAZON}.*\scsrf" ${COOKIE})" ] ; then
|
||||||
echo "ERROR: no CSRF cookie received"
|
echo "ERROR: no CSRF cookie received"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user