Jump to content
Not connected, Your IP: 3.95.231.212
Sign in to follow this  
nwlyoc

Suggestions for improvement of the Eddie CLI version

Recommended Posts

Hello. I've been very happy with Air so far, thank you for the great service!

I have some improvement suggestions/requests for the CLI version of the Eddie client though. I prefer to not run the GUI version for everyday use since it uses up more resources (not crazy much, but mono has 4-5% CPU usage while the CLI version always uses <1%). But what keeps me from using it is that there seems to be no way to disconnect from a server or reconnect to another without exiting Eddie and thus disabling the network lock. It would be great to make the client more interactive as in being able to disconnect from a server and have Eddie be in "idle" with still having the network lock enabled and, as another suggestion, be able to connect to a specific server from there again (rather than the recommended one). Maybe even implement a possibility to request an interactive server list like the ProtonVPN CLI client has it.

Also as a minor improvement I would suggest that the CLI client defaults to loading the default profile from ~/.airvpn and not the one in the root folder since the first one is where the login data is stored.

Thank you!

Share this post


Link to post

Hi. I do also prefer to use the CLI version and would like it to be a little more interactive.

Let me suggest you a couple of workarounds that may help you get something close to what you want, at least if you are running a linux like system.

 

being able to disconnect from a server and have Eddie be in "idle" with still having the network lock enabled

In case you are running a linux system eddie uses iptables to lock the network. For this process, it backs up your iptables rules at the moment of launching eddie and restores them back when closing it. Being this so, you can set some rules of your own before starting eddie so you should be protected any time before running it or after closing it, including while you change from one server to another. If you use other operating system you may be able to find some similar solution.

 

Maybe even implement a possibility to request an interactive server list

 

You should have a look at airvpn's API.

https://airvpn.org/faq/api/

 

You can get your own API key in your user area. As a starting point you can make a file with the next code and replace <YOUR-API-KEY> with your own API key. (airvpn_server_status.sh)

 

#!/bin/bash

API_KEY="<YOUR_API_KEY>"

SERVICE_NAME="status"
FORMAT="json"

URL="https://airvpn.org/api/"
ARGS="{
\"format\":\"$FORMAT\",
\"service\":\"$SERVICE_NAME\",
\"key\":\"$API_KEY\"
}"

curl -d "$ARGS" -H "Content-Type: application/json" -X POST "$URL"


Give it execution permissions:

chmod u+x airvpn_server_status.sh

This scripts outputs plenty of information on airvpn's servers and their current status formatted in json. You can explore the other available formats an the info available in the link above.

 

Hope this helps.

 

Edit:

API key is not really needed for getting this info in the status of the servers but it is for some other info on your current connections and so.

Share this post


Link to post

Thank you for the suggestions! I am running Linux, forgot to mention that. Configuring iptables to lock the network by default seems like a good idea. The API is new to me, I will look into that and try to build a little script, thanks!

Share this post


Link to post

Just for the sake of sharing, this weekend I found some time to play around and made this script, you can have a look and use/modify it if you find it useful.

 

The script downloads and shows the list of airvpn servers for the user to chose one to connect to interactively.

The server list is downloaded with curl to /tmp/airvpn_server_list.txt if it doesn't exist or if forced with the -u commandline argument. In my system /tmp is wiped on each reboot so the server list will be updated at least once after a boot.

Then the servers are offered through dmenu for the user to select one. dmenu works great here as you can start writing any part of the server's, the country's or the city's name and the options will be filtered. You can even write a part of a country name and separated with space write part of some other part of the line and the list will reduce as well.

Finally select one of the lines and eddie-ui -cli will be called to connect to the selected server (sudo is used so will ask for credentials).

 

You will need to install the mentioned tools on your system (or change the script to your convenience):

curl

dmenu

sudo (or remove it and run the script as root)

 

Here the code of the script:

#!/bin/bash

TMP_SERVER_LIST_FILE="/tmp/airvpn_server_list.txt"

show_help()
{
    echo "Usage:"; cat <<EOF |column -ts:
    [-u]: Force server list update.
    [-h]: Show this help.
EOF
}

