diff --git a/.gitignore b/.gitignore index e66d423..ef6fa71 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ *.gpg *.asc *.pgp +*.age *.csv *.json *.zip diff --git a/backupBitwarden.ps1 b/backupBitwarden.ps1 index a5a3b93..5bfaeb0 100644 --- a/backupBitwarden.ps1 +++ b/backupBitwarden.ps1 @@ -1,11 +1,11 @@ param ( [switch]$zip, - [switch]$gpg + [switch]$encrypt ) # get the date/time for the back filename $dateTime = get-date -format ("yyyyMMdd-HHmmss") -$env:Path += ";$PSScriptRoot\lib;$PSScriptRoot\lib\gpg\bin" +$env:Path += ";$PSScriptRoot\lib;$PSScriptRoot\lib\gpg\bin;$PSScriptRoot\lib\age" bw config server https://bitwarden.johnhgaunt.com while ($true) { @@ -74,14 +74,15 @@ $itemsWithAttachments | foreach { $zipFilename = "Bitwarden Backup $dateTime.zip" -if ($zip -or $gpg) { +if ($zip -or $encrypt) { Write-Host "Zipping the backup together..." Compress-Archive -Path $PSScriptRoot\*.csv, $PSScriptRoot\*.json, $PSScriptRoot\attachments -DestinationPath "$PSScriptRoot\$zipFilename" Write-Host "Securely deleting the exports and attachments..." sdelete64.exe -s -p 5 $PSScriptRoot\*.csv $PSScriptRoot\*.json $PSScriptRoot\attachments - if ($gpg) { + if ($encrypt) { Write-Host "Encrypting the backup zip with your bitwarden password..." gpg.exe --batch --passphrase "$password" --symmetric --cipher-algo AES256 --digest-algo SHA512 --output "$PSScriptRoot\$zipFilename.gpg" "$PSScriptRoot\$zipFilename" + Write-Host "Securely deleting the zip file..." sdelete64.exe -p 5 "$PSScriptRoot\$zipFilename" } } diff --git a/lib/age/LICENSE b/lib/age/LICENSE new file mode 100644 index 0000000..7d4117e --- /dev/null +++ b/lib/age/LICENSE @@ -0,0 +1,57 @@ +Copyright 2019 Google LLC + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google LLC nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +--- + +Copyright (c) 2009 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/lib/age/age-keygen.exe b/lib/age/age-keygen.exe new file mode 100644 index 0000000..590da3f Binary files /dev/null and b/lib/age/age-keygen.exe differ diff --git a/lib/age/age.exe b/lib/age/age.exe new file mode 100644 index 0000000..2a3f2ad Binary files /dev/null and b/lib/age/age.exe differ