-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
install.ps1
40 lines (32 loc) · 1.53 KB
/
install.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Define URLs for Tor Expert Bundle and GeckoDriver
$torURL = "https://archive.torproject.org/tor-package-archive/torbrowser/13.0/tor-expert-bundle-13.0-windows-x86_64.tar.gz"
$geckoURL = "https://github.com/mozilla/geckodriver/releases/download/v0.34.0/geckodriver-v0.34.0-win64.zip"
# Define target directories for installation
$torDir = "$env:USERPROFILE\tor2tor\Tor"
$geckoDir = "$env:USERPROFILE\tor2tor\GeckoDriver"
# Function to download a file
function DownloadFile([string]$url, [string]$path) {
Invoke-WebRequest -Uri $url -OutFile $path
}
# Check if Tor directory exists, if not create and download
if (-Not (Test-Path $torDir)) {
New-Item -Path $torDir -ItemType Directory
Write-Host "Downloading Tor..."
DownloadFile $torURL "$torDir\tor.tar.gz"
# Unpacking the Tor archive
tar -xf "$torDir\tor.tar.gz" -C $torDir
Remove-Item "$torDir\tor.tar.gz"
}
# Check if GeckoDriver directory exists, if not create and download
if (-Not (Test-Path $geckoDir)) {
New-Item -Path $geckoDir -ItemType Directory
Write-Host "Downloading GeckoDriver..."
DownloadFile $geckoURL "$geckoDir\geckodriver.zip"
# Unzipping the GeckoDriver
Expand-Archive -Path "$geckoDir\geckodriver.zip" -DestinationPath $geckoDir
Remove-Item "$geckoDir\geckodriver.zip"
}
# Add the geckodriver directory to PATH
[Environment]::SetEnvironmentVariable("PATH", [Environment]::GetEnvironmentVariable("PATH", [EnvironmentVariableTarget]::User) + ";$geckoDir", [EnvironmentVariableTarget]::User)
pip install .
Write-Host "Setup complete."