wssocks.sh 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/bin/bash
  2. # menu_plugin
  3. PLUGIN_NAME="wssocks"
  4. PLUGIN_FUNCTION="Start a wssocks connection"
  5. PLUGIN_DESCRIPTION="Allows you to connect to and use wssocks proxies - socks5 over websockets instead of traditional socks5 TCP connections (which could be blocked)"
  6. PLUGIN_AUTHOR="genshen, rainestorme"
  7. PLUGIN_VERSION=10
  8. doas() {
  9. ssh -t -p 1337 -i /rootkey -oStrictHostKeyChecking=no root@127.0.0.1 "$@"
  10. }
  11. clear
  12. echo "This plugin is a work-in-progress. Don't use this in production (or for anything critical)."
  13. pushd /tmp
  14. echo "Enter the wss:// or ws:// url to a wssocks proxy, or leave this field blank to use a hosted one (on replit, check the status here: https://10cf60a3-1599-4cc6-a7b5-db06769a323e.id.repl.co/status/)"
  15. read -p ' > ' wssocks_host
  16. if [ -z "$wssocks_host" ]; then
  17. wssocks_host="wss://10cf60a3-1599-4cc6-a7b5-db06769a323e.id.repl.co"
  18. fi
  19. echo "Checking architecture..."
  20. architecture=""
  21. case $(uname -m) in
  22. x86_64) architecture="amd64" ;;
  23. arm) dpkg --print-architecture | grep -q "arm64" && architecture="arm64" || architecture="arm" ;;
  24. *) echo "Sorry, your architecture is not supported by wssocks."; exit ;;
  25. esac
  26. echo "Updating wssocks..."
  27. filename="wssocks-linux-$architecture"
  28. doas "pushd /root
  29. echo 'Cleaning up...'
  30. rm -f $filename
  31. echo 'Downloading...'
  32. curl -LOk https://github.com/genshen/wssocks/releases/download/v0.5.0/$filename
  33. echo 'Chmod-ing...'
  34. chmod +x $filename
  35. echo 'Done!'
  36. clear
  37. echo 'Version info:'
  38. ./$filename version
  39. echo 'Starting wssocks client...'
  40. ./$filename client --addr :1080 --remote $wssocks_host --http
  41. read -p 'Press enter to exit.'
  42. popd
  43. exit"
  44. popd