autovpn3

autovpn3 Description

autovpn3 is the Bash version of autovpn and autovpn2 with additional functionality.

autovpn3 is a VPN Gate client (based on OpenVPN) for Linux, connects you to a random free VPN in the country of your choice, indicated by a two-letter country code.

The program can help you hide your real IP address from the sites you visit, as well as open sites that are blocked in your country.

Key features of the program:

  • redirects all traffic on the system through the VPN (not just web browser traffic like some plugins do)
  • uses free VPNs
  • the resulting VPN settings are not tied to anything - you do not need to register, enter email or perform any similar actions
  • everything is done automatically: search for free VPN servers, get the settings, launch the OpenVPN client with an indication of the received settings

The autovpn2 program is very easy to use, it allows you to quickly connect to a VPN and hide your IP address from visited sites without manually configuring an OpenVPN client, as well as bypass blocking.

Since OpenVPN redirects all traffic through the VPN server, any tools you use will go online through the VPN server.

The following additional features have been implemented over autovpn2:

  • the VPN list is cached and downloaded again only when it is really needed, thanks to this, reconnection to a new server is much faster;
  • you can specify a country to search for VPN servers in it, or use a VPN from a randomly selected country
  • added support for connecting to a VPN through a proxy (as well as downloading a VPN list through a proxy) - it's even better for anonymity
  • written in Bash, you will have no problems with Python 2, does not require compilation
  • you can save the list of VPN servers and use it without downloading
  • quick change of VPN server

Homepage: https://miloserdov.org/?p=5858

Author: MiAl

License: GPLv3

autovpn3 Help

Running the script:

sudo ./autovpn3.sh

When choosing a VPN server, the following information will be displayed:

Found VPN servers: 99
Selected: 87
Country: Sweden

It shows the number of found VPNs for the selected country, as well as the number of the selected VPN server and the country in which it is located.

To check your IP and which country it belongs to, you can use this online service or any other.

If you want to disconnect from the VPN server or try another VPN, then press Ctrl+c.

An inscription will appear:

Try another VPN server? (Y/N):

If you want to connect to another VPN, then enter "y". If you want to interrupt the program, just press Enter.

Setting up autovpn3

You can change the parameters of the script in the source code.

You can specify a two-letter country code (ISO 3166-2), for example JP, KR, US, TH, in this case a VPN from the specified country will be selected. If you leave the value blank, then a VPN from an arbitrary state will be selected.

country=''

If set to 1, then the list of VPN servers will be downloaded only if it is absent, if set to 0, then the list will be downloaded every time the program is started:

useSavedVPNlist=1

Proxy settings, if you want to use a proxy, set it to 1, and also enter the IP and port of the proxy. In this case, the proxy will be used to get a list of VPN servers, and the connection to the VPN server will be made through the proxy:

proxy=0
proxyIP=''
proxyPort=8080
​proxyType='socks' # socks or http

If you want the server to be selected arbitrarily, then set it to 0, if set to 1, then the first one in the list will be selected:

useFirstServer=0

The path where the downloaded list of VPN servers is saved:

vpnList='/tmp/vpns.tmp'

autovpn3 Usage Example

The program must be run with sudo as this is required for the OpenVPN client:

sudo ./autovpn3.sh

How to install autovpn3

Installation on Kali Linux

Install the OpenVPN package necessary for the script to work:

sudo apt install openvpn

Create autovpn3.sh file:

gedit autovpn3.sh

Copy to it:

#!/bin/bash

# autovpn3, coded by MiAl, 
# you can leave a bug report on the page: https://miloserdov.org/?p=5858
# сообщить об ошибке на русском вы можете на странице: https://HackWare.ru/?p=15429

# you can change these parameters:
country='' # empty for any or JP, KR, US, TH, etc.
useSavedVPNlist=0 # set to 1 if you don't want to download VPN list every time you restart this script, otherwise set to 0
useFirstServer=0 # set the value to 0 to choose a random VPN server, otherwise set to 1 (maybe the first one has higher score)
vpnList='/tmp/vpns.tmp'
proxy=0 # replace with 1 if you want to connect to VPN server through a proxy
proxyIP=''
proxyPort=8080
proxyType='socks' # socks or http

# don't change this:
counter=0
VPNproxyString=''
cURLproxyString=''

if [ $proxy -eq 1 ];then
	echo 'We will use a proxy'
	if [ -z "$proxyIP" ]; then
		echo "To use a proxy, you must specify the proxy's IP address and port (hardcoded in the source code)."
		exit
	else
		if [ "$proxyType" == "socks" ];then
			VPNproxyString=" --socks-proxy $proxyIP $proxyPort "
			cURLproxyString=" --proxy socks5h://$proxyIP:$proxyPort "
		elif [ "$proxyType" == "http" ];then
			VPNproxyString=" --http-proxy $proxyIP $proxyPort "
			cURLproxyString=" --proxy http://$proxyIP:$proxyPort "
		else
			echo 'Unsupported proxy type.'
			exit	
		fi	
	fi
fi

if [ $useSavedVPNlist -eq 0 ];then
	echo 'Getting the VPN list'
	curl -s $cURLproxyString https://www.vpngate.net/api/iphone/ > $vpnList
elif [ ! -s $vpnList ];then
	echo 'Getting the VPN list'
	curl -s $cURLproxyString https://www.vpngate.net/api/iphone/ > $vpnList	
else
	echo 'Using existing VPN list'
fi

while read -r line ; do
	array[$counter]="$line"
	counter=$counter+1
done < <(grep -E ",$country" $vpnList)

CreateVPNConfig () {
	if [ -z "${array[0]}" ]; then
		echo 'No VPN servers found from the selected country.'
		exit
	fi

	size=${#array[@]}

	if [ $useFirstServer -eq 1 ]; then
		index=0
		echo ${array[$index]} | awk -F "," '{ print $15 }' | base64 -d > /tmp/openvpn3
	else		
		index=$(($RANDOM % $size))
		echo ${array[$index]} | awk -F "," '{ print $15 }' | base64 -d > /tmp/openvpn3
	fi

	echo 'Choosing a VPN server:'
	echo "Found VPN servers: $((size+1))"
	echo "Selected: $index"
	echo "Country: `echo ${array[$index]} | awk -F "," '{ print $6 }'`"    
}

while true
	do
		CreateVPNConfig
		echo 'Trying to start OpenVPN client'
		sudo openvpn --config /tmp/openvpn3 $VPNproxyString
		read -p "Try another VPN server? (Y/N): " confirm && [[ $confirm == [yY] || $confirm == [yY][eE][sS] ]] || exit
	done

Make the file executable:

chmod +x autovpn3.sh

Run like this:

sudo ./autovpn3.sh

Installation on BlackArch

Install the OpenVPN package necessary for the script to work:

sudo pacman -S openvpn

Then follow the same steps as for Kali Linux.

Installation information for other operating systems will be added later.

autovpn3 Screenshots

autovpn3 Tutorials

Related tools

Recommended for you:

Comments are Closed

Рейтинг@Mail.ru