Advertisement
Guest User

Untitled

a guest
Jul 11th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3. ::
  4. :: RootMe.cmd v0.4
  5. ::
  6. :: <CREDITS>
  7. ::
  8. :: Thanks to those who's work led the way here:
  9. :: joeykrim for root
  10. :: koush for clockworkmod
  11. :: Dameon87 for EXT4 and CWM3
  12. :: skeeterslint for busybox
  13. :: firon and noobnl for the one click installer
  14. ::
  15. :: RootMe Windows script by tanimn
  16. ::
  17. :: <DESCRIPTION>
  18. ::
  19. :: Script package to root Samsung Epic 4g via adb
  20. ::
  21. :: <REQUIREMENTS>
  22. ::
  23. :: This windows script REQUIRES the following files present in the current directory:
  24. :: adb.exe / AdbWinApi.dll / AdbWinUsbApi.dll / busybox / playlogo /
  25. :: rageagainstthecage-arm5.bin / redbend_ua / ACSTool.sh / rutt.sh /
  26. :: su / Superuser.apk / zImage-2510 / zImage-3005
  27. ::
  28.  
  29. @echo off
  30.  
  31. :Variables
  32. :: Check for command line switches
  33. set Switches=%1
  34. :: Use the included adb binary
  35. set adb=.\adb.exe
  36. :: Set the filename of the exploit to use
  37. set Exploit=rageagainstthecage-arm5.bin
  38. :: Set default ClockWorkMod Version
  39. set CWMVer=2510
  40. :: set CWMVer=3005
  41.  
  42. :Begin
  43. :: Check for device
  44. call :Check InitialDeviceCheck
  45. call :Switch
  46. call :CleanVars
  47. goto END
  48.  
  49.  
  50. :Check
  51. if [%Loop%]==[] (set /A Loop=0)
  52. :: Cycle adb
  53. if [%Loop%]==[0] (
  54.     %adb% kill-server
  55.     %adb% start-server
  56.     call :Sleep 3
  57.     )
  58. :: Check for attached device
  59. for /F "tokens=1 usebackq" %%i in (`%adb% get-state`) do call :CheckGo %%i %1
  60. goto END
  61.  
  62. :CheckGo
  63. if /I %Loop% GEQ 5 (set /A Loop=0 && set Break=%2 && goto NoDev)
  64. if [%1]==[device] (set /A Loop=0 && goto END)
  65. set /A Loop=Loop+1
  66. call :Sleep 5
  67. call :Check %2
  68. set /A Loop=0
  69. goto END
  70.  
  71. :Switch
  72. if not [%Break%]==[] (goto END)
  73. if [%Switches%]==[] (goto Menu)
  74. echo %Switches% | findstr /i y
  75. if [%ERRORLEVEL%]==[0] (goto Basic)
  76. echo %Switches% | findstr /i x
  77. if [%ERRORLEVEL%]==[0] (goto CleanVars)
  78. echo %Switches% | findstr /i t
  79. if [%ERRORLEVEL%]==[0] (goto TempRoot)
  80. echo %Switches% | findstr /i r
  81. if [%ERRORLEVEL%]==[0] (goto PersistRoot)
  82. echo %Switches% | findstr /i b
  83. if [%ERRORLEVEL%]==[0] (goto BusyBox)
  84. echo %Switches% | findstr /i 2
  85. if [%ERRORLEVEL%]==[0] (set CWMVer=2510 && goto CWM)
  86. echo %Switches% | findstr /i 3
  87. if [%ERRORLEVEL%]==[0] (set CWMVer=3005 && goto CWM)
  88.  
  89. goto END
  90.  
  91. :Menu
  92. cls
  93. echo.
  94. echo    Android Creative Syndicate Root and Recovery Toolkit for the Epic 4G v0.4
  95. echo    By default this script will install persistent root, busybox, and CWM 2.5.1.0
  96. echo    If this is acceptable, please press (Y)es and enter now.
  97. echo    Otherwise, please select your options from the menu below:
  98. echo.
  99. echo    (T) - Install temporary root permissions and open a root shell to your Epic.
  100. echo    (Y) - Install with default options. Start script with -y to bypass menus.
  101. echo    (R) - Install persistent root permissions with su and Superuser.apk.
  102. echo    (B) - Install busybox command line tools.
  103. echo    (2) - Install ClockWorkMod Recovery 2.5.1.0. Use with standard filesystems.
  104. echo    (3) - Install ClockWorkMod Recovery 3. For EXT4 filesystem and kernel ONLY.
  105. echo    (X) - Exit this installer.
  106. echo.
  107. set Switches=
  108. set /p Switches=Please select one or more options from the menu above:
  109. call :Switch
  110. goto END
  111.  
  112. :Basic
  113. echo *** Beginning Tasks. Please wait for all operations to complete ***
  114. call :Reboot
  115. call :Rutt
  116. call :Rooter
  117. call :BusyBoxIt
  118. call :ClockWork
  119. call :Clean
  120. echo *** All Tasks Completed. If something went wrong it will show above ***
  121. goto END
  122.  
  123. :TempRoot
  124. echo *** Beginning Tasks. Please wait for all operations to complete ***
  125. call :Reboot
  126. call :Rutt
  127. start %adb% shell
  128. call :Clean
  129. echo *** All Tasks Completed. If something went wrong it will show above ***
  130. goto END
  131.  
  132. :PersistRoot
  133. echo *** Beginning Tasks. Please wait for all operations to complete ***
  134. call :Reboot
  135. call :Rutt
  136. call :Rooter
  137. call :LastReboot
  138. call :Clean
  139. echo *** All Tasks Completed. If something went wrong it will show above ***
  140. goto END
  141.  
  142. :BusyBox
  143. echo *** Beginning Tasks. Please wait for all operations to complete ***
  144. call :Reboot
  145. call :Rutt
  146. call :BusyBoxIt
  147. call :LastReboot
  148. call :Clean
  149. echo *** All Tasks Completed. If something went wrong it will show above ***
  150. goto END
  151.  
  152. :CWM
  153. echo *** Beginning Tasks. Please wait for all operations to complete ***
  154. call :Reboot
  155. call :Rutt
  156. call :ClockWork
  157. call :Clean
  158. echo *** All Tasks Completed. If something went wrong it will show above ***
  159. goto END
  160.  
  161. :Reboot
  162. for /F "tokens=1 usebackq" %%i in (`adb shell id ^| find "uid=0"`) do if not [%%i]==[] (goto END)
  163. echo Rebooting the phone to clear out any cobwebs
  164. %adb% reboot now
  165. call :Sleep 27
  166. call :Check RebootCheck
  167. goto END
  168.  
  169. :LastReboot
  170. echo Final Reboot
  171. %adb% reboot now
  172. call :Sleep 27
  173. call :Check LastRebootCheck
  174. goto END
  175.  
  176. :Rutt
  177. for /F "tokens=1 usebackq" %%i in (`adb shell id ^| find "uid=0"`) do if not [%%i]==[] (goto END)
  178. echo Push exploit files to the phone and run
  179. %adb% push %Exploit% /data/local/tmp/%Exploit%
  180. %adb% push rutt.sh /data/local/tmp/rutt.sh
  181. %adb% shell chmod 755 /data/local/tmp/%Exploit%
  182. %adb% shell chmod 755 /data/local/tmp/rutt.sh
  183. %adb% shell /data/local/tmp/rutt.sh %Exploit%
  184. :: Give adb a few more seconds to settle
  185. call :Sleep 13
  186. :: Restart adb to activate the exploit
  187. call :Check PostExploit
  188. call :CheckRutt
  189. goto END
  190.  
  191. :CheckRutt
  192. for /F "tokens=1 usebackq" %%i in (`adb shell id ^| find "uid=0"`) do if not [%%i]==[] (call :Remount && echo Temporary root access granted. && goto END)
  193. set Break=0
  194. %adb% reboot now
  195. echo Did not obtain temporary root access this time. Please try again.
  196. goto END
  197.  
  198. :Remount
  199. echo Discover the filesystem type and attempt to remount it R/W
  200. if [%1]==[] (
  201.     for /F "tokens=3 usebackq" %%i in (`%adb% shell mount ^| find "system"`) do call :Remount %%i
  202.     ) else (
  203.     %adb% shell mount -t %1 -o remount,rw /dev/block/stl9 /system
  204.     )
  205. goto END
  206.  
  207. :ACSTool
  208. :: Plant the toolkit and run switch
  209. %adb% push ACSTool.sh /data/local/tmp/ACSTool.sh
  210. %adb% shell chmod 755 /data/local/tmp/ACSTool.sh
  211. %adb% shell sh /data/local/tmp/ACSTool.sh %1
  212. goto END
  213.  
  214. :Rooter
  215. if [%Break%]==[0] (goto END)
  216. echo Planting files for persistent root permissions
  217. %adb% shell mv /system/bin/playlogo /system/bin/playlogo.stock
  218. %adb% push playlogo /system/bin/playlogo
  219. %adb% push su /system/bin/su
  220. %adb% push Superuser.apk /system/app/Superuser.apk
  221. call :ACSTool root
  222. goto END
  223.  
  224. :BusyBoxIt
  225. if [%Break%]==[0] (goto END)
  226. echo Installing busybox tools
  227. %adb% push busybox /system/bin/busybox
  228. call :ACSTool bbox
  229. goto END
  230.  
  231.  
  232. :ClockWork
  233. if [%Break%]==[0] (goto END)
  234. echo Installing Clockwork Mod Recovery
  235. %adb% push redbend_ua /data/local/tmp/redbend_ua
  236. %adb% push zImage-%CWMVer% /data/local/tmp/zImage
  237. %adb% shell chmod 755 /data/local/tmp/redbend_ua
  238. %adb% shell /data/local/tmp/redbend_ua restore /data/local/tmp/zImage /dev/block/bml8
  239. call :Sleep 21
  240. call :Check PostClockWork
  241. goto END
  242.  
  243. :NoDev
  244. :: cls
  245. echo Your device was not detected! Please make sure that debugging is enabled on your handset,
  246. echo and that the proper drivers are installed and working on your host pc.
  247. echo This message may appear during the processing of this script if your handset
  248. echo has not responded in an excessively long time. Please make a note of the function below.
  249. echo After resolving the issue, please attempt to run this script again.
  250. echo Processing stopped in function %Break%.
  251. goto END
  252.  
  253. :Sleep
  254. ping -n %1 localhost > nul
  255. goto END
  256.  
  257. :Clean
  258. :: Clean up
  259. %adb% shell rm /data/local/tmp/rageagainstthecage-arm5.bin
  260. %adb% shell rm /data/local/tmp/redbend_ua
  261. %adb% shell rm /data/local/tmp/rutt.sh
  262. %adb% shell rm /data/local/tmp/ACSTool.sh
  263. %adb% shell rm /data/local/tmp/zImage
  264.  
  265. :CleanVars
  266. set adb=
  267. set Exploit=
  268. set Switches=
  269. set CWMVer=
  270. set Break=
  271. set Loop=
  272.  
  273. :END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement