SHARE
TWEET

Untitled

a guest Dec 30th, 2018 166 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/sh
  2. # /usr/local/bin/ptunnel_client
  3.  
  4. PTUNNEL_PROXY_SERVER="123.234.123.234"
  5. PTUNNEL_PROXY_SERVER_SSH_PORT="22"
  6. PTUNNEL_PROXY_SERVER_SSH_USER="icydoge"
  7. PTUNNEL_PASSWORD="SomePassword"
  8. LOCAL_INTERFACE="en0" # usually eth0 on Linux distributions, en0 on macOS
  9. LOCAL_FORWARD_PORT="8000"
  10. LOCAL_SOCKS5_PORT="1080"
  11.  
  12. echo "ptunnel requires sudo to run, it will drop uid/pid to an unprivileged user as soon as possible."
  13. sudo ptunnel -p ${PTUNNEL_PROXY_SERVER} -lp ${LOCAL_FORWARD_PORT} -da ${PTUNNEL_PROXY_SERVER} \
  14.  -dp ${PTUNNEL_PROXY_SERVER_SSH_PORT} -c ${LOCAL_INTERFACE} \
  15.  -setuid nobody -setgid nobody -x ${PTUNNEL_PASSWORD} -daemon /tmp/ptunnel -syslog
  16. echo ""
  17.  
  18. echo "ptunnel should now be running if there is no SSH error below. Set application network proxy\
  19.  to 127.0.0.1:${LOCAL_SOCKS5_PORT} to tunnel application traffic through ptunnel"
  20. echo "Press [ctrl+c] to exit the proxied shell"
  21. echo ""
  22.  
  23. ssh ${PTUNNEL_PROXY_SERVER_SSH_USER}@127.0.0.1 -p ${LOCAL_FORWARD_PORT} -D ${LOCAL_SOCKS5_PORT} -N
  24. read -p "Press [Enter] to terminate the still-running ptunnel"
  25.  
  26. echo ""
  27. echo "Requires sudo to kill the running ptunnel daemon."
  28. sudo killall ptunnel
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top