Validating VPN nodes

Validating VPN nodes

Have you ever wondered how Linux Kodachi has most of its VPN nodes valid though they are from different providers ? On this post I will be explaining in details the process of validation VPN nodes from different providers that Linux Kodachi uses on server side that is automatically triggered by a cron job.

 

Each VPN provider has their own method of proving you with the list of nodes some would provide compressed zip file some api and some just normal html page. Now within those lists you get invalid nodes (offline VPNs) which you do not want to include for the users. In order to exclude offline from online once you have to code it using the language you prefer in my case it was shell scripting as I am doing this on Linux box.

 

Validating hideme VPN list:

 
Provider Name: HidemeVPN
List type: API
Retrieval type: Automatic
Website: hide.me
Used in Linux Kodachi: Yes

#!/bin/bash
# Script written by Warith Al Maawali  
# (c) 2019 Founder of Eagle Eye Digital Solutions
# http://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-x509-name "*.hide.me" name
key-direction 0


-----BEGIN CERTIFICATE-----
MIIKJDCCBgygAwIBAgIQVc9ekKx5ZIkHcGchmaaVEzANBgkqhkiG9w0BAQ0FADCB
kTELMAkGA1UEBhMCTVkxHDAaBgNVBAgME1dpbGF5YWggUGVyc2VrdXR1YW4xDzAN
BgNVBAcMBkxhYnVhbjEZMBcGA1UECgwQZVZlbnR1cmUgTGltaXRlZDEe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UOnNImqDeXE/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

 


 

Validating Proton VPN list:

 

Provider Name: protonVPN
List type: API
Retrieval type: Automatic
Website: protonvpn.com
Used in Linux Kodachi: Yes

#!/bin/bash
# Script written by Warith Al Maawali  
# (c) 2019 Founder of Eagle Eye Digital Solutions
# http://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
MBMGA1UEChMMUHJvdG9uVlBOIEFHMRowGAYDVQQDExFQcm90b25WUE4gUm9vdCBD
QTAeFw0xNzAyMTUxNDM4MDBaFw0yNzAyMTUxNDM4MDBaMEAxCzAJBgNVBAYTAkNI
MRUwEwYDVQQKEwxQcm90b25WUE4gQUcxGjAYBgNVBAMTEVByb3RvblZQTiBSb290
IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAt+BsSsZg7+AuqTq7
vDbPzfygtl9f8fL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KFxB0wfWd/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
MBMGA1UEChMMUHJvdG9uVlBOIEFHMRowGAYD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Rv
blZQTiBBRzEaMBgGA1UEAxMRUHJvdG9uVlBOIFJvb3QgQ0GCAQEwCwYDVR0PBAQD
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 < 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

 


 

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

#!/bin/bash
# Script written by Warith Al Maawali  
# (c) 2019 Founder of Eagle Eye Digital Solutions
# http://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