update_server_list()
{
declare URL="https://airvpn.org/api/"
declare ARGS="{
\"format\":\"text\",
\"service\":\"status\"
}"
curl -d "$ARGS" -H "Content-Type: application/json" -X POST "$URL" > "$TMP_SERVER_LIST_FILE"
}

select_server()
{
SERVER=$(grep -e '^servers' "$TMP_SERVER_LIST_FILE" |grep \
    -e public_name \
    -e country_name \
    -e location \
    -e '.bw=' \
    -e '.bw_max=' \
    -e users |cut -d= -f2 |paste -d"|" - - - - - - | \
    sed -e 's/\(^[^|]*\)|\([^|]*\)|\([^|]*\)|\([^|]*\)|\([^|]*\)|\([^|]*\)$/\1|\3|\2|\4\/\5 Mbit\/s|\6 users/' | column -ts"|" |dmenu -i -l 11)
}

declare -a OPTS

while getopts "uh" opt
do
    case $opt in
        u) CMD_UPDATE_SERVER_LIST=1;;
        h) show_help; exit 0;;
        \?) show_help; exit 1;;
    esac
done
shift $(($OPTIND-1))

if [ ! -f "$TMP_SERVER_LIST_FILE" -o -n "$CMD_UPDATE_SERVER_LIST" ]
then
    update_server_list
    echo "Downloaded server list to $TMP_SERVER_LIST_FILE"
fi

select_server

if [ -n "$SERVER" ] 
then
    sudo /usr/bin/eddie-ui -cli -netlock -connect -server="$(echo "$SERVER" |cut -d" " -f1)"
else
    echo "No server selected"
fi


Save it with any name, make it executable and just call it.

 

If you see you want your server list updated add -u to the call.

 

NOTE:

In a previous post I suggested you had some iptables rules blocking your connection when not connected to airvpn. If done so, the script wont be able to download the server list and you should change it so that the file will remain after a reboot (change its location). And maybe add the possibility to update that list without trying to connect to any server (add an exit 0 after the update).

 

Have fun!

Share this post


Link to post

Haha coincidentally I did the same thing and got into it maybe more than I should have, time investment wise... Thank you for sharing though! dmenu is a cool idea, the server list part was quite a mess to get together for me.

I'm no programmer, just learning this while doing, so this is probably far from elegant and "good practice", also planning to improve it, but here is what I got so far, it works:

 

It's a script that can be run to interface with the client in the background, it doesn't have to be open and eddie will be run invisibly. You can also get a server list (although not interactive yet), show some info about the current session and put a permanent default iptables network lock in place, applied through firewalld (because I'm on Fedora). The server list and user info (and also this website) is also available with the lock turned on. The script requires only curl, awk and eddie itself (and firewalld for the lock, but that can be adjusted to iptables directly), I tried to stay with system tools.

 

#!/bin/bash

API_KEY="<your key>"
FORMAT="text"
URL="https://airvpn.org/api/"
COLS=$( tput cols )
ROWS=$( tput lines )
HEADING1_1="This is a wrapping script for"
HEADING1_2="Eddie, the AirVPN client."
HEADING2_1="This script can be exited"
HEADING2_2="and re-entered without"
HEADING2_3="affecting a running connection."
# change default prompt for select command
PS3="Choose one of the options by selecting the corresponding number: "
# provide options as array
OPTIONS[0]="Connect to Recommended Server"
OPTIONS[1]="Connect to Specific Server"
OPTIONS[2]="Show List of Servers"
OPTIONS[3]="Refresh User Info"
OPTIONS[4]="Disconnect"
OPTIONS[5]="Toggle Default Network Lock"
OPTIONS[6]="Quit"

function get_list {
	SERVICE_NAME="status"
	ARGS="{
	\"format\":\"$FORMAT\",
	\"service\":\"$SERVICE_NAME\"
	}"
	# pipe server status list to awk, filter out unnecessary stuff,
	# combine lines that relate to same server (and country, continent, and planet) into single lines which are saved as array,
	# loop through arrays to format info,
	# sort each array and print as section,
	# align columns with column,
	# pipe to less for better readability
	timeout --signal=SIGINT 10 curl -d "$ARGS" -X POST "$URL" | \
	awk -F '[.]' \
		'BEGIN{OFS=";"; print "Server List"} \
		!/^routing/ && !/ip_/ && !/country_code/ {c=$1 OFS $2; \
		if ($1 ~ /servers/ && c in servers) servers[c]=servers[c] OFS $3; \
		else if ($1 ~ /servers/) servers[c]=$3; \
		else if ($1 ~ /countries/ && c in countries) countries[c]=countries[c] OFS $3; \
		else if ($1 ~ /countries/) countries[c]=$3; \
		else if ($1 ~ /continents/ && c in continents) continents[c]=continents[c] OFS $3; \
		else if ($1 ~ /continents/) continents[c]=$3; \
		else if ($1 ~ /planets/ && c in planets) planets[c]=planets[c] OFS $3; \
		else if ($1 ~ /planets/) planets[c]=$3; \
		for (k in servers) gsub(/;bw_max=/, "/", servers[k]); \
		for (k in servers) gsub(/;.*=/, ":", servers[k]); \
		for (k in servers) gsub(/^.*=/, "", servers[k]); \
		for (k in countries) gsub(/;bw_max=/, "/", countries[k]); \
		for (k in countries) gsub(/;.*=/, ":", countries[k]); \
		for (k in countries) gsub(/^.*=/, "", countries[k]); \
		for (k in continents) gsub(/;bw_max=/, "/", continents[k]); \
		for (k in continents) gsub(/;.*=/, ":", continents[k]); \
		for (k in continents) gsub(/^.*=/, "", continents[k]); \
		for (k in planets) gsub(/;bw_max=/, "/", planets[k]); \
		for (k in planets) gsub(/;.*=/, ":", planets[k]); \
		for (k in planets) gsub(/^.*=/, "", planets[k])} \
		END{ \
		print "\n:\nServers\n:\nName:Country:Location:Continent:Bandwidth:Users:Current Load:Health"; \
			n=asorti(servers, servers_sorted, "@val_num_asc"); \
			for (i=1; i<=n; i++) print servers[servers_sorted[i]]; \
		print "\n:\nCountries\n:\nCountry:Best Server:Bandwidth:Users:Servers:Current Load:Health"; \
			n=asorti(countries, countries_sorted, "@val_num_asc"); \
			for (i=1; i<=n; i++) print countries[countries_sorted[i]]; \
		print "\n:\nContinents\n:\nContinent:Best Server:Bandwidth:Users:Servers:Current Load:Health"; \
			n=asorti(continents, continents_sorted, "@val_num_asc"); \
			for (i=1; i<=n; i++) print continents[continents_sorted[i]]; \
		print "\n:\nAll\n:\nPlanet:Best Server:Bandwidth:Users:Servers:Current Load:Health"; \
			n=asorti(planets, planets_sorted, "@val_num_asc"); \
			for (i=1; i<=n; i++) print planets[planets_sorted[i]]}' | column -t -s ':' | less
}

function get_userinfo {
	tput cup 25 0
	SERVICE_NAME="userinfo"
	ARGS="{
	\"format\":\"$FORMAT\",
	\"service\":\"$SERVICE_NAME\",
	\"key\":\"$API_KEY\"
	}"
	# filter specific lines, save values (after "=") to variables after protecting whitespace
	read U_LOGIN U_EXP U_CONNECTED U_SERVER_NAME U_SERVER_COUNTRY U_SERVER_LOCATION U_SERVER_BW <<< $( \
	timeout --signal=SIGINT 10 curl -d "$ARGS" -X POST "$URL" | \
	awk -F '[=]' \
		'BEGIN{ORS=";"} \
		/^user.login|^user.expiration_days|^user.connected|^connection.server_name|^connection.server_country=|^connection.server_location|^connection.server_bw/ \
		{print $2}' | \
	sed 's/\ /\\\ /g' | sed 's/;/\ /g' \
	)
	if [ "$U_CONNECTED" = "1" ]
	then
		U_CONNECTED="connected"
		U_SERVER_FULL="$U_SERVER_NAME ($U_SERVER_LOCATION, $U_SERVER_COUNTRY)"
	else
		U_CONNECTED="not connected"
		U_SERVER_FULL="--"
		U_SERVER_BW="--"
	fi
}

function disconnect_server {
	# check for running instance of eddie
	pgrep -f mono.*eddie-ui &> /dev/zero
	if [ $? = 0 ]
	then
		U_CONNECTED="disconnecting..."
		print_heading
		# kill process and wait for confirmation from process output
		sudo pkill -f mono.*eddie-ui
		if [ -p "/tmp/.eddie_fifo" ]
		then
			timeout --signal=SIGINT 60 grep -q -m 1 "Shutdown complete" "/tmp/.eddie_fifo"
		else
			# in case connection was started without this script
			sleep 5
		fi
		if [ $? = 0 ]
		then
			# give some time to completely close process, without sleep it's too early for new connection
			sleep 3
			pgrep -f mono.*eddie-ui &> /dev/zero
			if [ $? = 1 ]
			then
				KILLED="true"
			else
				KILLED="false"
			fi
		else
			KILLED="false"
		fi
	else
		KILLED="true"
	fi
}

function activate_lock {
	echo "Activating iptable rules:"
	#allow loopback
	sudo firewall-cmd --direct --permanent --add-rule ipv4 filter INPUT 0 -i lo -j ACCEPT
	sudo firewall-cmd --direct --permanent --add-rule ipv4 filter OUTPUT 0 -o lo -j ACCEPT
	
	#allow lan (out) and broadcasting/dhcp
	sudo firewall-cmd --direct --permanent --add-rule ipv4 filter OUTPUT 0 -s 192.168.0.0/16 -d 192.168.0.0/16 -j ACCEPT
	sudo firewall-cmd --direct --permanent --add-rule ipv4 filter INPUT 0 -s 255.255.255.255 -j ACCEPT
	sudo firewall-cmd --direct --permanent --add-rule ipv4 filter OUTPUT 0 -d 255.255.255.255 -j ACCEPT
	
	# allow tun device to communicate (so any VPN connection should be possible, also without Air)
	sudo firewall-cmd --direct --permanent --add-rule ipv4 filter FORWARD 0 -o tun+ -j ACCEPT
	sudo firewall-cmd --direct --permanent --add-rule ipv4 filter FORWARD 0 -i tun+ -j ACCEPT
	sudo firewall-cmd --direct --permanent --add-rule ipv4 filter OUTPUT 998 -o tun+ -j ACCEPT
	
	# optional masquerade rule (NAT/ports)
	#sudo firewall-cmd --direct --permanent --add-rule ipv4 nat POSTROUTING 0 -o tun+ -j MASQUERADE

	# allow ipv4 only to airvpn.org for status update
	#	allow DNS query to resolve hostname (hex string reads "06 airvpn 03 org" - numbers are counting bits),
	#	restrict packet length to length of this specific request package (might change?) to avoid hijacking
	#	of query (very unlikely I guess, but who cares if we're already being paranoid for the fun of it),
	#	whitelist destination IP for TCP handshake
	sudo firewall-cmd --direct --permanent --add-rule ipv4 filter OUTPUT 1 -p udp --dport 53 -m string --hex-string '|06 61697276706e 03 6f7267|' --algo bm -m length --length 0:126 -m recent --set -j ACCEPT
	sudo firewall-cmd --direct --permanent --add-rule ipv4 filter OUTPUT 1 -p tcp --dport 53 -m string --hex-string '|06 61697276706e 03 6f7267|' --algo bm -m length --length 0:126 -m recent --set -j ACCEPT
	#	allow SYN request to whitelisted IP to initiate handshake, remove IP from whitelist
	sudo firewall-cmd --direct --permanent --add-rule ipv4 filter OUTPUT 1 -p tcp --syn --dport 53 -m recent --remove -j ACCEPT
	#	allow outgoing connection to Air's IP
	sudo firewall-cmd --direct --permanent --add-rule ipv4 filter OUTPUT 1 -d 5.196.64.52 -j ACCEPT
	#	allow communication
	sudo firewall-cmd --direct --permanent --add-rule ipv4 filter INPUT 1 -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
	
	# drop outgoing ipv4 (if not specifically allowed by other rules)
	sudo firewall-cmd --direct --permanent --add-rule ipv4 filter OUTPUT 999 -j DROP
	# block incoming ipv4
	sudo firewall-cmd --direct --permanent --add-rule ipv4 filter INPUT 999 -j DROP
	
	# drop all ipv6
	sudo firewall-cmd --direct --permanent --add-rule ipv6 filter OUTPUT 0 -j DROP
	sudo firewall-cmd --direct --permanent --add-rule ipv6 filter INPUT 0 -j DROP

	# reload and restart firewalld to activate permanent rule changes
	sudo firewall-cmd --reload
	sudo systemctl restart firewalld

	# check for success (not really though, needs improvement)
	LOCK_RULES=$( sudo firewall-cmd --direct --permanent --get-all-rules | wc -l )
	if [ "$LOCK_RULES" -gt 15 ]
	then
		LOCK_ACTIVE="active"
	else
		LOCK_ACTIVE="inactive"
	fi
	print_heading
}

function deactivate_lock {
	echo "Deactivating iptable rules:"
	sudo firewall-cmd --direct --permanent --remove-rule ipv4 filter INPUT 0 -i lo -j ACCEPT
	sudo firewall-cmd --direct --permanent --remove-rule ipv4 filter OUTPUT 0 -o lo -j ACCEPT
	
	sudo firewall-cmd --direct --permanent --remove-rule ipv4 filter OUTPUT 0 -s 192.168.0.0/16 -d 192.168.0.0/16 -j ACCEPT
	sudo firewall-cmd --direct --permanent --remove-rule ipv4 filter INPUT 0 -s 255.255.255.255 -j ACCEPT
	sudo firewall-cmd --direct --permanent --remove-rule ipv4 filter OUTPUT 0 -d 255.255.255.255 -j ACCEPT
	
	sudo firewall-cmd --direct --permanent --remove-rule ipv4 filter FORWARD 0 -o tun+ -j ACCEPT
	sudo firewall-cmd --direct --permanent --remove-rule ipv4 filter FORWARD 0 -i tun+ -j ACCEPT
	sudo firewall-cmd --direct --permanent --remove-rule ipv4 filter OUTPUT 998 -o tun+ -j ACCEPT
	
	#sudo firewall-cmd --direct --permanent --remove-rule ipv4 nat POSTROUTING 0 -o tun+ -j MASQUERADE

	sudo firewall-cmd --direct --permanent --remove-rule ipv4 filter OUTPUT 1 -p udp --dport 53 -m string --hex-string '|06 61697276706e 03 6f7267|' --algo bm -m length --length 0:126 -m recent --set -j ACCEPT
	sudo firewall-cmd --direct --permanent --remove-rule ipv4 filter OUTPUT 1 -p tcp --dport 53 -m string --hex-string '|06 61697276706e 03 6f7267|' --algo bm -m length --length 0:126 -m recent --set -j ACCEPT
	sudo firewall-cmd --direct --permanent --remove-rule ipv4 filter OUTPUT 1 -p tcp --syn --dport 53 -m recent --remove -j ACCEPT
	sudo firewall-cmd --direct --permanent --remove-rule ipv4 filter OUTPUT 1 -d 5.196.64.52 -j ACCEPT
	sudo firewall-cmd --direct --permanent --remove-rule ipv4 filter INPUT 1 -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
	
	sudo firewall-cmd --direct --permanent --remove-rule ipv4 filter OUTPUT 999 -j DROP
	sudo firewall-cmd --direct --permanent --remove-rule ipv4 filter INPUT 999 -j DROP
	
	sudo firewall-cmd --direct --permanent --remove-rule ipv6 filter OUTPUT 0 -j DROP
	sudo firewall-cmd --direct --permanent --remove-rule ipv6 filter INPUT 0 -j DROP

	sudo firewall-cmd --reload
	sudo systemctl restart firewalld

	LOCK_RULES=$( sudo firewall-cmd --direct --permanent --get-all-rules | wc -l )
	if [ "$LOCK_RULES" -gt 15 ]
	then
		LOCK_ACTIVE="active"
	else
		LOCK_ACTIVE="inactive"
	fi
	print_heading
}

function print_heading {
	tput cup 0 0
	printf %"$COLS"s | tr " " "#"
	echo -n "#"; printf %"$(( $COLS - 2 ))"s | tr " " " "; echo "#"
	echo -n "#"; printf %"$(( ($COLS - 2 - ${#HEADING1_1}) / 2 ))"s | tr " " " "; echo -n "$HEADING1_1"; printf %"$(( $COLS - 2 - ${#HEADING1_1} - ($COLS - 2 - ${#HEADING1_1}) / 2 ))"s | tr " " " "; echo "#"
	echo -n "#"; printf %"$(( ($COLS - 2 - ${#HEADING1_2}) / 2 ))"s | tr " " " "; echo -n "$HEADING1_2"; printf %"$(( $COLS - 2 - ${#HEADING1_2} - ($COLS - 2 - ${#HEADING1_2}) / 2 ))"s | tr " " " "; echo "#"
	echo -n "#"; printf %"$(( $COLS - 2 ))"s | tr " " " "; echo "#"
	echo -n "#"; printf %"$(( ($COLS - 2 - ${#HEADING2_1}) / 2 ))"s | tr " " " "; echo -n "$HEADING2_1"; printf %"$(( $COLS - 2 - ${#HEADING2_1} - ($COLS - 2 - ${#HEADING2_1}) / 2 ))"s | tr " " " "; echo "#"
	echo -n "#"; printf %"$(( ($COLS - 2 - ${#HEADING2_2}) / 2 ))"s | tr " " " "; echo -n "$HEADING2_2"; printf %"$(( $COLS - 2 - ${#HEADING2_2} - ($COLS - 2 - ${#HEADING2_2}) / 2 ))"s | tr " " " "; echo "#"
	echo -n "#"; printf %"$(( ($COLS - 2 - ${#HEADING2_3}) / 2 ))"s | tr " " " "; echo -n "$HEADING2_3"; printf %"$(( $COLS - 2 - ${#HEADING2_3} - ($COLS - 2 - ${#HEADING2_3}) / 2 ))"s | tr " " " "; echo "#"
	echo -n "#"; printf %"$(( $COLS - 2 ))"s | tr " " " "; echo "#"
	echo -n "# User: $U_LOGIN"; printf %"$(( $COLS - 9 - ${#U_LOGIN} ))"s | tr " " " "; echo "#"
	echo -n "# Days Until Expiration: $U_EXP"; printf %"$(( $COLS - 26 - ${#U_EXP} ))"s | tr " " " "; echo "#"
	echo -n "# Default Network Lock: $LOCK_ACTIVE"; printf %"$(( $COLS - 25 - ${#LOCK_ACTIVE} ))"s | tr " " " "; echo "#"
	echo -n "#"; printf %"$(( $COLS - 2 ))"s | tr " " " "; echo "#"
	echo -n "# Status: $U_CONNECTED"; printf %"$(( $COLS - 11 - ${#U_CONNECTED} ))"s | tr " " " "; echo "#"
	echo -n "# Server: $U_SERVER_FULL"; printf %"$(( $COLS - 11 - ${#U_SERVER_FULL} ))"s | tr " " " "; echo "#"
	echo -n "# Server Bandwidth: $U_SERVER_BW"; printf %"$(( $COLS - 21 - ${#U_SERVER_BW} ))"s | tr " " " "; echo "#"
	echo -n "#"; printf %"$(( $COLS - 2 ))"s | tr " " " "; echo "#"
	printf %"$COLS"s | tr " " "#"
}

# move to secondary screen
tput smcup
tput cup 0 0

# gain sudo privileges for commands that need it (better than running everything with sudo)
sudo -v -p "The AirVPN client and network traffic changes requires root privileges to run. Please enter your password:"
# keep sudo permission until script exits (or until computer goes to sleep - not ideal)
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &

get_userinfo
LOCK_RULES=$( sudo firewall-cmd --direct --permanent --get-all-rules | wc -l )
if [ "$LOCK_RULES" -gt 15 ]
then
	LOCK_ACTIVE="active"
else
	LOCK_ACTIVE="inactive"
fi
print_heading

while true; do
	# clear screen below heading
	tput cup 18 0
	tput ed
	tput cup 19 0
	select OPTION in "${OPTIONS[@]}"
		do
			case $OPTION in
				"${OPTIONS[0]}")
					disconnect_server
					if [ "$KILLED" = "true" ]
					then
						U_CONNECTED="connecting..."
						U_SERVER_FULL="--"
						U_SERVER_BW="--"
						print_heading
						# create pipe to process status of client
						if [ ! -p "/tmp/.eddie_fifo" ]
						then
							mkfifo "/tmp/.eddie_fifo"
						fi
						# run eddie in background and detached from current window, pipe output to named pipe
						(sudo eddie-ui --cli --netlock --connect --profile="$HOME/.airvpn/default.xml" &> "/tmp/.eddie_fifo" &)
						timeout --signal=SIGINT 60 grep -q -m 1 "Initialization Sequence Completed" "/tmp/.eddie_fifo"
						if [ $? = 0 ]
						then
							get_userinfo
							print_heading
						else
							U_CONNECTED="error during connection attempt"
							U_SERVER_FULL="--"
							U_SERVER_BW="--"
							print_heading
						fi
					else
						U_CONNECTED="error during disconnection"
						U_SERVER_FULL="--"
						U_SERVER_BW="--"
						print_heading
					fi
					break
					;;
				"${OPTIONS[1]}")
					read -p 'Please type the exact server name (type "back" to go back): ' SERVER
					if [ "$SERVER" = "back" ]
					then
						break
					else
						disconnect_server
						if [ "$KILLED" = "true" ]
						then
							U_CONNECTED="connecting..."
							U_SERVER_FULL="--"
							U_SERVER_BW="--"
							print_heading
							if [ ! -p "/tmp/.eddie_fifo" ]
							then
								mkfifo "/tmp/.eddie_fifo"
							fi
							(sudo eddie-ui --cli --netlock --connect --server="$SERVER" --profile="$HOME/.airvpn/default.xml" &> "/tmp/.eddie_fifo" &)
							timeout --signal=SIGINT 60 grep -q -m 1 "Initialization Sequence Completed" "/tmp/.eddie_fifo"
							if [ $? = 0 ]
							then
								get_userinfo
								print_heading
							else
								U_CONNECTED="error during connection attempt"
								U_SERVER_FULL="--"
								U_SERVER_BW="--"
								print_heading
							fi
						else
							U_CONNECTED="error during disconnection"
							U_SERVER_FULL="--"
							U_SERVER_BW="--"
							print_heading
						fi
						break
					fi
					;;
				"${OPTIONS[2]}")
					# return to primary screen since server list gets piped to less which
					# seems to interfere with tput, then move to secondary screen again
					tput rmcup
					get_list
					tput smcup
					print_heading
					break
					;;
				"${OPTIONS[3]}")
					get_userinfo
					print_heading
					break
					;;
				"${OPTIONS[4]}")
					disconnect_server
					if [ "$KILLED" = "false" ]
						then
							U_CONNECTED="error during disconnection"
							U_SERVER_FULL="--"
							U_SERVER_BW="--"
							print_heading
						else
							get_userinfo
							print_heading
						fi
					rm "/tmp/.eddie_fifo"
					break
					;;
				"${OPTIONS[5]}")
					pgrep -f mono.*eddie-ui &> /dev/zero
					if [ $? = 0 ]
					then
						echo "You need to be disconnected to change network traffic rules."
						sleep 2
						break
					fi
					if [ "$LOCK_ACTIVE" = "inactive" ]
					then
						read -p "Are you sure you want to activate the default network lock and block all connections while not connected to (any) VPN? [y/n]: " ANSWER
						if [ "$ANSWER" = "y" ]
						then
							activate_lock
						else
							break
						fi
					else
						read -p "Are you sure you want to deactivate the default network lock and allow all connections, even when not connected to a VPN? [y/n]: " ANSWER
						if [ "$ANSWER" = "y" ]
						then
							deactivate_lock
						else
							break
						fi
					fi
					break
					;;
				"${OPTIONS[6]}")
					break 2
					;;
			esac
		done
done

#return to primary (original) screen
tput rmcup

 

I will hopefully update this in the future!

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Security Check
    Play CAPTCHA Audio
    Refresh Image
Sign in to follow this  

×
×
  • Create New...