mirror of
https://github.com/novatiq/packages.git
synced 2026-07-30 23:33:06 +01:00
This can be helpful for example in hotels where you need to enter a new user/password combination every week. Signed-off-by: Johannes Rothe <mail@johannes-rothe.de>
22 lines
341 B
Bash
Executable File
22 lines
341 B
Bash
Executable File
#!/bin/sh
|
|
|
|
cmd="$(command -v curl)"
|
|
url="http://example.com/"
|
|
success_string="Thank you!"
|
|
|
|
if [ ! -x "${cmd}" ]
|
|
then
|
|
exit 1
|
|
fi
|
|
|
|
|
|
response="$("${cmd}" $url -d "password=$2&pwd=$2&username=$1" \
|
|
--header "Content-Type:application/x-www-form-urlencoded" -s)"
|
|
|
|
if echo "${response}" | grep -q "${success_string}";
|
|
then
|
|
exit 0
|
|
else
|
|
exit 2
|
|
fi
|