Warith AL Maawali

0 %
Warith AL Maawali
Driving cybersecurity excellence
Innovator behind Linux Kodachi
  • Residence:
    127.0.0.1
  • Uptime Binary:
    101110
  • Mantra:
    Innovate, Secure, Repeat
ONS
EEDS
NSSG
Visual basic
Gambas
PHP
Delphi
Bash
  • Cybersecurity
  • Generative AI
  • Cloud & Automation
  • Cryptocurrency

Validating VPN nodes

03/11/2019

Ensuring Valid VPN Nodes in Linux Kodachi

Have you ever wondered how Linux Kodachi maintains the validity of its VPN nodes, even though they come from different providers? In this post, I will explain in detail the process of validating VPN nodes from various providers that Linux Kodachi uses on the server side. This process is automatically triggered by a cron job.

Each VPN provider has its own method of providing a list of nodes. Some offer compressed ZIP files, others use APIs, and some simply provide an HTML page. These lists often contain invalid nodes (offline VPNs) that should not be included for users. To exclude offline nodes from online ones, you need to develop a solution using your preferred programming language. In my case, I used shell scripting, as I performed this task on a Linux box.

Validating HideMe VPN list:

  • Provider Name: HidemeVPN
  • List type: API
  • Retrieval type: Automatic
  • Website: hide.me
  • Used in Linux Kodachi: Yes
ShellScript
#!/bin/bash
# Script written by Warith Al Maawali  
# (c) 2019 Founder of Eagle Eye Digital Solutions
# https://www.digi77.com
# http://www.om77.net
# script starts here:

# Get the source directory of a Bash script from within the script 
cd $(dirname $0)

# Printing functions

function print_good(){
    echo -e "\x1B[01;32m[*]\x1B[0m $1"
}

function print_error(){
    echo -e "\x1B[01;31m[!]\x1B[0m $1"
}

function printScreen()
{

       echo $1

}

printScreen "";
printScreen "Script will start now ...";
printScreen "";

if !(dpkg --list zip | egrep -q ^ii); then
    printScreen ""
    printScreen ""   
     print_error "Ops.. zip package is missing we we will try to install it for you if it does not work please use this command $sudo apt-get -y install zip"
    printScreen ""
    printScreen ""
    sudo apt-get -y install zip
fi

if !(dpkg --list jq | egrep -q ^ii); then
    printScreen ""
    printScreen ""   
     print_error "Ops.. jq package is missing we we will try to install it for you if it does not work please use this command $sudo apt-get -y install jq"
    printScreen ""
    printScreen ""
    sudo apt-get -y install jq
fi

if !(dpkg --list rpl | egrep -q ^ii); then
    printScreen ""
    printScreen ""   
     print_error "Ops.. rpl package is missing we we will try to install it for you if it does not work please use this command $sudo apt-get -y install rpl"
    printScreen ""
    printScreen ""
    sudo apt-get -y install rpl
fi

#Main variables
oPath=hidemevpnconfigs
theFile="/root/hidemevpn.txt";
rm -f -r $oPath;

#Make directory for saving config files
mkdir -p $oPath

# Clean up
echo "Start ip clean ....";
rm -f hidemevpn.txt;
rm -f hidemevpn2.txt;
rm -f hidemegoodvpn.txt;
rm -f hidemebadvpn.txt;
rm -f *.ovpn;
printScreen  "Done with cleaning";

sleep 1;
printScreen "";

printScreen 'Updating VPN servers: DOWNLOADING API......';
if(wget -O hidemevpn.txt https://api.hide.me/v2/network/status)
then
    cat hidemevpn.txt |  jq -r '.[].hostname' >  hidemevpn2.txt;

    # Set counter
    i=1;
    # Count number of files
    servercount=$(cat hidemevpn2.txt |wc -l)

    while read line
     do
        theIP=$line;

        gDNS="8.8.8.8";    
        cDNS="1.1.1.1";
        nodeDNS="108.61.10.10";

        if !(grep -R $gDNS /etc/resolv.conf > /dev/null)
        then        
            print_error "DNS has to be changed"
            printScreen "Setting DNS to Cloudflare and Google DNS";
            printScreen ""
            echo -n "nameserver $gDNS"  > /etc/resolv.conf
            echo  " "  >> /etc/resolv.conf
            echo -n "nameserver $cDNS"  >> /etc/resolv.conf
            printScreen " "  >> /etc/resolv.conf
            echo  -n "nameserver $nodeDNS" >> /etc/resolv.conf
            print_good "Google and Cloudflare DNS has been set";
            printScreen ""
            cat /etc/resolv.conf
            sleep 1;
            echo  " ";
        fi

        # Check if node is a live then add it to the profile
        ping -c1 -W 3 "$theIP" &> /dev/null
        if [ $? -eq 0 ]; 
        then
            echo "client
dev tun
proto udp
remote $line 4000
cipher AES-256-CBC
auth SHA256
resolv-retry infinite
nobind
persist-key
persist-tun
mute-replay-warnings
verb 3
auth-user-pass ../Own_VPN_Config/hidemevpnauth.txt
reneg-sec 0
remote-cert-tls server
verify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4MYlg5MFk
4RHBAPLe5eJ8YobwPOAD4vnl2yqpgxbEBAiPlX/mXsfbBYLXHsDS/EMPecJ3aqZ3
Wv7y9IeWz9x6h4/AGM2pSbL+FHy4i55o4486CTKuB/6PEnlLAiVfPDkhDpJo0/ta
n+p25b79tbI2iIoa4VqhkFAXpCdujNc/j7f+5wT+PsandEi3vckAvvZjhmTdreev
+nB/J2uzyFLr+6MUrYkPlOEUOnNImqDeXE/ocPFsTHiigV1I+1CUUgLr2MGuFTFm
ZpQyQ6V9oqNU6av+hsD11GYpV8wi4QqWjeBOQayXJ7vcwqE3igyoBI2vMrpwfLlJ
K127pRfgZn0=
-----END CERTIFICATE-----

-----BEGIN OpenVPN Static key V1-----
8d25d82e75abbcdd73fb17b2ba5d1af2
2d0e026ac8608ec8e51ecb0b3b1b5dba
8ac1f6e556e4b4e3545e979dd26e2d9d
5bc28c1d75b4e37531aabf5da3cba671
1f8998eb66aa290daab6122bdfcb1aa3
b9b428e722ea6e7edd9b878a5161c555
14e6233d18b5cc34e859ecb5852b34ed
6e539d64676edf9ad79470795ae73184
05d93554de1063aec1df6420709c2dcc
79511fa9c5e82de09d560f7d92001ea2
75e4b3e9b6ce19687968b4813d6a9d61
a48311658de88d651edb4eab447d73f6
b209d144a3343a2c992b09c7501cad77
cdf5c6b3be5f9919854bb10182c86794
9df929173b8e98aeea9ffe277eddd7f7
936232e1e44c9feb7a3a2753ed05c90b
-----END OpenVPN Static key V1-----

        " > "$oPath/$line.ovpn"

        print_good "$line is live  creating: $oPath/$line.ovpn";  
        echo $line >>  hidemegoodvpn.txt
        printScreen ""
    else
        print_error " $line is dead skipped!";
        echo $line >> hidemebadvpn.txt
        printScreen ""
    fi

    # Counting stuff
    percentage=$((($i*100)/$servercount));
    printScreen "$percentage% completed $i out of $servercount"; 
    i=$((i+1));
    printScreen "";
    done < hidemevpn2.txt else print_error "Download failed of hidemevpn api"; exit 1; fi # Clean old file rm -f hidemevpnconfigs.zip # Compress with password zip -er --password Yourpasswordhere hidemevpnconfigs.zip hidemevpnconfigs rm -f /var/www/html/hidemevpnconfigs.zip # Remove from public html mv hidemevpnconfigs.zip /var/www/html # Clean up rm -r -f $oPath rm -f hidemevpn.txt; rm -f hidemevpn2.txt; # Returning things as they were before if !(grep -R $nodeDNS /etc/resolv.conf > /dev/null)
then 
    print_good "Default DNS has been set";
    echo  -n "nameserver 108.61.10.10" > /etc/resolv.conf
fi

exit 1
ShellScript

Validating Proton VPN list: 

  • Provider Name: protonVPN
  • List type: API
  • Retrieval type: Automatic
  • Website: protonvpn.com
  • Used in Linux Kodachi: Yes
ShellScript
#!/bin/bash
# Script written by Warith Al Maawali  
# (c) 2019 Founder of Eagle Eye Digital Solutions
# https://www.digi77.com
# http://www.om77.net
# script starts here:

# Get the source directory of a Bash script from within the script 
cd $(dirname $0)

# Printing functions

function print_good(){
    echo -e "\x1B[01;32m[*]\x1B[0m $1"
}

function print_error(){
    echo -e "\x1B[01;31m[!]\x1B[0m $1"
}

function printScreen()
{

       echo $1

}

printScreen "";
printScreen "Script will start now ...";
printScreen "";

if !(dpkg --list zip | egrep -q ^ii); then
    printScreen ""
    printScreen ""   
     print_error "Ops.. zip package is missing we we will try to install it for you if it does not work please use this command $sudo apt-get -y install zip"
    printScreen ""
    printScreen ""
    sudo apt-get -y install zip
fi

if !(dpkg --list jq | egrep -q ^ii); then
    printScreen ""
    printScreen ""   
     print_error "Ops.. jq package is missing we we will try to install it for you if it does not work please use this command $sudo apt-get -y install jq"
    printScreen ""
    printScreen ""
    sudo apt-get -y install jq
fi

if !(dpkg --list rpl | egrep -q ^ii); then
    printScreen ""
    printScreen ""   
     print_error "Ops.. rpl package is missing we we will try to install it for you if it does not work please use this command $sudo apt-get -y install rpl"
    printScreen ""
    printScreen ""
    sudo apt-get -y install rpl
fi

# Main variables
oPath=protonvpnconfigs
theFile="/root/protonvpn.txt";
rm -f -r $oPath;

# Make directory for saving config files
mkdir -p $oPath

# Clean up
printScreen "Files clean up ....";
rm -f protonvpn.txt;
rm -f protonvpn2.txt;
rm -f protongoodvpn.txt;
rm -f protonbadvpn.txt;
printScreen "Done with cleaning";

sleep 1;

printScreen 'Updating VPN servers: DOWNLOADING API......';
if(wget -O protonvpn.txt https://api.protonmail.ch/vpn/logicals)
then

    print_good "Yai API is working let us work on it"
    sleep 1;

    # Filter the free nodes from the list and output to a file
    cat protonvpn.txt |  jq  '.LogicalServers[].Domain'|grep free| tr -d '"' >  protonvpnfree.txt;

    # Set counter
    i=1;
    # Count number of files
    servercount=$(cat protonvpnfree.txt |wc -l)

    while read line
     do
        theIP=$line;

        gDNS="8.8.8.8";    
        cDNS="1.1.1.1";
        nodeDNS="108.61.10.10";

        if !(grep -R $gDNS /etc/resolv.conf > /dev/null)
        then        
            print_error "DNS has to be changed"
            printScreen "Setting DNS to Cloudflare and Google DNS";
            printScreen ""
            echo -n "nameserver $gDNS"  > /etc/resolv.conf
            echo  " "  >> /etc/resolv.conf
            echo -n "nameserver $cDNS"  >> /etc/resolv.conf
            printScreen " "  >> /etc/resolv.conf
            echo  -n "nameserver $nodeDNS" >> /etc/resolv.conf
            print_good "Google and Cloudflare DNS has been set";
            printScreen ""
            cat /etc/resolv.conf
            sleep 1;
            echo  " ";
        fi

        # Check if node is a live then add it to the profile
        ping -c1 -W 3 "$theIP" &> /dev/null
        if [ $? -eq 0 ]; 
        then
            echo "client
dev tun
proto udp
remote $line 443
resolv-retry infinite
nobind
cipher AES-256-CBC
auth SHA512
verb 3
auth-user-pass ../Own_VPN_Config/protonvpnauth.txt
tun-mtu 1500
tun-mtu-extra 32
mssfix 1450
persist-key
persist-tun

ping 15
ping-restart 0
ping-timer-rem
reneg-sec 0

remote-cert-tls server
pull
fast-io

#register-dns
#block-outside-dns

-----BEGIN CERTIFICATE-----
MIIFozCCA4ugAwIBAgIBATANBgkqhkiG9w0BAQ0FADBAMQswCQYDVQQGEwJDSDEV
MBMGA1UEChMMUHJvdG9uVlBOIEFHMRowGAYDVQQDExFQcm90b25WUE4gUm9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1UEAxMRUHJvdG9uVlBOIFJvb3QgQ0GCAQEwCwYDVR0PBAQD
AgEGMA0GCSqGSIb3DQEBDQUAA4ICAQCYr7LpvnfZXBCxVIVc2ea1fjxQ6vkTj0zM
htFs3qfeXpMRf+g1NAh4vv1UIwLsczilMt87SjpJ25pZPyS3O+/VlI9ceZMvtGXd
MGfXhTDp//zRoL1cbzSHee9tQlmEm1tKFxB0wfWd/inGRjZxpJCTQh8oc7CTziHZ
ufS+Jkfpc4Rasr31fl7mHhJahF1j/ka/OOWmFbiHBNjzmNWPQInJm+0ygFqij5qs
51OEvubR8yh5Mdq4TNuWhFuTxpqoJ87VKaSOx/Aefca44Etwcj4gHb7LThidw/ky
zysZiWjyrbfX/31RX7QanKiMk2RDtgZaWi/lMfsl5O+6E2lJ1vo4xv9pW8225B5X
eAeXHCfjV/vrrCFqeCprNF6a3Tn/LX6VNy3jbeC+167QagBOaoDA01XPOx7Odhsb
Gd7cJ5VkgyycZgLnT9zrChgwjx59JQosFEG1DsaAgHfpEl/N3YPJh68N7fwN41Cj
zsk39v6iZdfuet/sP7oiP5/gLmA/CIPNhdIYxaojbLjFPkftVjVPn49RqwqzJJPR
N8BOyb94yhQ7KO4F3IcLT/y/dsWitY0ZH4lCnAVV/v2YjWAWS3OWyC8BFx/Jmc3W
DK/yPwECUcPgHIeXiRjHnJt0Zcm23O2Q3RphpU+1SO3XixsXpOVOYP6rJIXW9bMZ
A1gTTlpi7A==
-----END CERTIFICATE-----

key-direction 1

# 2048 bit OpenVPN static key
-----BEGIN OpenVPN Static key V1-----
6acef03f62675b4b1bbd03e53b187727
423cea742242106cb2916a8a4c829756
3d22c7e5cef430b1103c6f66eb1fc5b3
75a672f158e2e2e936c3faa48b035a6d
e17beaac23b5f03b10b868d53d03521d
8ba115059da777a60cbfd7b2c9c57472
78a15b8f6e68a3ef7fd583ec9f398c8b
d4735dab40cbd1e3c62a822e97489186
c30a0b48c7c38ea32ceb056d3fa5a710
e10ccc7a0ddb363b08c3d2777a3395e1
0c0b6080f56309192ab5aacd4b45f55d
a61fc77af39bd81a19218a79762c3386
2df55785075f37d8c71dc8a42097ee43
344739a0dd48d03025b0450cf1fb5e8c
aeb893d9a96d1f15519bb3c4dcb40ee3
16672ea16c012664f8a9f11255518deb
-----END OpenVPN Static key V1-----
" > "$oPath/$line.ovpn"

        print_good "$line is live  creating: $oPath/$line.ovpn";  
        echo $line >> protongoodvpn.txt
        printScreen ""
    else
        print_error " $line is dead skipped!";
        echo $line >> protonbadvpn.txt
        printScreen ""
    fi

    # Counting stuff
    percentage=$((($i*100)/$servercount));
    printScreen "$percentage% completed $i out of $servercount"; 
    i=$((i+1));
    printScreen "";
    done < protonvpnfree.txt sleep 2; print_good "Done with free nodes"; printScreen ""; # Get non free nodes cat protonvpn.txt | jq '.LogicalServers[].Servers[].EntryIP'| tr -d '"' >  protonvpn2.txt;

    # Set counter
    i=1;
    # Count number of files
    servercount=$(cat protonvpn2.txt |wc -l)

    while read line
     do
        theIP=$line;

        gDNS="8.8.8.8";    
        cDNS="1.1.1.1";
        nodeDNS="108.61.10.10";

        if !(grep -R $gDNS /etc/resolv.conf > /dev/null)
        then        
            print_error "DNS has to be changed"
            printScreen "Setting DNS to Cloudflare and Google DNS";
            printScreen ""
            echo -n "nameserver $gDNS"  > /etc/resolv.conf
            echo  " "  >> /etc/resolv.conf
            echo -n "nameserver $cDNS"  >> /etc/resolv.conf
            echo " "  >> /etc/resolv.conf
            echo  -n "nameserver $nodeDNS" >> /etc/resolv.conf
            print_good "Google and Cloudflare DNS has been set";
            printScreen ""
            cat /etc/resolv.conf
            sleep 1;
            echo  " ";
        fi

        # Check if node is a live then add it to the profile
        ping -c1 -W 3 "$theIP" &> /dev/null
        if [ $? -eq 0 ]; 
        then
            echo "client
dev tun
proto udp
remote $line 443
resolv-retry infinite
nobind
cipher AES-256-CBC
auth SHA512
verb 3
auth-user-pass ../Own_VPN_Config/protonvpnauth.txt
tun-mtu 1500
tun-mtu-extra 32
mssfix 1450
persist-key
persist-tun

ping 15
ping-restart 0
ping-timer-rem
reneg-sec 0

remote-cert-tls server
pull
fast-io

#register-dns
#block-outside-dns

-----BEGIN CERTIFICATE-----
MIIFozCCA4ugAwIBAgIBATANBgkqhkiG9w0BAQ0FADBAMQswCQYDVQQGEwJDSDEV
MBMGA1UEChMMUHJvdG9uVlBOIEFHMRowGAYDVQQDExFQcm90b25WUE4gUm9vdCBD
QTAeFw0xNzAyMTUxNDM4MDBaFw0yNzAyMTUxNDM4MDBaMEAxCzAJBgNVBAYTAkNI
MRUwEwYDVQQKEwxQcm90b25WUE4gQUcxGjAYBgNVBAMTEVByb3RvblZQTiBSb290
IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAt+BsSsZg7+AuqTq7
vDbPzfygtl9f8fLJqO4amsyOXlI7pquL5IsEZhpWyJIIvYybqS4s1/T7BbvHPLVE
wlrq8A5DBIXcfuXrBbKoYkmpICGc2u1KYVGOZ9A+PH9z4Tr6OXFfXRnsbZToie8t
2Xjv/dZDdUDAqeW89I/mXg3k5x08m2nfGCQDm4gCanN1r5MT7ge56z0MkY3FFGCO
qRwspIEUzu1ZqGSTkG1eQiOYIrdOF5cc7n2APyvBIcfvp/W3cpTOEmEBJ7/14RnX
nHo0fcx61Inx/6ZxzKkW8BMdGGQF3tF6u2M0FjVN0lLH9S0ul1TgoOS56yEJ34hr
JSRTqHuar3t/xdCbKFZjyXFZFNsXVvgJu34CNLrHHTGJj9jiUfFnxWQYMo9UNUd4
a3PPG1HnbG7LAjlvj5JlJ5aqO5gshdnqb9uIQeR2CdzcCJgklwRGCyDT1pm7eoiv
WV19YBd81vKulLzgPavu3kRRe83yl29It2hwQ9FMs5w6ZV/X6ciTKo3etkX9nBD9
ZzJPsGQsBUy7CzO1jK4W01+u3ItmQS+1s4xtcFxdFY8o/q1zoqBlxpe5MQIWN6Qa
lryiET74gMHE/S5WrPlsq/gehxsdgc6GDUXG4dk8vn6OUMa6wb5wRO3VXGEc67IY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d03e53b187727
423cea742242106cb2916a8a4c829756
3d22c7e5cef430b1103c6f66eb1fc5b3
75a672f158e2e2e936c3faa48b035a6d
e17beaac23b5f03b10b868d53d03521d
8ba115059da777a60cbfd7b2c9c57472
78a15b8f6e68a3ef7fd583ec9f398c8b
d4735dab40cbd1e3c62a822e97489186
c30a0b48c7c38ea32ceb056d3fa5a710
e10ccc7a0ddb363b08c3d2777a3395e1
0c0b6080f56309192ab5aacd4b45f55d
a61fc77af39bd81a19218a79762c3386
2df55785075f37d8c71dc8a42097ee43
344739a0dd48d03025b0450cf1fb5e8c
aeb893d9a96d1f15519bb3c4dcb40ee3
16672ea16c012664f8a9f11255518deb
-----END OpenVPN Static key V1-----
" > "$oPath/$line.ovpn"

        print_good "$line is live  creating: $oPath/$line.ovpn";  
        echo $line >> protongoodvpn.txt
        printScreen ""
    else
        print_error " $line is dead skipped!";
        echo $line >> protonbadvpn.txt
        printScreen ""
    fi
    # Counting stuff
    percentage=$((($i*100)/$servercount));
    printScreen "$percentage% completed $i out of $servercount"; 
    i=$((i+1));
    printScreen "";
    done < protonvpn2.txt else print_error "Download failed of protonvpn api"; exit 1; fi # Clean old file rm -f protonvpnconfigs.zip # Compress with password zip -er --password Yourpassword protonvpnconfigs.zip protonvpnconfigs # Remove from public html rm -f /var/www/html/protonvpnconfigs.zip # Move new zip to public html mv protonvpnconfigs.zip /var/www/html # Clean up rm -r -f $oPath rm -f protonvpn.txt; rm -f protonvpn2.txt; # Returning things as they were before if !(grep -R $nodeDNS /etc/resolv.conf > /dev/null)
then 
    print_good "Default DNS has been set";
    echo  -n "nameserver 108.61.10.10" > /etc/resolv.conf
fi

exit 1
ShellScript

Validating Mullvad VPN list: 

  • Provider Name: mullvadVPN
  • List type: Zip file
  • Retrieval type: Manual you have to login to get the list!
  • Website: mullvad.net
  • Used in Linux Kodachi: Yes
ShellScript
#!/bin/bash
# Script written by Warith Al Maawali  
# (c) 2019 Founder of Eagle Eye Digital Solutions
# https://www.digi77.com
# http://www.om77.net
# script starts here:
# script starts here:



# Get the source directory of a Bash script from within the script 
cd $(dirname $0)

# Printing functions

function print_good(){
    echo -e "\x1B[01;32m[*]\x1B[0m $1"
}


function print_error(){
    echo -e "\x1B[01;31m[!]\x1B[0m $1"
}

function printScreen()
{

       echo $1

}

printScreen "";
printScreen "Script will start now ...";
printScreen "";



if !(dpkg --list zip | egrep -q ^ii); then
    printScreen ""
    printScreen ""   
     print_error "Ops.. zip package is missing we we will try to install it for you if it does not work please use this command $sudo apt-get -y install zip"
    printScreen ""
    printScreen ""
    sudo apt-get -y install zip
fi


if !(dpkg --list jq | egrep -q ^ii); then
    printScreen ""
    printScreen ""   
     print_error "Ops.. jq package is missing we we will try to install it for you if it does not work please use this command $sudo apt-get -y install jq"
    printScreen ""
    printScreen ""
    sudo apt-get -y install jq
fi

if !(dpkg --list rpl | egrep -q ^ii); then
    printScreen ""
    printScreen ""   
     print_error "Ops.. rpl package is missing we we will try to install it for you if it does not work please use this command $sudo apt-get -y install rpl"
    printScreen ""
    printScreen ""
    sudo apt-get -y install rpl
fi

#Main variables
oPath="mullvad_config_ios_all";
theFile="/root/mullvadvpn.txt";

# Clean up
rm -f -r $oPath;
rm -f mullvadbadvpn.txt;
rm -f mullvadgoodvpn.txt;

#Make directory for saving config files
mkdir -p $oPath



# Extract zip
unzip -o $oPath.zip  

if [ -d $oPath ]; 
then

    # Clean up
    rm -f -r mullvadconfigs; 
    rm -f $oPath/results.txt;

    if [ ! -d mullvadconfigs ]; then
        printScreen "mkdir mullvadconfigs";
        mkdir mullvadconfigs;   
        printScreen "";
        sleep 1;
    fi;


    # Set counter
    i=1;
    # Count number of files
    servercount=$(ls $oPath/*|wc -l)

    # Set path
    FILES=$oPath/*

    printScreen "Entering first loop";
    printScreen "";

    for f in $FILES
    do       

        # Debug stuff don't worry about it
        #theIP=$(cat $f|grep "^[^#;]"|grep 'remote '|awk  '{print $1}'); 
        #thePort=$(cat $f|grep "^[^#;]"|grep 'remote '|awk  '{print $2}');       

        # Extract ip address from file
        theIP=$(cat $f|grep "^[^#;]"|grep 'remote ');  

        # If ip was found
        if [[ -n $theIP ]] 
        then
            # Debug stuff don't worry about it
            #echo -e "$theIP\n"; 

            # If we have missing file create it
            if [ ! -f $oPath/results.txt ]; then
                echo ""  > $oPath/results.txt           
            fi;
            printScreen "Sending record to file: $oPath/results.txt";
            echo "$theIP\n" >> $oPath/results.txt
        fi
        # Debug stuff don't worry about it
        #echo -e "\n";

        # Counting stuff
        percentage=$((($i*100)/$servercount));
        printScreen "$percentage% completed $i out of $servercount"; 
        i=$((i+1));
        printScreen "";

    done

    sleep 1;         

    # Set counter
    i=1;
    # Count number of files
    servercount=$(cat $oPath/results.txt|wc -l)

    while read line
     do

        theIP=$(echo $line|grep "^[^#;]"|grep 'remote '|awk  '{print $2}'); 


        gDNS="8.8.8.8";    
        cDNS="1.1.1.1";
        nodeDNS="108.61.10.10";

        if !(grep -R $gDNS /etc/resolv.conf > /dev/null)
        then        
            print_error "DNS has to be changed"
            printScreen "Setting DNS to Cloudflare and Google DNS";
            printScreen ""
            echo -n "nameserver $gDNS"  > /etc/resolv.conf
            echo  " "  >> /etc/resolv.conf
            echo -n "nameserver $cDNS"  >> /etc/resolv.conf
            echo " "  >> /etc/resolv.conf
            echo  -n "nameserver $nodeDNS" >> /etc/resolv.conf
            print_good "Google and Cloudflare DNS has been set";
            printScreen ""
            cat /etc/resolv.conf
            sleep 1;
            echo  " ";
        fi

        # Check if node is a live then add it to the profile
        ping -c1 -W 3 "$theIP" &> /dev/null
        if [ $? -eq 0 ]; 
        then
            echo "client
dev tun
proto udp
$line
cipher AES-256-CBC
resolv-retry infinite
nobind
persist-key
persist-tun
verb 3
remote-cert-tls server
ping 10
ping-restart 60
sndbuf 524288
rcvbuf 524288
fast-io
auth-user-pass ../Own_VPN_Config/mullvadvpnauth.txt
reneg-sec 0
tun-ipv6

-----BEGIN CERTIFICATE-----
MIIGIzCCBAugAwIBAgIJAK6BqXN9GHI0MA0GCSqGS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LS-DHE-RSA-WITH-AES-256-GCM-SHA384:TLS-DHE-RSA-WITH-AES-256-CBC-SHA  
" > "mullvadconfigs/$theIP.ovpn";      
        print_good  "$theIP is live creating: $theIP.ovpn";  
        echo $line >> mullvadgoodvpn.txt
        printScreen "";
    else
        print_error " $theIP is dead skipped!";
        echo $line >> mullvadbadvpn.txt
        printScreen "";
    fi
    # Counting stuff
    percentage=$((($i*100)/$servercount));
    printScreen "$percentage% completed $i out of $servercount"; 
    i=$((i+1));
    printScreen "";

done < $oPath/results.txt else print_error "Extract of file $oPath.zip failed"; fi # Compress with password zip -er --password Yourpasswordhere mullvadconfigs.zip mullvadconfigs # Clean old file rm -f /var/www/html/mullvadconfigs.zip # Remove from public html mv mullvadconfigs.zip /var/www/html # Clean up rm -r -f $oPath rm -f -r mullvadconfigs # Returning things as they were before if !(grep -R $nodeDNS /etc/resolv.conf > /dev/null)
then 
    print_good "Default DNS has been set";
    echo  -n "nameserver 108.61.10.10" > /etc/resolv.conf
fi

exit 1
ShellScript


 


Validating Nord VPN list: 

  • Provider Name: nordVPN
  • List type: Zip file
  • Retrieval type: Automatic
  • Website: nordvpn.com
  • Used in Linux Kodachi: Yes
ShellScript
#!/bin/bash
# Script written by Warith Al Maawali  
# (c) 2019 Founder of Eagle Eye Digital Solutions
# https://www.digi77.com
# http://www.om77.net
# script starts here:
 

# Get the source directory of a Bash script from within the script 
cd $(dirname $0)

# Printing functions

function print_good(){
	echo -e "\x1B[01;32m[*]\x1B[0m $1"
}


function print_error(){
	echo -e "\x1B[01;31m[!]\x1B[0m $1"
}

function printScreen()
{
       
       echo $1
       
}

printScreen "";
printScreen "Script will start now ...";
printScreen "";



if !(dpkg --list zip | egrep -q ^ii); then
	printScreen ""
	printScreen ""   
 	print_error "Ops.. zip package is missing we we will try to install it for you if it does not work please use this command $sudo apt-get -y install zip"
	printScreen ""
	printScreen ""
    sudo apt-get -y install zip
fi


if !(dpkg --list jq | egrep -q ^ii); then
	printScreen ""
	printScreen ""   
 	print_error "Ops.. jq package is missing we we will try to install it for you if it does not work please use this command $sudo apt-get -y install jq"
	printScreen ""
	printScreen ""
    sudo apt-get -y install jq
fi

if !(dpkg --list rpl | egrep -q ^ii); then
	printScreen ""
	printScreen ""   
 	print_error "Ops.. rpl package is missing we we will try to install it for you if it does not work please use this command $sudo apt-get -y install rpl"
	printScreen ""
	printScreen ""
    sudo apt-get -y install rpl
fi


# Get NordVPN zip file 
if (wget -O NordVPN.zip https://downloads.nordcdn.com/configs/archives/servers/ovpn.zip)
then
	print_good "Yai we got the zip file";
	printScreen "";
	sleep 1;
	if(unzip NordVPN.zip)
	then
		rm -f -r nordvpnconfigs;
		rm -f -r NordVPN;
	fi
else
	print_error "Failed to download ovpn.zip from NordVPN";
	exit 1;

fi	

# Clean up I don't use tcp only udp
rm -f -r ovpn_tcp

# Rename dir
mv ovpn_udp nordvpnconfigs

# Do some magic work to include vpn auth path location within Linux Kodachi
printScreen "Starting replacement task";
sleep 1;
rpl -i -w "auth-user-pass" "auth-user-pass ../Own_VPN_Config/nordvpnauth.txt" nordvpnconfigs/* 


################################# Now we validate vpns ###########################
printScreen " " ; 
printScreen "Now we validate vpns";
printScreen " " ;



# Set counters
sameipCounter=0;
i=1;

# Count number of files
xm=$(ls nordvpnconfigs/|wc -l);

# Clean up
rm -f /root/vpnnordbad.txt
rm -f /root/vpnnordgood.txt
echo " " > /root/vpnnordbad.txt
echo " " > /root/vpnnordgood.txt

sleep 2;
	 
# We make sure we have enough number of files
if [ $xm -gt 5 ]
then

	FILES=/root/nordvpnconfigs/*
	for f in $FILES
	do
	  
		gDNS="8.8.8.8";	
		cDNS="1.1.1.1";
		nodeDNS="108.61.10.10";
		
		if !(grep -R $gDNS /etc/resolv.conf > /dev/null)
		then 		
			print_error "DNS has to be changed"
			printScreen "Setting DNS to Cloudflare and Google DNS";
			printScreen ""
			echo -n "nameserver $gDNS"  > /etc/resolv.conf
			echo  " "  >> /etc/resolv.conf
			echo -n "nameserver $cDNS"  >> /etc/resolv.conf
			printScreen " "  >> /etc/resolv.conf
			echo  -n "nameserver $nodeDNS" >> /etc/resolv.conf
			print_good "Google and Cloudflare DNS has been set";
			printScreen "";
			cat /etc/resolv.conf
			sleep 1;
			echo  " ";
		fi
		
	    # Counter
		sameipCounter=$((sameipCounter+1));
	 
		# Get the node ip
	    theIP=$(cat $f|grep "^[^#;]"|grep 'remote '|awk  '{print $2}'); 
	    ping -c1 -W 3 "$theIP" &> /dev/null
		if [ $? -eq 0 ]; 
		then
			print_good "$theIP is live :$f"; 
			echo "$theIP:$f" >> /root/vpnnordgood.txt
			printScreen "";
		else	 
		   print_error "$theIP is dead : Removing file $f"; 
		   echo $f >> /root/vpnnordbad.txt
		   rm -f $f;
		   printScreen "";
		fi
	# Counting stuff	 
	percentage=$((($i*100)/$xm));
	printScreen "$percentage% completed $i out of $xm"; 
	i=$((i+1));
	printScreen "";
		
	     
	done

fi

# Clean old file 
rm -f nordvpnconfigs.zip

# Compress with password
zip -er --password Yourpassowrdhere nordvpnconfigs.zip nordvpnconfigs
rm -f /var/www/html/nordvpnconfigs.zip

# Remove from public html
mv nordvpnconfigs.zip /var/www/html
# Clean up
rm -r -f nordvpnconfigs
rm -r -f $oPath 
rm -f NordVPN.zip

# Returning things as they were before
if !(grep -R $nodeDNS /etc/resolv.conf > /dev/null)
then 
	print_good "Default DNS has been set";
	echo  -n "nameserver 108.61.10.10" > /etc/resolv.conf
fi

exit 1
ShellScript

 


Validating Kern VPN list: 

  • Provider Name: kernVPN
  • List type: html file
  • Retrieval type: Automatic
  • Website: kernvpn.com
  • Used in Linux Kodachi: No
ShellScript
#!/bin/bash
# Script written by Warith Al Maawali  
# (c) 2019 Founder of Eagle Eye Digital Solutions
# https://www.digi77.com
# http://www.om77.net
# script starts here:
# script starts here:



# Get the source directory of a Bash script from within the script 
cd $(dirname $0)

# Printing functions

function print_good(){
    echo -e "\x1B[01;32m[*]\x1B[0m $1"
}


function print_error(){
    echo -e "\x1B[01;31m[!]\x1B[0m $1"
}

function printScreen()
{

       echo $1

}

printScreen "";
printScreen "Script will start now ...";
printScreen "";



if !(dpkg --list zip | egrep -q ^ii); then
    printScreen ""
    printScreen ""   
     print_error "Ops.. zip package is missing we we will try to install it for you if it does not work please use this command $sudo apt-get -y install zip"
    printScreen ""
    printScreen ""
    sudo apt-get -y install zip
fi


if !(dpkg --list jq | egrep -q ^ii); then
    printScreen ""
    printScreen ""   
     print_error "Ops.. jq package is missing we we will try to install it for you if it does not work please use this command $sudo apt-get -y install jq"
    printScreen ""
    printScreen ""
    sudo apt-get -y install jq
fi

if !(dpkg --list rpl | egrep -q ^ii); then
    printScreen ""
    printScreen ""   
     print_error "Ops.. rpl package is missing we we will try to install it for you if it does not work please use this command $sudo apt-get -y install rpl"
    printScreen ""
    printScreen ""
    sudo apt-get -y install rpl
fi



#Main variables
oPath=kernvpnconfigs
rm -f -r $oPath;

#Make directory for saving config files
mkdir -p $oPath


# Clean up
echo "Start ip clean ....";
rm -f kernvpn.txt;
rm -f kernvpn2.txt;
rm -f kerngoodvpn.txt;
rm -f kernbadvpn.txt;
rm -f *.ovpn;
echo "Done with cleaning";

sleep 1;
printScreen "";

printScreen 'Updating VPN servers: DOWNLOADING API......';
if(wget -O kernvpn.txt https://kernvpn.com/free)
then
    print_good "Download went well";
    cat  kernvpn.txt|grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' |uniq > kernvpn2.txt
    printScreen ""
else
    print_error "Download failed of kernvpn api";
    printScreen ""
    exit 1;
fi

# Set counters
ic=1;

# Count number of files
xm=$(cat kernvpn2.txt|wc -l);

for i in $(cat kernvpn2.txt);
do 
    theIP=${i};

        gDNS="8.8.8.8"; 
        cDNS="1.1.1.1";
        nodeDNS="108.61.10.10";

        if !(grep -R $gDNS /etc/resolv.conf > /dev/null)
        then        
            print_error "DNS has to be changed"
            printScreen "Setting DNS to Cloudflare and Google DNS";
            printScreen ""
            echo -n "nameserver $gDNS"  > /etc/resolv.conf
            echo  " "  >> /etc/resolv.conf
            echo -n "nameserver $cDNS"  >> /etc/resolv.conf
            printScreen " "  >> /etc/resolv.conf
            echo  -n "nameserver $nodeDNS" >> /etc/resolv.conf
            print_good "Google and Cloudflare DNS has been set";
            printScreen ""
            cat /etc/resolv.conf
            sleep 1;
            echo  " ";
        fi

    # Check if node is a live then add it to the profile
    ping -c1 -W 3 "$theIP" &> /dev/null
    if [ $? -eq 0 ]; 
    then
        echo "";
        printScreen "Downloading ${i}.ovpn";
        wget -O "$oPath/${i}.ovpn" "https://kernvpn.com/freedo?i=${i}"
        if (grep -R "something went" "$oPath/${i}.ovpn")
        then
            print_error "Bad download will delete the file:${i}";
            rm -f "$oPath/${i}.ovpn";
            printScreen "";
        fi
        print_good "${i} is live";
        echo ${i} >> kerngoodvpn.txt
        printScreen "";
        sleep 1;
    else
        echo "";
        print_error "${i} is dead skipped!";
        echo ${i} >> kernbadvpn.txt
    fi

    # Counting stuff
    percentage=$((($ic*100)/$xm));
    printScreen "$percentage% completed $ic out of $xm"; 
    ic=$((ic+1));
    printScreen "";
done


# Clean old file  
rm -f kernvpnconfigs.zip

# Compress with password
zip -er --password Yourpassword kernvpnconfigs.zip kernvpnconfigs
rm -f /var/www/html/kernvpnconfigs.zip

# Remove from public html
mv kernvpnconfigs.zip /var/www/html

# Clean up 
rm -r -f $oPath 
rm -f kernvpn.txt;
rm -f kernvpn2.txt;

# Returning things as they were before
if !(grep -R $nodeDNS /etc/resolv.conf > /dev/null)
then 
    print_good "Default DNS has been set";
    echo  -n "nameserver 108.61.10.10" > /etc/resolv.conf
fi

exit 1
ShellScript

 


Validating VPN gate list: 

  • Provider Name: VPNgate
  • List type: Api
  • Retrieval type: Automatic
  • Website: vpngate.net/
  • Used in Linux Kodachi: Yes
ShellScript
#!/bin/bash
# Script written by Warith Al Maawali  
# (c) 2019 Founder of Eagle Eye Digital Solutions
# https://www.digi77.com
# http://www.om77.net
# script starts here:
# script starts here:



# Get the source directory of a Bash script from within the script 
cd $(dirname $0)

# Printing functions

function print_good(){
	echo -e "\x1B[01;32m[*]\x1B[0m $1"
}


function print_error(){
	echo -e "\x1B[01;31m[!]\x1B[0m $1"
}

function printScreen()
{
       
       echo $1
       
}

printScreen "";
printScreen "Script will start now ...";
printScreen "";



if !(dpkg --list zip | egrep -q ^ii); then
	printScreen ""
	printScreen ""   
 	print_error "Ops.. zip package is missing we we will try to install it for you if it does not work please use this command $sudo apt-get -y install zip"
	printScreen ""
	printScreen ""
    sudo apt-get -y install zip
fi


if !(dpkg --list jq | egrep -q ^ii); then
	printScreen ""
	printScreen ""   
 	print_error "Ops.. jq package is missing we we will try to install it for you if it does not work please use this command $sudo apt-get -y install jq"
	printScreen ""
	printScreen ""
    sudo apt-get -y install jq
fi

if !(dpkg --list rpl | egrep -q ^ii); then
	printScreen ""
	printScreen ""   
 	print_error "Ops.. rpl package is missing we we will try to install it for you if it does not work please use this command $sudo apt-get -y install rpl"
	printScreen ""
	printScreen ""
    sudo apt-get -y install rpl
fi

# Ips source
url=https://www.vpngate.net/api/iphone/;

#Main variables
oPath=vpngateconfigs
sFile=servers
lFile=logs
tFile=temp

# Clean up
rm -f -r $oPath;

#Make directory for saving config files
mkdir -p $oPath

#Getting list of servers
printScreen 'Updating VPN servers: DOWNLOADING......';
printScreen "";

if (wget -O $tFile -o $lFile $url)
then
	print_good "Yai we got the zip file";

else
	print_error "Failed to download ovpn.zip from $tFile";
	exit 1;

fi

#Has an information gotten?
if ! grep -q '*vpn_servers' $tFile
then
	print_error 'Updating VPN servers: FAIL';
	exit 1
fi

#Deleting useless lines
grep -v '^#\|^\*\|,-,' $tFile > $sFile

#Deleting temp file
rm $tFile

#Deleting old configs
rm -r $oPath/*

sleep 5;

 
 

# Set counter
i=1;
# Count number of files
servercount=$(cat $sFile|wc -l)

#Parse file
while read line
do
	name=$(echo $line | cut -d"," -f1)
	county=$(echo $line | cut -d"," -f7)
	base64=$(echo $line | cut -d"," -f15)
	
	#Debug info don't worry
	#echo $name;
	#echo $county;
	#echo $base64;
	#path=$oPath/$county/$name
	#mkdir -p $oPath/$county $path

	echo $base64| base64 --decode > $oPath/$name'.ovpn' 
	
	#Debug info don't worry
	##Take  sertificates from file and save:
	#Server
	#cat $path/$name'.ovpn' | sed -n '//,/<\/ca>/p' | sed '/\|<\/ca>/d' > $path/ca.pem
	#Client
	#cat $path/$name'.ovpn' | sed -n '//,/<\/cert>/p' | sed '/\|<\/cert>/d' > $path/cert.pem
	#Key
	#cat $path/$name'.ovpn' | sed -n '//,/<\/key>/p' | sed '/\|<\/key>/d' > $path/key.pem
	
	# Counting stuff
	percentage=$((($i*100)/$servercount));
	printScreen "$percentage% completed $i out of $servercount"; 
	i=$((i+1));
	printScreen "";
	
done < $sFile printScreen 'Updating VPN servers done'; echo " " ; # Clean up rm -f $sFile; rm -f $lFile rm -f $tFile ################################# Now we validate vpns ########################### printScreen "Now we validate vpns"; echo " " ; # Set counters i=1; sameipCounter=0; # Count number of files xm=$(ls vpngateconfigs/|wc -l); # Clean up rm -f /root/vpngatebad.txt rm -f /root/vpngategood.txt echo " " > /root/vpngatebad.txt
echo " " > /root/vpngategood.txt

sleep 2;
	 
# We make sure we have enough number of files
if [ $xm -gt 5 ]
then

	FILES=/root/vpngateconfigs/*
	for f in $FILES
	do
	  
		gDNS="8.8.8.8";	
		cDNS="1.1.1.1";
		nodeDNS="108.61.10.10";
		
		if !(grep -R $gDNS /etc/resolv.conf > /dev/null)
		then 		
			print_error "DNS has to be changed"
			printScreen "Setting DNS to Cloudflare and Google DNS";
			printScreen ""
			echo -n "nameserver $gDNS"  > /etc/resolv.conf
			echo  " "  >> /etc/resolv.conf
			echo -n "nameserver $cDNS"  >> /etc/resolv.conf
			echo " "  >> /etc/resolv.conf
			echo  -n "nameserver $nodeDNS" >> /etc/resolv.conf
			print_good "Google and Cloudflare DNS has been set";
			printScreen ""
			cat /etc/resolv.conf
			sleep 1;
			echo  " ";
		fi
		
	    
		 
		# Get the node ip
	    theIP=$(cat $f|grep "^[^#;]"|grep 'remote '|awk  '{print $2}'); 
		
	    ping -c1 -W 3 "$theIP" &> /dev/null
		if [ $? -eq 0 ]; 
		then
			print_good "$theIP is live :$f"; 
			echo "$theIP:$f" >> /root/vpngategood.txt
			printScreen "";
		else
		    print_error "$theIP is dead : Removing file $f"; 
		   echo $f >> /root/vpngatebad.txt
		   rm -f $f;
		   		    
		fi
		 
		# Counting stuff	 
		percentage=$((($i*100)/$xm));
		printScreen "$percentage% completed $i out of $xm"; 
		i=$((i+1));
		printScreen "";
		
	     
	done

fi


# Clean old file 
rm -f vpngateconfigs.zip

# Compress with password
zip -er --password Yourpassowrdhere vpngateconfigs.zip vpngateconfigs
rm -f /var/www/html/vpngateconfigs.zip

# Remove from public html
mv vpngateconfigs.zip /var/www/html

# Clean up
rm -r -f $oPath 

# Returning things as they were before
if !(grep -R $nodeDNS /etc/resolv.conf > /dev/null)
then 
	print_good "Default DNS has been set";
	echo  -n "nameserver 108.61.10.10" > /etc/resolv.conf
fi

exit 1 
ShellScript

Now, you might ask why I don’t just use OpenVPN to check these nodes. I tried that approach, but it is much slower and takes ages to complete because you have to go through the handshake process, which is quite time-consuming. 


 

Posted in Tech Blog
© 2024 Warith AL Maawali. All Rights Reserved.
Stay Secure, Stay Assured.