Facebook
From Iikkkkkk, 2 Months ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 194
  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. sudo npm install -g http-server
  21.  
  22. # Instalar o localtunnel
  23. sudo npm install -g localtunnel
  24.  
  25. # Iniciar o servidor aria2c
  26. aria2c --enable-rpc \
  27.        --rpc-listen-port=6800 \
  28.        -D "fr" \
  29.        -d {OUTPUT_DIR} \
  30.        -j 20 \
  31.        -c \
  32.        $(if [ res.ok ]; then echo "--bt-tracker=${res.text}"; fi) \
  33.        --bt-request-peer-speed-limit=0 \
  34.        --bt-max-peers=0 \
  35.        --seed-ratio=0.0 \
  36.        --max-connection-per-server=10 \
  37.        --min-split-size=10M \
  38.        --follow-torrent=mem \
  39.        --disable-ipv6=true \
  40.        --user-agent=Transmission/2.77 \
  41.        --peer-agent=Transmission/2.77 \
  42.        --peer-id-prefix=-TR2770- \
  43.        --split=20
  44.        
  45.  
  46. # Aguardar alguns segundos para garantir que o servidor aria2c tenha iniciado completamente
  47. sleep 5
  48.  
  49. # Obter o hostname do sistema
  50. HOST=$(hostname)
  51.  
  52. # Porta para WebSocket
  53. PORT="80"
  54.  
  55. # Caminho para o arquivo index.html do AriaNg
  56. INDEX_FILE="ariang/index.html"
  57.  
  58. # Atualizar as configurações no arquivo index.html do AriaNg
  59. sed -i "s/rpcHost:\"[^\"]\+./rpcHost:\"$HOST\"/" $INDEX_FILE
  60. sed -i "s/protocol:\"\\w+./protocol:\"ws\"/" $INDEX_FILE
  61. sed -i "s/rpcPort:\"\\d+./rpcPort:\"$PORT\"/" $INDEX_FILE
  62.  
  63. # Iniciar o http-server para servir o AriaNg
  64. http-server /content/ariang --port 8080 &
  65.  
  66. # Iniciar o LocalTunnel para encaminhar as solicitações HTTP
  67. lt --port 8080
  68.