Skip to main content
Question

PIA Download via Curl

  • March 11, 2019
  • 6 replies
  • 27 views

Forum|alt.badge.img+5

So I use to have a script that downloaded PIA VPN but now when I run a curl command on terminal using ' curl https://www.privateinternetaccess.com/installer/x/download_installer_osx '
it just shows the website in plain text rather than an app can anyone offer any insights what is the best way to go about this?

6 replies

Mauricio11
Forum|alt.badge.img+11
  • Valued Contributor
  • March 13, 2019

Hello Euwan

The file address is https://installers.privateinternetaccess.com/download/pia-macos-1.1.1-02545.zip

You could try

curl --silent "https://installers.privateinternetaccess.com/download/pia-macos-1.1.1-02545.zip" -o /tmp/pia-macos.zip

Is this part of any automated process?


Forum|alt.badge.img+5
  • Author
  • Contributor
  • March 13, 2019

Yea it is automated got it sorted now. Used this script

!/bin/bash

Make Temp Directory

mkdir -p /Volumes/Macintosh HD/Users/Shared/temp

Go to temp

cd /Volumes/Macintosh HD/Users/Shared/temp

download PIA text file with updated .zip name

curl -LO https://www.privateinternetaccess.com/installer/x/download_installer_osx

isolate the zip URL and ZIP file name

PIAURL=$(cat download_installer_osx | grep .zip | grep -Eo "(http|https)://[a-zA-Z0-9./?=-]")

PIAZIP=$(ls | grep *.zip)

Download zip file

curl -LO $PIAURL

Unzip files

unzip $PIAZIP

sleep 30

Run PIA Installer

open /Volumes/Macintosh HD/Users/Shared/temp/Private Internet Access Installer.app

sleep 100

Remove Temp Directory

rm -rf /Volumes/Macintosh HD/Users/Shared/temp

exit


Forum|alt.badge.img+3
  • New Contributor
  • March 14, 2019

@Euwanh Thanks for the script. I have something similar I want to achieve but I want the site i'm going to to m.meraki.com requires that I input a value. I've used the POST command to add value but may be doing it wrong. Any suggestions?


Forum|alt.badge.img+5
  • Author
  • Contributor
  • September 2, 2019

@tomatoes27 sorry for the very long delay did you need further assistance with this? I know how daunting it can be when you first start using jamf and then have to write scripts


Forum|alt.badge.img+6
  • Contributor
  • October 17, 2022

Yea it is automated got it sorted now. Used this script

!/bin/bash

Make Temp Directory

mkdir -p /Volumes/Macintosh HD/Users/Shared/temp

Go to temp

cd /Volumes/Macintosh HD/Users/Shared/temp

download PIA text file with updated .zip name

curl -LO https://www.privateinternetaccess.com/installer/x/download_installer_osx

isolate the zip URL and ZIP file name

PIAURL=$(cat download_installer_osx | grep .zip | grep -Eo "(http|https)://[a-zA-Z0-9./?=-]")

PIAZIP=$(ls | grep *.zip)

Download zip file

curl -LO $PIAURL

Unzip files

unzip $PIAZIP

sleep 30

Run PIA Installer

open /Volumes/Macintosh HD/Users/Shared/temp/Private Internet Access Installer.app

sleep 100

Remove Temp Directory

rm -rf /Volumes/Macintosh HD/Users/Shared/temp

exit


Three years later I find this solution. But somehow your GREP only returns 'https://i' Maybe something went wrong with the copy/paste in here?

GREP is not my specialty, so I am having a hard time trying to get it to work. If anyone has any tips?


Forum|alt.badge.img+6
  • Contributor
  • June 28, 2023

Managed to get the script working at least. But then the installer gives a prompt to install a helper app and requiring a password. Guess that there is no way around this.....

#!/bin/bash #Go to downloadsfolder cd ~/Downloads #download PIA text file with updated .zip name curl -LO https://www.privateinternetaccess.com/installer/x/download_installer_osx #isolate the zip URL name PIAURL=$(cat download_installer_osx | grep .zip | grep -Eo "https://.+\\.zip") sleep 10 #Download zip file curl -LO $PIAURL sleep 10 #isolate the zip file name PIAZIP=$(ls | grep pia*.zip) #Unzip files unzip $PIAZIP sleep 10 #Run PIA Installer open ~/Downloads/Private\\ Internet\\ Access\\ Installer.app sleep 100 exit