Advertisement
corpnewt

Release Paragon.bat

Feb 1st, 2016
301
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.48 KB | None | 0 0
  1. :::::::::::::::::::::::::::::::::::::::::
  2. :: Automatically check & get admin rights
  3. :::::::::::::::::::::::::::::::::::::::::
  4. @echo off
  5. CLS
  6. ECHO.
  7. ECHO =============================
  8. ECHO Running Admin shell
  9. ECHO =============================
  10.  
  11. :checkPrivileges
  12. NET FILE 1>NUL 2>NUL
  13. if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges )
  14.  
  15. :getPrivileges
  16. if '%1'=='ELEV' (shift & goto gotPrivileges)
  17. ECHO.
  18. ECHO **************************************
  19. ECHO Invoking UAC for Privilege Escalation
  20. ECHO **************************************
  21.  
  22. setlocal DisableDelayedExpansion
  23. set "batchPath=%~0"
  24. setlocal EnableDelayedExpansion
  25. ECHO Set UAC = CreateObject^("Shell.Application"^) > "%temp%\OEgetPrivileges.vbs"
  26. ECHO UAC.ShellExecute "!batchPath!", "ELEV", "", "runas", 1 >> "%temp%\OEgetPrivileges.vbs"
  27. "%temp%\OEgetPrivileges.vbs"
  28. exit /B
  29.  
  30. :gotPrivileges
  31. ::::::::::::::::::::::::::::
  32. ::START
  33. ::::::::::::::::::::::::::::
  34.  
  35. set "searchDir=%WINDIR%\System32\Drivers\"
  36.  
  37. :main
  38. cls
  39. echo ### Release Paragon ###
  40. echo.
  41. echo This script will find leftover Paragon HFS+ system
  42. echo files and registry values and disable them.
  43. echo.
  44. echo Run Search first, then restart, and run Destroy.
  45. echo.
  46. echo 1. Search (Disable files and delete Reg entries)
  47. echo 2. Destroy (Delete disabled files)
  48. echo.
  49. set /p "menu=Please select an option: "
  50.  
  51. if /i "%menu%"=="1" goto search
  52. if /i "%menu%"=="2" goto remove
  53.  
  54. goto main
  55.  
  56. :search
  57. cls
  58. echo ### Searching for Files/Reg Values ###
  59. echo.
  60.  
  61. echo Searching "%searchDir%"...
  62.  
  63. set /a didFind=0
  64.  
  65. call :destroy "apmwin.sys" "%searchDir%" didFind
  66. call :destroy "gpt_loader.sys" "%searchDir%" didFind
  67. call :destroy "hfsplus.sys" "%searchDir%" didFind
  68. call :destroy "hfsplusrec.sys" "%searchDir%" didFind
  69. call :destroy "mounthlp.sys" "%searchDir%" didFind
  70.  
  71. echo.
  72. echo Renamed %didFind% file^(s^).
  73.  
  74. echo.
  75. echo Deleting Registry Key^(s^)...
  76. echo HKLM\SYSTEM\CurrentControlSet\Services\apmwin
  77. REG DELETE HKLM\SYSTEM\CurrentControlSet\Services\apmwin /f
  78. echo HKLM\SYSTEM\CurrentControlSet\Services\HFSPlus
  79. REG DELETE HKLM\SYSTEM\CurrentControlSet\Services\HFSPlus /f
  80. echo HKLM\SYSTEM\CurrentControlSet\Services\HFSPlusRec
  81. REG DELETE HKLM\SYSTEM\CurrentControlSet\Services\HFSPlusRec /f
  82. echo HKLM\SYSTEM\CurrentControlSet\Services\gpt_loader
  83. REG DELETE HKLM\SYSTEM\CurrentControlSet\Services\gpt_loader /f
  84. echo HKLM\SYSTEM\CurrentControlSet\Services\mounthlp
  85. REG DELETE HKLM\SYSTEM\CurrentControlSet\Services\mounthlp /f
  86.  
  87. echo.
  88. echo Removing Registry Upper Filters...
  89. set "currentReg=HKLM\SYSTEM\CurrentControlSet\Control\Class\{71A27CDD-812A-11D0-BEC7-08002BE2092F}"
  90. echo HKLM\SYSTEM\CurrentControlSet\Control\Class\{71A27CDD-812A-11D0-BEC7-08002BE2092F}\UpperFilters
  91. echo mounthlp
  92. call :removeReg "%currentReg%" "UpperFilters" "mounthlp"
  93.  
  94. set "currentReg=HKLM\SYSTEM\CurrentControlSet\Control\Class\{4D36E967-E325-11CE-BFC1-08002BE10318}"
  95. echo HKLM\SYSTEM\CurrentControlSet\Control\Class\{4D36E967-E325-11CE-BFC1-08002BE10318}\UpperFilters
  96. echo gpt_loader
  97. call :removeReg "%currentReg%" "UpperFilters" "gpt_loader"
  98. echo apmwin
  99. call :removeReg "%currentReg%" "UpperFilters" "apmwin"
  100.  
  101. REM REG QUERY HKLM\SYSTEM\CurrentControlSet\Control\Class\{4D36E967-E325-11CE-BFC1-08002BE10318} /v UpperFilters
  102. echo.
  103. echo.
  104.  
  105. echo Please restart your computer, then run this script
  106. echo again, and pick the Destroy option to complete
  107. echo the removal.
  108. pause
  109. goto :EOF
  110.  
  111. :removeReg <reglocation> <keyname> <keytoremove>
  112. setlocal enableDelayedExpansion
  113. set "value="
  114. FOR /F "skip=2 tokens=1,2*" %%a in ('REG QUERY "%~1" /v "%~2"') DO (
  115. set value=%%c
  116. )
  117. set "re=%~3"
  118. if /i "%value%"=="" (
  119. echo ERROR: The system was unable to find the specified registry key or value.
  120. endlocal
  121. exit /b
  122. ) else if /i "!value:%re%=!"=="%value%" (
  123. echo ERROR: The system was unable to find the specified registry key or value.
  124. endlocal
  125. exit /b
  126. ) else (
  127. REM we found our value, let's check for trailing spacers
  128. if "!value:%re%\0=!"=="%value%" (
  129. REM No trailing spacers
  130. set value=!value:%re%=!
  131. ) else (
  132. set value=!value:%re%\0=!
  133. )
  134. )
  135. REM If we made it this far, let's write our value
  136. REG ADD "%~1" /t REG_MULTI_SZ /v "%~2" /d "%value%" /f
  137. endlocal
  138. exit /b
  139.  
  140. :remove
  141. cls
  142. echo ### Destroying Files ###
  143. echo.
  144. echo ### WARNING ###
  145. echo.
  146. echo Only run this part if you have already
  147. echo rebooted after running the Search function.
  148. echo.
  149. echo Press [enter] to continue...
  150. pause > nul
  151. cls
  152. echo ### Destroying Files ###
  153. echo.
  154. echo Searching "%searchDir%"...
  155.  
  156. set /a didFind=0
  157.  
  158. call :kill "_apmwin.sy_" "%searchDir%" didFind
  159. call :kill "_gpt_loader.sy_" "%searchDir%" didFind
  160. call :kill "_hfsplus.sy_" "%searchDir%" didFind
  161. call :kill "_hfsplusrec.sy_" "%searchDir%" didFind
  162. call :kill "_mounthlp.sy_" "%searchDir%" didFind
  163.  
  164. echo Done.
  165. echo.
  166. echo Destroyed %didFind% file^(s^).
  167. pause
  168. goto :EOF
  169.  
  170. :kill
  171. setlocal enableDelayedExpansion
  172. set "var1=%~1"
  173. set "var2=%~2"
  174. set /a var3=!%~3!
  175. pushd "%var2%"
  176. if EXIST "%var1%" (
  177. echo Found %var1%...
  178. echo Destroying "%var1%"
  179. DEL "%var1%"
  180. set /a var3 += 1
  181. )
  182. popd
  183. endlocal & set var3=%var3%
  184. set %~3=%var3%
  185. goto :EOF
  186.  
  187. :destroy
  188. setlocal enableDelayedExpansion
  189. set "var1=%~1"
  190. set "var2=%~2"
  191. set /a var3=!%~3!
  192. pushd "%var2%"
  193. if EXIST "%var1%" (
  194. echo Found %var1%...
  195. echo Renaming "%var1%" to "_%var1:~0,-1%_"
  196. REN "%var1%" "_%var1:~0,-1%_"
  197. set /a var3 += 1
  198. )
  199. popd
  200. endlocal & set var3=%var3%
  201. set %~3=%var3%
  202. goto :EOF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement