-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathSTART_538.bat
81 lines (72 loc) · 2.59 KB
/
START_538.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
@echo off
SET RootDir=%~dp0
SET ExeName=pcap538_x64.msi
SET LookForExe=%RootDir%files\%ExeName%
SET SettingsBackupDir=%RootDir%settingsBackup
REM Get installation dir from registry
FOR /F "skip=2 tokens=2,*" %%A IN ('reg.exe query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v "ProxyCap"') DO set "InstallDir=%%B"
rem Add below a url with your settings backup for persistance
rem SET settingsUrl="http://localhost/proxycap_backup_settings.prs"
set BackupFile=%date:~10,4%%date:~7,2%%date:~4,2%%time:~0,2%%time:~3,2%%time:~6,2%_machine.prs
if not exist %SettingsBackupDir% mkdir %SettingsBackupDir%
copy %ProgramData%\ProxyCap\machine.prs "%RootDir%settingsBackup\%BackupFile%"
rem Start WebServer for settings persistance
start /D %RootDir%settingsBackup\ %RootDir%files\simpleWebServer.exe
SET settingsUrl="http://localhost:8080/%BackupFile%"
SET BackupFile="%RootDir%settingsBackup\%BackupFile%"
if not exist %RootDir%files\ mkdir %RootDir%files\
reg Query "HKLM\Hardware\Description\System\CentralProcessor\0" | find /i "x86" > NUL && set OS=32BIT || set OS=64BIT
if %OS%==32BIT GOTO Arc_x86
if %OS%==64BIT GOTO Arc_x64
:Arc_x86
echo This is a 32bit operating system - this script is for 64bit OS
GOTO Closethis
:Arc_x64
echo 64bit OS detected...
:check_Permissions
net session >nul 2>&1
if %errorLevel% == 0 (
goto DownloadEXE
) else (
echo Please run as administrator...
TIMEOUT /T 5 >nul
GOTO Closethis
)
:DownloadEXE
IF EXIST %LookForExe% GOTO START
echo Downloading %ExeName% ...
powershell Invoke-WebRequest -Uri "https://www.proxycap.com/download/%ExeName%" -OutFile "%RootDir%files\%ExeName%"
:START
cls
echo [DONE] Downloading %ExeName% ...
echo Terminating pcapui.exe...
net stop pcapsvc
taskkill /F /IM "pcapui.exe" >nul
reg delete "HKEY_LOCAL_MACHINE\Software\WOW6432Node\Proxy Labs" /f
reg delete "HKEY_LOCAL_MACHINE\Software\WOW6432Node\SB" /f
reg delete "HKEY_LOCAL_MACHINE\System\ControlSet001\Services\pcapsvc" /f
reg delete "HKEY_LOCAL_MACHINE\System\ControlSet001\Services\Tcpip\Parameters\Arp" /f
cls
echo [DONE] Deleting old registry keys...
echo [DONE] Terminating pcapui.exe...
echo "Repairing" ProxyCap...
IF [%settingsUrl%] == [] GOTO NOSETTINGS
:SETTINGS
cmd /c %LookForExe% /qn /norestart PROXYCAPRULESETURL=%settingsUrl%
GOTO REPAIR
:NOSETTINGS
cmd /c %LookForExe% /qn /norestart
:REPAIR
cls
echo [Done] Repairing ProxyCap...
TIMEOUT /T 1 >nul
net start pcapsvc
START "" "%InstallDir%"
GOTO Closethis
:Closethis
taskkill /f /im simpleWebServer.exe
cls
echo We are done (probably)...
echo Exiting...
TIMEOUT /T 5 >nul
exit