Last active
April 27, 2025 14:58
-
-
Save vietkute02/df25baa6bde00e351f1c3b3622c568bb to your computer and use it in GitHub Desktop.
dropbear-idx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Kiểm tra xem cả password và token đã được cung cấp chưa | |
if [ -z "$1" ] || [ -z "$2" ]; then | |
echo "Lỗi: Vui lòng cung cấp mật khẩu và ngrok token làm đối số." | |
echo "Ví dụ: curl ... | bash <mật_khẩu> <ngrok_token>" | |
exit 1 | |
fi | |
PASSWORD="$1" | |
NGROK_TOKEN="$2" | |
# Cập nhật danh sách gói | |
sudo apt update | |
# Tải telnet, dropbear và screen | |
sudo apt install -y telnet dropbear screen | |
curl -LsSf https://astral.sh/uv/install.sh | sh | |
# Chuyển đổi port dropbear thành 2222 và bỏ comment | |
sudo sed -i 's/^#DROPBEAR_PORT=22/DROPBEAR_PORT=2222/' /etc/default/dropbear | |
# Khởi chạy lại dropbear để áp dụng thay đổi | |
sudo systemctl restart dropbear | |
# Đổi mật khẩu cho user hiện tại bằng sudo | |
echo "$(whoami):$PASSWORD" | sudo chpasswd | |
echo "Đã đổi mật khẩu cho user $(whoami) thành: $PASSWORD" | |
# Cài đặt ngrok (nếu chưa có) | |
if ! command -v ngrok &> /dev/null; then | |
curl -sSL https://ngrok-agent.s3.amazonaws.com/ngrok.asc | sudo tee /etc/apt/trusted.gpg.d/ngrok.asc >/dev/null | |
echo "deb https://ngrok-agent.s3.amazonaws.com buster main" | sudo tee /etc/apt/sources.list.d/ngrok.list | |
sudo apt update | |
sudo apt install -y ngrok | |
fi | |
# Thiết lập cấu hình ngrok | |
ngrok config add-authtoken "$NGROK_TOKEN" | |
ngrok tcp localhost:2222 | |
echo "Đã cài đặt, cấu hình ngrok và chạy trên cổng tcp 2222 trong phiên screen 'ngrok_tcp'." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment