http.sh/src/response/proxy.sh

29 lines
873 B
Bash
Executable File
Raw Blame History

#!/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]}")")")"
if [[ $(grep -Poh "${cfg[proxy_url]}" <<< "$url") == '' ]]; then
exit 1
fi
host="$(sed -E 's@http(s|)://@@;s@/.*@@' <<< "$url")"
headers="$(tr '\r' '\n' <<< "${r[req_headers]}")"
headers+=$'\n'
while read line; do
if [[ "$line" == "GET"* ]]; then
if [[ "$url" == *"$host" ]]; then
echo "GET / HTTP/1.1"
else
echo "GET /$(sed -E 's@http(s|)://@@;s@/@<40><>Lun4_iS_CuTe<54>@;s@.*<2A><>Lun4_iS_CuTe<54>@@' <<< "$url") HTTP/1.1"
fi
elif [[ "$line" == *"Host"* ]]; then
echo "Host: $url" | sed -E 's@http(s|)://@@;s@/.*@@'
else
echo "$line"
fi
done <<< "$headers" | if [[ "$url" == "https"* ]]; then
nc $host 443 --ssl -C -i 0.1 --no-shutdown
else
nc $host 80 -C -i 0.1 --no-shutdown
fi