-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStart.bat
57 lines (45 loc) · 1.79 KB
/
Start.bat
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
@echo off
:: Check if the script is running as administrator
NET SESSION >NUL 2>&1
IF %ERRORLEVEL% EQU 0 (
goto :check_torrc
) else (
echo Requesting administrator privileges...
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
del "%temp%\getadmin.vbs"
exit /B
)
:check_torrc
:: Check if torrc file exists, create it if not
set torrcDir=C:\Users\%USERNAME%\AppData\Roaming\tor
set torrcPath=%torrcDir%\torrc
if not exist "%torrcPath%" (
echo Creating torrc file...
echo SocksPort 9050 > "%torrcPath%"
echo torrc file created at "%torrcPath%"
)
:start
set proxyAddress=127.0.0.1
set proxyPort=8118
echo Enabling manual proxy settings...
:: Enabling manual proxy settings using windows registry.
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 1 /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /d "%proxyAddress%:%proxyPort%" /f
echo Starting Tor and Privoxy...
REM I used here `privoxy.exe.lnk` (shortcut a shortcut of privoxy.exe) because when i tried to run `privoxy.exe` it didn't work.
start "" "%~dp0privoxy\privoxy.exe.lnk"
start /B "" "%~dp0tor\tor.exe"
timeout /t 5
CLS
echo Tor and Privoxy are running. Press any key to close them and disable the manual proxy settings.
echo.
pause >nul
echo.
taskkill /IM tor.exe /F
taskkill /IM privoxy.exe /F
echo Disabling manual proxy settings...
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f
echo Tor and Privoxy have been closed, and manual proxy settings have been disabled.
pause