Advertisement
Guest User

Untitled

a guest
Feb 28th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @echo off
  2. set tmpdir=C:\tmpReg
  3. md %tmpdir%
  4.  
  5. set regfile=%tmpdir%\regedit.reg
  6. echo Windows Registry Editor Version 5.00 > %regfile%
  7. echo.>> %regfile%
  8. echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\State\Machine\Scripts]>> %regfile%
  9. echo.>> %regfile%
  10. echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\State\Machine\Scripts\Shutdown] >> %regfile%
  11. echo.>> %regfile%
  12. echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\Scripts\Shutdown]     >> %regfile%
  13. echo.>> %regfile%
  14. echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\State\Machine\Scripts\Shutdown\0]  >> %regfile%
  15. echo "GPO-ID"="LocalGPO"    >> %regfile%
  16. echo "SOM-ID"="Local"    >> %regfile%
  17. echo "FileSysPath"="C:\\Windows\\System32\\GroupPolicy\\Machine"    >> %regfile%
  18. echo "DisplayName"="Local Group Policy"    >> %regfile%
  19. echo "GPOName"="Local Group Policy"    >> %regfile%
  20. echo.>> %regfile%
  21. echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\State\Machine\Scripts\Shutdown\0\0]    >> %regfile%
  22. echo "Script"="terminate_script.bat"    >> %regfile%
  23. echo "Parameters"=""    >> %regfile%
  24. echo "ExecTime"=hex(b):00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00    >> %regfile%
  25. echo.>> %regfile%
  26. echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\Scripts\Shutdown\0]>> %regfile%
  27. echo "GPO-ID"="LocalGPO"    >> %regfile%
  28. echo "SOM-ID"="Local"    >> %regfile%
  29. echo "FileSysPath"="C:\\Windows\\System32\\GroupPolicy\\Machine"    >> %regfile%
  30. echo "DisplayName"="Local Group Policy"    >> %regfile%
  31. echo "GPOName"="Local Group Policy">> %regfile%
  32. echo.>> %regfile%
  33. echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\Scripts\Shutdown\0\0]    >> %regfile%
  34. echo "Script"="C:\\windows\\random_hostname.bat"    >> %regfile%
  35. echo "Parameters"="">> %regfile%
  36. echo "IsPowershell"=dword:00000000>> %regfile%
  37. echo "ExecTime"=hex(b):00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00>> %regfile%
  38.  
  39. set file=C:\windows\random_hostname.bat
  40. echo @echo off> %file%
  41. echo Setlocal EnableDelayedExpansion>> %file%
  42. echo Set _RNDLength=10>> %file%
  43. echo Set _Alphanumeric=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789>> %file%
  44. echo Set _Str=%%_Alphanumeric%%987654321>> %file%
  45. echo :_LenLoop>> %file%
  46. echo IF NOT "%%_Str:~18%%"=="" SET _Str=%%_Str:~9%%^& SET /A _Len+=9^& GOTO :_LenLoop>> %file%
  47. echo SET _tmp=%%_Str:~9,1%%>> %file%
  48. echo SET /A _Len=_Len+_tmp>> %file%
  49. echo Set _count=0 >> %file%
  50. echo SET _RndAlphaNum=>> %file%
  51. echo :_loop>> %file%
  52. echo Set /a _count+=1 >> %file%
  53. echo SET _RND=%%Random%%>> %file%
  54. echo Set /A _RND=_RND%%%%%%_Len%%>> %file%
  55. echo SET _RndAlphaNum=!_RndAlphaNum!!_Alphanumeric:~%%_RND%%,1!>> %file%
  56. echo If !_count! lss %%_RNDLength%% goto _loop>> %file%
  57. echo Echo !_RndAlphaNum!>> %file%
  58. echo wmic computersystem where name="%%computername%%" call rename name="!_RndAlphaNum!">> %file%
  59.  
  60. regedit.exe /s %regfile%
  61.  
  62. del /f /s /q %tmpdir% 1>nul
  63. rmdir /s /q %tmpdir%
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement