Thoughts on a panel applet that does the PIA homepage check to monitor "protected" or not?

Hi all,

One of the things I find I am in a habit of doing is hitting the pia home page to "get the green" so to speak.

I use a number of different linux distros and generally don't bother with the thick-client and do the setup in openVPN.

I got to thinking that a bash script, python or javascript applet could monitor the header on the pia homepage and by a simple curl or wget and grep determine if the http request returns "You are protected by PIA"...

I did a bash script that uses wget to pull the page then pipes cat index.html to grep with an if statement that checks for the relevant text - but I don't really know how to code properly and wondered if anyone had tackled something like this for general openvpn tunnel heart-beat type monitoring.

I thought a cinnamon panel applet (javascript) that had a simple green or red light and could be clicked to force the check and maybe a popup notification if the state changed between regular automated checks (say every 5 min) could be very useful?

Don't really know where to start beyond what I've tried so I thought I'd throw the idea out and see if anyone else is interested or relates to the usecase...

Writing applets seems relatively easy once you get started...



  • Posts: 353
    try scraping this instead

    and write your first version with bash (and awk and/or sed and/or grep and/or ...)

  • edited August 2017 Posts: 3
    Cool; so here is a successful start.  very crude I know

    will@willixps15:~/Code$ ./ 
    you are protected by pia
    will@willixps15:~/Code$ ./ 
    you are not protected by pia
    will@willixps15:~/Code$ ./ 
    you are protected by pia
    will@willixps15:~/Code$ ls
    first_output.txt  scrape-data.txt

    so switching the vpn off and back on yielded the hoped for results.

    here is the script

    will@willixps15:~/Code$ cat 
            wget -q -O scrape-data.txt ; 
            if grep 'You are protected by PIA' scrape-data.txt > first_output.txt
                    echo "you are protected by pia"
                    echo "you are not protected by pia"

    Now I need to work out how to write an applet that calls this and does it with the cinnamon dock

    crude attempt to frame up something that will start the applet ball rolling - doesn't work.  Some problem converting the .sh to utf8.

    root@willixps15:/usr/share/cinnamon/applets# cd check_pia\
    root@willixps15:/usr/share/cinnamon/applets/ cat applet.js 
    const Applet = imports.ui.applet;
    const Util = imports.misc.util;

    function check_pia(orientation, panel_height, instance_id) {
                this._init(orientation, panel_height, instance_id);

    check_pia.prototype = {
                __proto__: Applet.IconApplet.prototype,

                _init: function(orientation, panel_height, instance_id) {
                      , orientation, panel_height, instance_id);

                                this.set_applet_icon_name("PIA Checker");
                                this.set_applet_tooltip(_("Click here to check PIA"));

                on_applet_clicked: function() {

    function main(metadata, orientation, panel_height, instance_id) {
                return new check_pia(orientation, panel_height, instance_id);

    Post edited by gnutoo on
  • Posts: 353
    yep. example of why people who do this kind of work are 'Developers'.

    now, there's all sorts of good information on that whats-my-ip page. get more of it with a command line option? always good to self-document with the output from the --help option. try next to not use temp files.
  • Posts: 3
    Yes, rather than worry about the applet I think I'll try to get a shell script that writes a text file with a good portion of the information I can scrape and then that could form the basis of an applet that simply presents the text in that file.
Sign In or Register to comment.