Skip to content

Commit

Permalink
Merge pull request #92 from Ptechgithub/master
Browse files Browse the repository at this point in the history
Added yum and dnf
  • Loading branch information
radkesvat authored Sep 21, 2023
2 parents 0d8cc1b + edd5153 commit 38ae837
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 16 deletions.
55 changes: 40 additions & 15 deletions FtTunnel.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,44 @@
#!/bin/bash

# Function to check if wget is installed, and install it if not
check_dependencies() {
if ! command -v wget &> /dev/null; then
echo "wget is not installed. Installing..."
sudo apt-get install wget
root_access() {
# Check if the script is running as root
if [ "$EUID" -ne 0 ]; then
echo "This script requires root access. please run as root."
exit 1
fi
}

detect_distribution() {
# Detect the Linux distribution
local supported_distributions=("ubuntu" "debian" "centos" "fedora")

if ! command -v lsof &> /dev/null; then
echo "lsof is not installed. Installing..."
sudo apt-get install lsof
if [ -f /etc/os-release ]; then
source /etc/os-release
if [[ "${ID}" = "ubuntu" || "${ID}" = "debian" || "${ID}" = "centos" || "${ID}" = "fedora" ]]; then
package_manager="apt-get"
[ "${ID}" = "centos" ] && package_manager="yum"
[ "${ID}" = "fedora" ] && package_manager="dnf"
else
echo "Unsupported distribution!"
exit 1
fi
else
echo "Unsupported distribution!"
exit 1
fi
}

check_dependencies() {
detect_distribution

local dependencies=("wget" "lsof" "iptables" "unzip" "git" "curl" "tar")

if ! command -v iptables &> /dev/null; then
echo "iptables is not installed. Installing..."
sudo apt-get install iptables
fi
for dep in "${dependencies[@]}"; do
if ! command -v "${dep}" &> /dev/null; then
echo "${dep} is not installed. Installing..."
sudo "${package_manager}" install "${dep}" -y
fi
done
}

#Check installed service
Expand Down Expand Up @@ -52,7 +75,7 @@ configure_arguments2() {
elif [ "$server_choice" == "1" ]; then
read -p "Please Enter (Kharej IP) : " server_ip
read -p "Please Enter Password (Please choose the same password on both servers): " password
arguments="--tunnel --lport:443 --toip:$server_ip --toport:443 --sni:$sni --password:$password --terminate:24"
arguments="--tunnel --lport:$port --toip:$server_ip --toport:443 --sni:$sni --password:$password --terminate:24"
else
echo "Invalid choice. Please enter '1' or '2'."
exit 1
Expand Down Expand Up @@ -82,6 +105,7 @@ configure_arguments() {

# Function to handle installation single port
install_single() {
root_access
check_dependencies
check_installed2
install_ftt
Expand Down Expand Up @@ -132,6 +156,7 @@ uninstall_single() {

# Function to handle installation
install_multi() {
root_access
check_dependencies
check_installed
install_ftt
Expand Down Expand Up @@ -181,7 +206,7 @@ uninstall_multi() {
}

update_services() {
# Get the current installed version of RTT
# Get the current installed version of FTT
installed_version=$(./FTT -v 2>&1 | grep -o '"[0-9.]*"')

# Fetch the latest version from GitHub releases
Expand Down Expand Up @@ -259,4 +284,4 @@ case $choice in
*)
echo "Invalid choice. Please try again."
;;
esac
esac
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@


# مقدمه کلی
## [اموزش در کانال IR_TECH](https://youtu.be/uemg9x6ZRgY)


با تشکر از دوستمون AminiYT بابت [آموزش ویدویی](https://youtu.be/Uyidjirkis0) ؛ سگارو، وحید عزیز و تمام دوستانی که برای دسترسی آزاد به اینترنت زحمت میکشند

Expand Down Expand Up @@ -45,7 +47,7 @@ tls handshake رو با دامنه کاملا دلخواه تکمیل کنید

# روش اول ( نصب با اسکریپت ):
```
bash <(curl -fsSL https://raw.githubusercontent.com/Ptechgithub/FakeTlsTunnel/main/FtTunnel.sh)
bash <(curl -fsSL https://raw.githubusercontent.com/Ptechgithub/FakeTlsTunnel/master/FtTunnel.sh)
```

![2](https://raw.githubusercontent.com/Ptechgithub/configs/main/media/2.jpg)
Expand Down

0 comments on commit 38ae837

Please sign in to comment.