Merge branch 'izk666-master-patch-40997' into 'master'
Enhanced script for extra privacy See merge request librewolf-community/browser/windows!3
This commit is contained in:
commit
12f0a5c732
1 changed files with 68 additions and 19 deletions
87
package.ps1
87
package.ps1
|
|
@ -1,30 +1,79 @@
|
|||
# delete old things...
|
||||
Remove-Item -Path firefox.exe -Force
|
||||
Remove-Item -Path librewolf -Force
|
||||
Import-Module BitsTransfer
|
||||
|
||||
$ProgramName = "*Mozilla*Firefox*"
|
||||
$installPath = Get-ChildItem "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*" | Where-Object { $_.getValue('DisplayName') -like $ProgramName } | ForEach-Object { $_.getValue('InstallLocation')}
|
||||
|
||||
# windows download version lastest win64
|
||||
$url = "https://download.mozilla.org/?product=firefox-latest-ssl&os=win64"
|
||||
if (!$installPath) {
|
||||
|
||||
# windows download version lastest win32
|
||||
#$url = "https://download.mozilla.org/?product=firefox-latest-ssl&os=win"
|
||||
# Choose firefox flavor
|
||||
write-host ""
|
||||
write-host "1 - Download Firefox"
|
||||
write-host "2 - Download Firefox Extended Support Release"
|
||||
write-host ""
|
||||
write-host "E - Exit"
|
||||
write-host ""
|
||||
write-host -nonewline "Type your choice and press Enter: "
|
||||
|
||||
$downloadfile = "$PSScriptRoot\firefox.exe"
|
||||
$choice = read-host
|
||||
switch -Regex ( $choice ) {
|
||||
1 { Write-Host "Firefox" -ForegroundColor Green; $url = "https://download.mozilla.org/?product=firefox-latest-ssl&os=win"}
|
||||
2 {Write-Host "Firefox ESR" -ForegroundColor Green; $url = "https://download.mozilla.org/?product=firefox-esr-latest-ssl&os=win"}
|
||||
default { exit }
|
||||
}
|
||||
if ([IntPtr]::size -eq 8) { # Check if the system is 64bit and download the correct version
|
||||
$url += "64"
|
||||
}
|
||||
|
||||
Write-Output "Downloading to $downloadfile"
|
||||
$downloadfile = "\FirefoxInstaller.exe"
|
||||
Write-Output "Downloading firefox..."
|
||||
Start-BitsTransfer -Source $url -Destination $downloadfile
|
||||
|
||||
# download firefox
|
||||
Invoke-WebRequest -Uri $url -outfile $downloadfile
|
||||
Write-Output ""
|
||||
Write-Output "Installing Firefox. Please, follow the wizard"
|
||||
Start-Process $downloadfile -NoNewWindow -Wait
|
||||
|
||||
Write-Output "Extracting $downloadfile to librewolf"
|
||||
# extract with 7zip
|
||||
& "$PSScriptRoot\7za.exe" x -olibrewolf .\firefox.exe
|
||||
# Check if firefox is running and kill
|
||||
while ($firefox = Get-Process firefox -ErrorAction SilentlyContinue) {
|
||||
$firefox | Stop-Process -Force
|
||||
Sleep 3
|
||||
}
|
||||
|
||||
# Check if firefox is installed
|
||||
Remove-Item $downloadfile
|
||||
$installPath = Get-ChildItem "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*" | Where-Object { $_.getValue('DisplayName') -like $ProgramName } | ForEach-Object { $_.getValue('InstallLocation')}
|
||||
if (!$installPath) {
|
||||
Write-Output "Firefox can't be located. Process can't continue"
|
||||
exit
|
||||
}
|
||||
|
||||
} else {Write-Host "Firefox is installed" }
|
||||
|
||||
# Check if firefox is running and kill
|
||||
while ($firefox = Get-Process firefox -ErrorAction SilentlyContinue) {
|
||||
$firefox | Stop-Process -Force
|
||||
Sleep 3
|
||||
}
|
||||
|
||||
Write-Output "Delete files with privacy....."
|
||||
# remove contact with mothership
|
||||
Remove-Item -Path librewolf\core\crashreporter.exe -Force
|
||||
Remove-Item -Path librewolf\core\updater.exe -Force
|
||||
Remove-Item -Path librewolf\core\pingsender.exe -Force
|
||||
Remove-Item -Path $installPath\crashreporter.exe -Force
|
||||
Remove-Item -Path $installPath\updater.exe -Force
|
||||
Remove-Item -Path $installPath\pingsender.exe -Force
|
||||
|
||||
Write-Output "Extra privacy..."
|
||||
$bytes = [System.IO.File]::ReadAllBytes("$installPath\omni.ja")
|
||||
$hexString = [System.BitConverter]::ToString($bytes)
|
||||
$offset = $hexString.IndexOf("3F-20-22-68-74-74-70-73-3A-2F-2F-66-69-72-65-66-6F-78-2E-73-65-74-74-69-6E-67-73-2E-73-65-72-76-69-63-65-73-2E-6D-6F-7A-69-6C-6C-61-2E-63-6F")
|
||||
$offset = $offset/3
|
||||
$bytes[$offset+3] = 34 # write "
|
||||
$bytes[$offset+4] = 59 # write ;
|
||||
$bytes[$offset+5] = 47 # write /
|
||||
$bytes[$offset+6] = 47 # write /
|
||||
[System.IO.File]::WriteAllBytes("C:\Program Files\Mozilla Firefox\omni2.ja", $bytes)
|
||||
Remove-Item -Path $installPath\omni.ja -Force
|
||||
Rename-Item -Path $installPath\omni2.ja omni.ja
|
||||
Write-Output "Copy librewolf settings"
|
||||
Copy-Item -Path "$PSScriptRoot\settings\*" -Destination "$PSScriptRoot\librewolf\core" -Recurse -force
|
||||
|
||||
$scriptPath = Split-Path -Path $MyInvocation.MyCommand.Path
|
||||
Copy-Item "$scriptPath\settings\*" -Destination "$installPath" -Recurse -Force
|
||||
|
||||
Write-Output "Enjoy"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue