FreeVPN auto Connect Linux

Discuss how to write good code, break bad code, your current pet projects, or the best way to approach novel problems

FreeVPN auto Connect Linux

Post by hackuin60s on Fri Aug 08, 2014 2:40 am
([msg=82645]see FreeVPN auto Connect Linux[/msg])

Note:
Please check your correct interface [ eth0/eth1/wlan0 ]
Tested on Bugtraq [Black widow], 3.2.0-60-generic x86_64 GNU/Linux, Shell: zsh
Code: Select all
####
#
#!/usr/bin/env bash
#: Script for Free VPN.
#: From:      http://freevpn.me/accounts
#: Author:    hackuin
#: Email:     hackuin@ymail.com
#
####

#: Checking for UID Zero, That is root.
ROOT_UID=0
ERROR_MSG=87

if [ "$UID" -ne "$ROOT_UID" ]
then
    echo "You must be Root user."
    echo "Or Use sudo."
    exit $ERROR_MSG
fi

#: wget the file
TGT="http://freevpn.me/accounts"
wget -O freevpn $TGT 2>/dev/null

cat freevpn|sed 's/<[./]*l[li]>/\n/g' |awk 'NF'|grep -Ew 'Username|IP|Password'|tr -d '</b>'|head -3 |tee vpfile

IPADDR=$(cat vpfile|grep IP|awk '{print $2}')
USER=$(cat vpfile|grep User|awk '{print $2}')
PASS=$(cat vpfile|grep Pass|awk '{print $2}')


#: Configuring VPN Peers

cat << __E0f > /etc/ppp/peers/freevpn
pty "pptp $IPADDR --nolaunchpppd "
name pptp
remotename pptp
require-mppe
refuse-eap
file /etc/ppp/options.pptp
ipparam pptp
noauth
usepeerdns
__E0f

#: Configuring Authentication

cat << __E0f > /etc/ppp/chap-secrets
$USER pptp $PASS *
__E0f

#: Please select your correct IFACE
sudo nohup pon freevpn 2>/dev/null
sleep 5
sudo route del default eth0
sudo route add default dev ppp0

U_IP=$(curl my.ip.fi 2>/dev/null)
echo -e "Your IP address (my.ip.fi): $U_IP"


ScreenShot:
http://i.imgur.com/gD0xVTy.png
-Hackuin
Certified: RHCSA, RHCE, CCNA.
Free software" is a matter of liberty, not price. To understand the concept, you should think of "free" as in "free speech," not as in "free beer."
User avatar
hackuin60s
New User
New User
 
Posts: 25
Joined: Mon Apr 14, 2008 3:17 pm
Blog: View Blog (0)


Return to Programming

Who is online

Users browsing this forum: No registered users and 0 guests