Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- set tmpdir=C:\tmpReg
- md %tmpdir%
- set regfile=%tmpdir%\regedit.reg
- echo Windows Registry Editor Version 5.00 > %regfile%
- echo.>> %regfile%
- echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\State\Machine\Scripts]>> %regfile%
- echo.>> %regfile%
- echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\State\Machine\Scripts\Shutdown] >> %regfile%
- echo.>> %regfile%
- echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\Scripts\Shutdown] >> %regfile%
- echo.>> %regfile%
- echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\State\Machine\Scripts\Shutdown\0] >> %regfile%
- echo "GPO-ID"="LocalGPO" >> %regfile%
- echo "SOM-ID"="Local" >> %regfile%
- echo "FileSysPath"="C:\\Windows\\System32\\GroupPolicy\\Machine" >> %regfile%
- echo "DisplayName"="Local Group Policy" >> %regfile%
- echo "GPOName"="Local Group Policy" >> %regfile%
- echo.>> %regfile%
- echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\State\Machine\Scripts\Shutdown\0\0] >> %regfile%
- echo "Script"="terminate_script.bat" >> %regfile%
- echo "Parameters"="" >> %regfile%
- echo "ExecTime"=hex(b):00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 >> %regfile%
- echo.>> %regfile%
- echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\Scripts\Shutdown\0]>> %regfile%
- echo "GPO-ID"="LocalGPO" >> %regfile%
- echo "SOM-ID"="Local" >> %regfile%
- echo "FileSysPath"="C:\\Windows\\System32\\GroupPolicy\\Machine" >> %regfile%
- echo "DisplayName"="Local Group Policy" >> %regfile%
- echo "GPOName"="Local Group Policy">> %regfile%
- echo.>> %regfile%
- echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\Scripts\Shutdown\0\0] >> %regfile%
- echo "Script"="C:\\windows\\random_hostname.bat" >> %regfile%
- echo "Parameters"="">> %regfile%
- echo "IsPowershell"=dword:00000000>> %regfile%
- echo "ExecTime"=hex(b):00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00>> %regfile%
- set file=C:\windows\random_hostname.bat
- echo @echo off> %file%
- echo Setlocal EnableDelayedExpansion>> %file%
- echo Set _RNDLength=10>> %file%
- echo Set _Alphanumeric=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789>> %file%
- echo Set _Str=%%_Alphanumeric%%987654321>> %file%
- echo :_LenLoop>> %file%
- echo IF NOT "%%_Str:~18%%"=="" SET _Str=%%_Str:~9%%^& SET /A _Len+=9^& GOTO :_LenLoop>> %file%
- echo SET _tmp=%%_Str:~9,1%%>> %file%
- echo SET /A _Len=_Len+_tmp>> %file%
- echo Set _count=0 >> %file%
- echo SET _RndAlphaNum=>> %file%
- echo :_loop>> %file%
- echo Set /a _count+=1 >> %file%
- echo SET _RND=%%Random%%>> %file%
- echo Set /A _RND=_RND%%%%%%_Len%%>> %file%
- echo SET _RndAlphaNum=!_RndAlphaNum!!_Alphanumeric:~%%_RND%%,1!>> %file%
- echo If !_count! lss %%_RNDLength%% goto _loop>> %file%
- echo Echo !_RndAlphaNum!>> %file%
- echo wmic computersystem where name="%%computername%%" call rename name="!_RndAlphaNum!">> %file%
- regedit.exe /s %regfile%
- del /f /s /q %tmpdir% 1>nul
- rmdir /s /q %tmpdir%
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement