GrassClipper/scripts/install.cmd

43 lines
1.5 KiB
Batchfile
Raw Normal View History

2022-04-20 05:16:56 +00:00
@echo off
2022-04-22 00:05:00 +00:00
:: Ensure admin
>nul 2>&1 reg query "HKU\S-1-5-19" || (
set params = %*:"="""%
cd /d "%~dp0" && ( if exist "%temp%\getadmin.vbs" del "%temp%\getadmin.vbs" ) && fsutil dirty query %systemdrive% 1>nul 2>nul || ( echo Set UAC = CreateObject^("Shell.Application"^) : UAC.ShellExecute "cmd.exe", "/k cd ""%~sdp0"" && %~s0", "", "runas", 1 >> "%temp%\getadmin.vbs" && "%temp%\getadmin.vbs" && exit /B )
)
2022-04-20 05:16:56 +00:00
echo Downloading proxy server...
if not exist "./ext" mkdir "ext"
if not exist "./temp" mkdir "temp"
:: Begin by retrieving mitmproxy 8.0.0
2022-04-20 23:28:18 +00:00
powershell Invoke-WebRequest -Uri https://snapshots.mitmproxy.org/8.0.0/mitmproxy-8.0.0-windows.zip -OutFile "./temp/mitmproxy-8.0.0-windows.zip"
2022-04-20 05:16:56 +00:00
2022-04-20 05:31:23 +00:00
echo Extracting...
2022-04-20 05:16:56 +00:00
:: Extract from temp/ to ext/ with powershell
2022-04-20 23:28:18 +00:00
powershell Expand-Archive -Path "./temp/mitmproxy-8.0.0-windows.zip" -DestinationPath "./ext/" -Force
2022-04-20 05:16:56 +00:00
2022-04-20 05:31:23 +00:00
del /s /q "./temp"
2022-04-20 23:27:40 +00:00
echo Running proxy server in order to generate certificates...
:: Start proxy server
start "Proxy Server" ./ext/mitmdump.exe --ssl-insecure --set ip=%ip%
:: Allow the proxy server to create the certificates
ping 127.0.0.1 -n 6 > nul
2022-04-20 05:40:13 +00:00
2022-04-20 23:27:40 +00:00
:: Kill the process
taskkill /f /im mitmdump.exe
:: Ensure we are elevated for certs
>nul 2>&1 certutil -addstore root %USERPROFILE%\.mitmproxy\mitmproxy-ca-cert.cer || (
echo Certificate install failed, ensure the script is running as Administrator and that the path "%USERPROFILE%\.mitmproxy" exists,
)
echo Done! You can now open GrassClipper.exe!
pause