30 lines
970 B
Bash
30 lines
970 B
Bash
#!/bin/sh
|
|
|
|
urlencode() {
|
|
ENCODEDURL="$(curl -Gs -w %{url_effective} --data-urlencode @- ./ ||: )"
|
|
printf '%s' "$ENCODEDURL" | sed 's/%0[aA]$//;s/^.*[?]//'
|
|
}
|
|
|
|
get_asp_var() {
|
|
i=0
|
|
for VAR in __VIEWSTATE __VIEWSTATEGENERATOR __EVENTVALIDATION ; do
|
|
VAL="$(printf '%s' "$RESPONSE" | grep "id=\"$VAR\"" | cut -d '"' -f 8 | urlencode)"
|
|
[ "$i" != 0 ] && printf '&'
|
|
printf '%s=%s' "$VAR" "$VAL"
|
|
i=+1
|
|
done
|
|
}
|
|
|
|
download_iso() {
|
|
hiddenISO="$1" SN="$2"
|
|
URL="https://soportefirmadigital.com/sfdj/dl.aspx"
|
|
RESPONSE="$(curl -s --compressed "$URL" -o -)"
|
|
ASP_VARS="$(get_asp_var)"
|
|
|
|
curl -s --compressed "$URL" --data-raw "$ASP_VARS" \
|
|
--data-raw "__EVENTTARGET=ctl00%24certContents%24LinkButton3" \
|
|
--data-raw "ctl00%24certContents%24hiddenISO=$hiddenISO" \
|
|
--data-raw "ctl00%24certContents%24txtSerialNumber=$SN" \
|
|
--data-raw "ctl00%24certContents%24chkConfirmo=on" \
|
|
-o -
|
|
}
|