Skip to content

Instantly share code, notes, and snippets.

@subfission
Created June 28, 2017 18:35
Show Gist options
  • Save subfission/ef3e943ad5ec9fce082c72ed06f103c0 to your computer and use it in GitHub Desktop.
Save subfission/ef3e943ad5ec9fce082c72ed06f103c0 to your computer and use it in GitHub Desktop.
Administrator vaccine for petya based on current research.
@echo off
cls
echo Vaccinating for Petya malware
NET SESSION >nul 2>&1
IF %ERRORLEVEL% EQU 1 (
echo ####### ERROR: ADMINISTRATOR PRIVILEGES REQUIRED #########
echo This script must be run as administrator to work properly!
echo If you're seeing this after clicking on a start menu icon, then right click on the shortcut and select "Run As Administrator".
echo ##########################################################
echo.
PAUSE
EXIT /B 1
)
echo Cleaning environment...
del %WINDIR%\perfc.* /f >NUL
echo Creating files...
echo > %WINDIR%\perfc
echo > %WINDIR%\perfc.dat
timeout 1 >NUL
echo Finishing...
attrib +R %WINDIR%\perfc.* >NUL
timeout 1 >NUL
echo Vaccine installed
timeout 2 >NUL
start /b "" cmd /c del "%~f0"&exit /b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment