Facebook
From Kkkkkkkkk, 2 Months ago, written in Bash.
Embed
Download Paste or View Raw
Hits: 220
  1. #!/bin/bash
  2.  
  3. # Instalar o aria2
  4. sudo apt-get update
  5. sudo apt-get install aria2 -y
  6.  
  7. # Instalar o Node.js (se necessário)
  8. # sudo apt-get install curl -y
  9. # curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
  10. # sudo apt-get install nodejs -y
  11.  
  12. # Instalar o AriaNg
  13. mkdir ariang
  14. cd ariang
  15. wget https://github.com/mayswind/AriaNg/releases/download/1.2.2/AriaNg-1.2.2.zip
  16. unzip AriaNg-1.2.2.zip
  17. cd ..
  18.  
  19. # Instalar o http-server
  20. npm install -g http-server
  21.  
  22. # Instalar o localtunnel
  23. npm install -g localtunnel
  24.  
  25. # Iniciar o servidor aria2c
  26. aria2c --enable-rpc --rpc-listen-port=6800 -D "fr" -j 20 -c --bt-request-peer-speed-limit=0 --bt-max-peers=0 --seed-ratio=0.0 --max-connection-per-server=10 --min-split-size=10M --follow-torrent=mem --disable-ipv6=true --user-agent=Transmission/2.77 --peer-agent=Transmission/2.77 --peer-id-prefix=-TR2770- --split=20
  27.  
  28.  
  29. # Aguardar alguns segundos para garantir que o servidor aria2c tenha iniciado completamente
  30. sleep 5
  31.  
  32. # Obter o hostname do sistema
  33. HOST=$(hostname)
  34.  
  35. # Porta para WebSocket
  36. PORT="80"
  37.  
  38. # Caminho para o arquivo index.html do AriaNg
  39. INDEX_FILE="ariang/index.html"
  40.  
  41. # Atualizar as configurações no arquivo index.html do AriaNg
  42. sed -i "s/rpcHost:\"[^\"]\+./rpcHost:\"$HOST\"/" $INDEX_FILE
  43. sed -i "s/protocol:\"\\w+./protocol:\"ws\"/" $INDEX_FILE
  44. sed -i "s/rpcPort:\"\\d+./rpcPort:\"$PORT\"/" $INDEX_FILE
  45.  
  46. # Iniciar o http-server para servir o AriaNg
  47. cd ariang && http-server --port 6800 &
  48.  
  49. # Iniciar o LocalTunnel para encaminhar as solicitações HTTP
  50. lt --port 6800
  51.