Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 94 additions & 2 deletions psiphon
Original file line number Diff line number Diff line change
@@ -1,3 +1,95 @@
#! /bin/bash
#!/bin/bash

/etc/psiphon/psiphon-tunnel-core-x86_64 -config /etc/psiphon/psiphon.config
# --- CONFIGURATION ---
HOST="127.0.0.1"
HTTP_PORT=8081
SOCKS_PORT=1081

# Color Definitions (Hex-style RGB)
CLR_ORANGE="\e[38;2;255;165;0m"
CLR_GREEN="\e[38;2;50;205;50m"
CLR_RED="\e[38;2;255;69;0m"
CLR_GREY="\e[38;2;150;150;150m"
CLR_RESET="\e[0m"
CLR_BOLD="\e[1m"

# --- PROXY FUNCTIONS ---
proxy_on() {
echo -e "${CLR_ORANGE}⛭ System:${CLR_RESET} ${CLR_GREY}Switching to Manual Proxy Settings…${CLR_RESET}"
gsettings set org.gnome.system.proxy mode 'manual'
gsettings set org.gnome.system.proxy.http host "$HOST"
gsettings set org.gnome.system.proxy.http port $HTTP_PORT
gsettings set org.gnome.system.proxy.https host "$HOST"
gsettings set org.gnome.system.proxy.https port $HTTP_PORT
gsettings set org.gnome.system.proxy.socks host "$HOST"
gsettings set org.gnome.system.proxy.socks port $SOCKS_PORT
}

proxy_off() {
# Move to a new line in case Ctrl+C was pressed
echo -e "------------------------------------------------------------"
echo -e "${CLR_ORANGE}⛭ System:${CLR_RESET} ${CLR_GREY}Restoring Automatic Network Settings…${CLR_RESET}"
gsettings set org.gnome.system.proxy mode 'none'
echo -e "${CLR_BOLD}${CLR_RED} ◼ Psiphon Session Terminated.${CLR_RESET}"
}

# Trap: Ensures proxy is turned off even if the script is closed abruptly
trap proxy_off EXIT

# --- YOUR GRADIENT ART ---
gradient_text() {
local text="$1"
local length=${#text}
local colors=(88 124 160 196)
local color_count=${#colors[@]}
for (( i=0; i<length; i++ )); do
local char="${text:i:1}"
if [[ "$char" == "P" ]]; then
printf "\e[1;38;5;250m%s" "$char"
continue
fi
local color_index=$(( i * (color_count-1) / (length-1) ))
local color_code=${colors[$color_index]}
printf "\e[38;5;%sm%s" "$color_code" "$char"
done
printf "\e[0m\n"
}

# --- RENDER UI ---
gradient_text " ..,;::::::;,.."
gradient_text " ..,::::::::::::::::::,.."
gradient_text " .,::::::::::::::::::::::::::,."
gradient_text " .,::::::::::::::::::::::::::::::::,."
gradient_text " ;:::::PPPPPPPPPPPPPPPPPPPPPPPPPPP::::;"
gradient_text " ':::::PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP::::: ⟶ Psiphon"
gradient_text " ,::::::PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP:::::; circumvention software"
gradient_text " ;::::;;;;;;,,,,,:PPPPPPPPPPPPPPPPPPPPP:::::::;"
gradient_text " ,::::;;;;;;;;;,,,PPPPPP,,'''''''PPPPPPP::::::::;"
gradient_text " :::;;;;;;;;;;;;;,PPPPPP,,,,,''''PPPPPPP:::::::::."
gradient_text ",:;;;;;;;;;;;;;;;;PPPPPP,,,,,,,''PPPPPPP:::::::::;"
gradient_text "::::;;;;;;;;;;;;;PPPPPPP,,,,,,,,,PPPPPP:::::::::::"
gradient_text "::::::;;;;;;;;;;;PPPPPPP:,,,,,,,,PPPPPP:::::::::::"
gradient_text ",:::::::;;;;;;;;;PPPPPP;;,,,,,,,PPPPPPP::::::::::;"
gradient_text ".:::::::::;;;;;;PPPPPPPPPPPPPPPPPPPPPPP::::::::::."
gradient_text " :::::::::::;;;;PPPPPPPPPPPPPPPPPPPPPP::::::::::: "
gradient_text " ::::::::::::;;PPPPPPPPPPPPPPPPPPPP::::::::::::"
gradient_text " :::::::::::::PPPPPP;;;;;;;;;;;;:::::::::::::"
gradient_text " :::::::::::PPPPPP;;;;;;;;;:::::::::::::::'"
gradient_text " .:::::::::PPPPPP;;;;;;::::::::::::::::.'"
gradient_text " ;:::::::PPPPPP::;;:::::::::::::::::'"
gradient_text " .::::::PPPPP:::::::::::::::::::. For configuration, see /etc/psiphon/psiphon.config."
gradient_text " ;:::::::::::::::::::::::"
gradient_text " .::::::::::::::."
gradient_text " .,::::::,."

# --- EXECUTION ---
# Validate sudo early so the password prompt doesn't break the UI flow
sudo -v

proxy_on

echo -e "${CLR_BOLD}${CLR_GREEN} ▶ PSIPHON IS ACTIVE${CLR_RESET} ${CLR_GREY}(Ctrl+C to disconnect)${CLR_RESET}"
echo -e "------------------------------------------------------------"

# Start the binary
sudo /etc/psiphon/psiphon-tunnel-core-x86_64 -config /etc/psiphon/psiphon.config