The Art of Efficiency: Automating Recurring Tasks

Recently, in an interview for a cybersecurity company, I was talking about my old scripts, mostly written in Bash. And I rediscovered a very short script that has a story behind and shows how a small lazyness can lead to writing code. When you want to code something but don’t know what to do, because “this or that already exists so it’s pointless”, it could be a good starting point.

Since 2013, a free VPN is available for all, (But be careful when using a free VPN). They provide a few ovpn files for TCP and UDP connection. A username and password for connecting their VPN are displayed on the same page, you need to use them on your VPN client for getting access.

In 2016 when I discovered this website, it was still possible at that time to copy/paste the code, it was written in text as you can see if you try to select it on this archive taken at the same period : Free VPN Accounts • 100% Free PPTP and OpenVPN Service (

Homepage on archived on the Wayback Machine showing 3 columns: free pptp vpn, free openvpn and donate

At that period, because I was bored of opening the web browser or a new tab for going to this page everyday, for copying the password written bottom page, opening a terminal, executing OpenVPN and then pasting the password (which was valid just for a few days, the username was always the same), I decided to make it simple.

It was possible to select the text with the pointer as we can see below, which means it was possible to grab it directly in the source code.

Focus on the credentials, in 2016 the password can be selected with the mouse

Then when the webapge was open, you had to copy it with Ctrl+C or right click and the “Copy” option, and to paste it in you VPN client, whether it’s a command line interface or GUI mode.

So I wrote a short script for getting the password and execute OpenVPN CLI in a row: passvpn
(This Github profile is my former one, which I can’t access anymore. The new one is here).

The goal of this script was to capture the password using 2 simple regular expressions. First, it gets the source code with wget, and second, it looks for the word “Password” in the HTML source code. For finding it, it looks for the third “less-than” symbol (<) by using the cut command(cut -d '<' -f 3), looks for the second “greater-than” symbol (>) still with the cut command (cut -d '>' -f 2), and gets the string written in between.

Screenshot of the short code written for getting automatically the password, it's made with a wget command for getting the source code, a variable created and contaning cat, grep, cut, cut and uniq commands, and an echo command for showing the captured password
screenshot showing the source code and explaining how the cut commands delimit the password

So, by executing this script, the password was displayed directly in the terminal before executing OpenVPN. I just had to type the passcode written on top.

Just as an example I’ve just adapted the script for getting the source code from the archived version of VPNBook, mentioned above, on the Wayback Machine (The warning for the deprecated method in the ovpn file was not displayed in 2016).

Screenshot showing the captured password, the initial script has been adapted for getting the password on the Wayback Machine version

Since a few years, this script is not usable anymore, because VPNBook made an invisible change on their website. The font used for the string looks similar but it’s now displayed as an image, as we can see if we try to select the password on the current website.

Screenshot showing that the credentials can not be selected with the mouse anymore on VPNBook's new homepage, an image shows the text composing the password, it's not directly written anymore

Is it a coincidence or did they modify it because of my script? Never got a clear answer about this, but it could be funny if I made them change their page because of my lazyness for recurring things. The reason for this modification could be to force us to visit their website and display their ads, even if I’ve never seen any of them, and/or to lead us to the donation form on the right side of the webpage, maybe.

Be lazy, be creative, and try to automate every repetitive action in your daily life.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Creative Commons License CC BY-SA 4.0