2016-11-20 14:34:48 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
host="$1"
|
|
|
|
port="$2"
|
2016-03-16 17:55:51 +01:00
|
|
|
|
2016-11-20 14:34:48 +01:00
|
|
|
if [ -z "$http_proxy" ]; then
|
|
|
|
nc "$host" "$port"
|
|
|
|
else
|
2016-11-20 18:34:53 +01:00
|
|
|
proxy=$(echo "$http_proxy" | sed 's/^https\?:\/\///' | sed 's/\/$//')
|
2016-11-20 14:34:48 +01:00
|
|
|
port=443 # Most won't want this
|
|
|
|
echo "$proxy" | grep '@'
|
|
|
|
if [ $? == 0 ]; then
|
|
|
|
user=$(echo $proxy | cut -d '@' -f 2)
|
|
|
|
proxy=$(echo $proxy | cut -d '@' -f 1)
|
|
|
|
proxytunnel -p $proxy -P $user -d $host:$port
|
|
|
|
else
|
|
|
|
proxytunnel -p $proxy -d $host:$port
|
|
|
|
fi
|
|
|
|
fi
|
2016-02-19 13:46:26 +01:00
|
|
|
|