Created
August 23, 2010 11:18
-
-
Save sigma/545271 to your computer and use it in GitHub Desktop.
flexible proxy traversal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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