krkr
2/25/2018 - 9:28 PM

impots.gouv.fr/simulateur's script

impots.gouv.fr/simulateur's script

#!/bin/bash -eu

main() {
	local year1=?
	local year2=?
	local child1=?
	local revenu1=?
	local revenu2=?

	local tmpfile=$(mktemp -t result-XXXXXXX.html)

	curl -s 'https://www3.impots.gouv.fr/simulateur/cgi-bin/calc-2018.cgi' \
		-H 'Origin: https://www3.impots.gouv.fr' \
		-H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.666.0 Safari/537.36' \
		-H 'Content-Type: application/x-www-form-urlencoded' \
		-H 'Referer: https://www3.impots.gouv.fr/simulateur/calcul_impot/2018/simplifie/index.htm' \
		--data 'simplifie=1&pre_situation_famille=O&pre_situation_residence=M&0DA='$year1'&0DB='$year2'&0CF='$child1'&1AJ='$revenu1'&1BJ='$revenu2 \
		--compressed > $tmpfile

	nohup sensible-browser $tmpfile 2> /dev/null &
}

main