http.sh/src/response/proxy.sh

23 lines
830 B
Bash
Raw Normal View History

2021-06-01 21:14:03 +02:00
#!/bin/bash
url="$(url_decode "$(url_decode "$(sed -E 's/\?/<2F><>Lun4_iS_CuTe<54>/;s/^(.*)<29><>Lun4_iS_CuTe<54>//;s/'"${cfg[proxy_param]}"'=//g' <<< "${r[url]}")")")"
2021-06-01 21:14:03 +02:00
if [[ $(grep -Poh "${cfg[proxy_url]}" <<< "$url") == '' ]]; then
exit 1
fi
host="$(sed -E 's@http(s|)://@@;s@/.*@@' <<< "$url")"
2021-06-01 23:48:02 +02:00
proxy_url="$(sed -E 's/\?.*//g' <<< "${r[url]}")"
2021-06-01 21:14:03 +02:00
headers="$(tr '\r' '\n' <<< "${r[req_headers]}")"
headers+=$'\n'
2021-06-02 00:19:14 +02:00
#params=()
2021-06-01 21:14:03 +02:00
while read line; do
if [[ "$line" != "GET"* && "$line" != "Host:"* && "$line" != '' ]]; then
2021-06-02 00:19:14 +02:00
args+=('-H')
args+=("$line")
2021-06-01 21:14:03 +02:00
fi
done <<< "$headers"
2021-06-02 00:19:14 +02:00
curl --http1.1 "$url" "${args[@]}" -D /dev/stdout | grep -aiv "Transfer-Encoding: chunked" | sed -E '/Location/s/\?/%3f/g;/Location/s/\&/%26/g;/Location/s/\:/%3a/g;/Location/s@/@%2f@g;s@Location%3a @Location: '"$proxy_url"'?'"${cfg[proxy_param]}"'=@'