Skip to content

Instantly share code, notes, and snippets.

@arsalanses
Created April 9, 2022 21:22
Show Gist options
  • Save arsalanses/30caeaa02e64b0f1d3414fe8657c6f37 to your computer and use it in GitHub Desktop.
Save arsalanses/30caeaa02e64b0f1d3414fe8657c6f37 to your computer and use it in GitHub Desktop.
A bash script to start HTop in background, and send Ngrok URL to a Telegram Bot automatically
#!/usr/bin/bash
# install tmux ttyd curl torsocks jq ngrok htop
tmux new -d -s ttyd './ttyd.x86_64 -p 8080 -m 1 -R htop'
tmux split-window -h
tmux send-keys "./ngrok-stable-linux-amd64/ngrok http 8080 -region=ap" C-m
sleep 3
TELEGRAM_TOKEN="" # fill here
TELEGRAM_ID="" # fill here
NGROK_URLS=$(curl -s http://127.0.0.1:4040/api/tunnels | jq '.tunnels[0].public_url')
torsocks curl -s --data chat_id="${TELEGRAM_ID}" --data-urlencode "text=${NGROK_URLS}" "https://api.telegram.org/bot${TELEGRAM_TOKEN}/sendMessage?parse_mode=HTML" > telegram.log &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment