Fetch Free VPN From VPNBook.com

A simple code for fetching the free VPN account from VPNBook.com. It is an awesome VPN site!

The addresses are (updated Nov. 29):

  • euro217.vpnbook.com
  • euro214.vpnbook.com
  • us1.vpnbook.com
  • us2.vpnbook.com
  • ca1.vpnbook.com
  • de233.vpnbook.com

Below is the Python code.

import urllib2, re
def getVPNBookPassword():
    try:
        response = urllib2.urlopen("http://www.vpnbook.com/freevpn")
        html = response.read()
    except:
        print "something is wrong with Internet"
        exit(1)
    un = re.findall(r'Username(?:</\w+>)?: (?:<\w+>)?([a-zA-Z0-9]+)(?:</\w+>)?', html)[0]
    pw = re.findall(r'Password(?:</\w+>)?: (?:<\w+>)?([a-zA-Z0-9]+)(?:</\w+>)?', html)[0]
    print un, pw
if __name__ == '__main__':
    getVPNBookPassword()

Notice they are free so you might need to be cautious on entering your password (since it is not going through https mostly).

Leave a Reply

Your email address will not be published. Required fields are marked *