Created
March 4, 2020 16:04
-
-
Save Eeko/8c0ef278f367a76cbea2314dce11218e to your computer and use it in GitHub Desktop.
Small bash-script for monitoring the status of free times for Dublin Immigration Registration appointment system. Fetches the CSRF-tokens from the form and uses it to query for free times every 30 seconds from the page. Requires restart every once in a while since the CSRF-tokens do expire for the site.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SITECONTENT=$(curl https://burghquayregistrationoffice.inis.gov.ie/Website/AMSREG/AMSRegWeb.nsf/AppSelect?OpenForm) | |
K=$(echo $SITECONTENT|egrep -o '<input id="k" type="hidden" value="\w+"'|cut -c36-67) | |
P=$(echo $SITECONTENT|egrep -o '<input id="p" type="hidden" value="\w+"'|cut -c36-67) | |
echo "P=$P K=$K" | |
#watch -n10 "curl 'https://burghquayregistrationoffice.inis.gov.ie/Website/AMSREG/AMSRegWeb.nsf/(getApps4DTAvailability)?readform&&cat=All&sbcat=All&typ=Renewal&k=$K&p=$P' -H 'Connection: keep-alive' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Sec-Fetch-Dest: empty' -H 'X-Requested-With: XMLHttpRequest' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36' -H 'Sec-Fetch-Site: same-origin' -H 'Sec-Fetch-Mode: cors' -H 'Referer: https://burghquayregistrationoffice.inis.gov.ie/Website/AMSREG/AMSRegWeb.nsf/AppSelect?OpenForm' --compressed" | |
watch -n30 "curl 'https://burghquayregistrationoffice.inis.gov.ie/Website/AMSREG/AMSRegWeb.nsf/(getAppsNear)?readform&&cat=All&sbcat=All&typ=Renewal&k=$K&p=$P' -H 'Connection: keep-alive' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Sec-Fetch-Dest: empty' -H 'X-Requested-With: XMLHttpRequest' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36' -H 'Sec-Fetch-Site: same-origin' -H 'Sec-Fetch-Mode: cors' -H 'Referer: https://burghquayregistrationoffice.inis.gov.ie/Website/AMSREG/AMSRegWeb.nsf/AppSelect?OpenForm' --compressed" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment