Skip to content

Instantly share code, notes, and snippets.

@sigma
Created August 23, 2010 11:18
Show Gist options
  • Save sigma/545271 to your computer and use it in GitHub Desktop.
Save sigma/545271 to your computer and use it in GitHub Desktop.
flexible proxy traversal
#!/bin/bash
target_ip=`gethostip -d $1`
function is_local() {
echo $1 | grep '\(10\.\|127\.\|172\.\)'
}
flag=`is_local "$target_ip"`
if [ -n "$flag" ]; then
exec socat STDIO TCP4:$1:$2
else
exec socat STDIO PROXY:proxy.eng.vmware.com:$1:$2,proxyport=3128
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment