Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- ::
- :: RootMe.cmd v0.4
- ::
- :: <CREDITS>
- ::
- :: Thanks to those who's work led the way here:
- :: joeykrim for root
- :: koush for clockworkmod
- :: Dameon87 for EXT4 and CWM3
- :: skeeterslint for busybox
- :: firon and noobnl for the one click installer
- ::
- :: RootMe Windows script by tanimn
- ::
- :: <DESCRIPTION>
- ::
- :: Script package to root Samsung Epic 4g via adb
- ::
- :: <REQUIREMENTS>
- ::
- :: This windows script REQUIRES the following files present in the current directory:
- :: adb.exe / AdbWinApi.dll / AdbWinUsbApi.dll / busybox / playlogo /
- :: rageagainstthecage-arm5.bin / redbend_ua / ACSTool.sh / rutt.sh /
- :: su / Superuser.apk / zImage-2510 / zImage-3005
- ::
- @echo off
- :Variables
- :: Check for command line switches
- set Switches=%1
- :: Use the included adb binary
- set adb=.\adb.exe
- :: Set the filename of the exploit to use
- set Exploit=rageagainstthecage-arm5.bin
- :: Set default ClockWorkMod Version
- set CWMVer=2510
- :: set CWMVer=3005
- :Begin
- :: Check for device
- call :Check InitialDeviceCheck
- call :Switch
- call :CleanVars
- goto END
- :Check
- if [%Loop%]==[] (set /A Loop=0)
- :: Cycle adb
- if [%Loop%]==[0] (
- %adb% kill-server
- %adb% start-server
- call :Sleep 3
- )
- :: Check for attached device
- for /F "tokens=1 usebackq" %%i in (`%adb% get-state`) do call :CheckGo %%i %1
- goto END
- :CheckGo
- if /I %Loop% GEQ 5 (set /A Loop=0 && set Break=%2 && goto NoDev)
- if [%1]==[device] (set /A Loop=0 && goto END)
- set /A Loop=Loop+1
- call :Sleep 5
- call :Check %2
- set /A Loop=0
- goto END
- :Switch
- if not [%Break%]==[] (goto END)
- if [%Switches%]==[] (goto Menu)
- echo %Switches% | findstr /i y
- if [%ERRORLEVEL%]==[0] (goto Basic)
- echo %Switches% | findstr /i x
- if [%ERRORLEVEL%]==[0] (goto CleanVars)
- echo %Switches% | findstr /i t
- if [%ERRORLEVEL%]==[0] (goto TempRoot)
- echo %Switches% | findstr /i r
- if [%ERRORLEVEL%]==[0] (goto PersistRoot)
- echo %Switches% | findstr /i b
- if [%ERRORLEVEL%]==[0] (goto BusyBox)
- echo %Switches% | findstr /i 2
- if [%ERRORLEVEL%]==[0] (set CWMVer=2510 && goto CWM)
- echo %Switches% | findstr /i 3
- if [%ERRORLEVEL%]==[0] (set CWMVer=3005 && goto CWM)
- goto END
- :Menu
- cls
- echo.
- echo Android Creative Syndicate Root and Recovery Toolkit for the Epic 4G v0.4
- echo By default this script will install persistent root, busybox, and CWM 2.5.1.0
- echo If this is acceptable, please press (Y)es and enter now.
- echo Otherwise, please select your options from the menu below:
- echo.
- echo (T) - Install temporary root permissions and open a root shell to your Epic.
- echo (Y) - Install with default options. Start script with -y to bypass menus.
- echo (R) - Install persistent root permissions with su and Superuser.apk.
- echo (B) - Install busybox command line tools.
- echo (2) - Install ClockWorkMod Recovery 2.5.1.0. Use with standard filesystems.
- echo (3) - Install ClockWorkMod Recovery 3. For EXT4 filesystem and kernel ONLY.
- echo (X) - Exit this installer.
- echo.
- set Switches=
- set /p Switches=Please select one or more options from the menu above:
- call :Switch
- goto END
- :Basic
- echo *** Beginning Tasks. Please wait for all operations to complete ***
- call :Reboot
- call :Rutt
- call :Rooter
- call :BusyBoxIt
- call :ClockWork
- call :Clean
- echo *** All Tasks Completed. If something went wrong it will show above ***
- goto END
- :TempRoot
- echo *** Beginning Tasks. Please wait for all operations to complete ***
- call :Reboot
- call :Rutt
- start %adb% shell
- call :Clean
- echo *** All Tasks Completed. If something went wrong it will show above ***
- goto END
- :PersistRoot
- echo *** Beginning Tasks. Please wait for all operations to complete ***
- call :Reboot
- call :Rutt
- call :Rooter
- call :LastReboot
- call :Clean
- echo *** All Tasks Completed. If something went wrong it will show above ***
- goto END
- :BusyBox
- echo *** Beginning Tasks. Please wait for all operations to complete ***
- call :Reboot
- call :Rutt
- call :BusyBoxIt
- call :LastReboot
- call :Clean
- echo *** All Tasks Completed. If something went wrong it will show above ***
- goto END
- :CWM
- echo *** Beginning Tasks. Please wait for all operations to complete ***
- call :Reboot
- call :Rutt
- call :ClockWork
- call :Clean
- echo *** All Tasks Completed. If something went wrong it will show above ***
- goto END
- :Reboot
- for /F "tokens=1 usebackq" %%i in (`adb shell id ^| find "uid=0"`) do if not [%%i]==[] (goto END)
- echo Rebooting the phone to clear out any cobwebs
- %adb% reboot now
- call :Sleep 27
- call :Check RebootCheck
- goto END
- :LastReboot
- echo Final Reboot
- %adb% reboot now
- call :Sleep 27
- call :Check LastRebootCheck
- goto END
- :Rutt
- for /F "tokens=1 usebackq" %%i in (`adb shell id ^| find "uid=0"`) do if not [%%i]==[] (goto END)
- echo Push exploit files to the phone and run
- %adb% push %Exploit% /data/local/tmp/%Exploit%
- %adb% push rutt.sh /data/local/tmp/rutt.sh
- %adb% shell chmod 755 /data/local/tmp/%Exploit%
- %adb% shell chmod 755 /data/local/tmp/rutt.sh
- %adb% shell /data/local/tmp/rutt.sh %Exploit%
- :: Give adb a few more seconds to settle
- call :Sleep 13
- :: Restart adb to activate the exploit
- call :Check PostExploit
- call :CheckRutt
- goto END
- :CheckRutt
- 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)
- set Break=0
- %adb% reboot now
- echo Did not obtain temporary root access this time. Please try again.
- goto END
- :Remount
- echo Discover the filesystem type and attempt to remount it R/W
- if [%1]==[] (
- for /F "tokens=3 usebackq" %%i in (`%adb% shell mount ^| find "system"`) do call :Remount %%i
- ) else (
- %adb% shell mount -t %1 -o remount,rw /dev/block/stl9 /system
- )
- goto END
- :ACSTool
- :: Plant the toolkit and run switch
- %adb% push ACSTool.sh /data/local/tmp/ACSTool.sh
- %adb% shell chmod 755 /data/local/tmp/ACSTool.sh
- %adb% shell sh /data/local/tmp/ACSTool.sh %1
- goto END
- :Rooter
- if [%Break%]==[0] (goto END)
- echo Planting files for persistent root permissions
- %adb% shell mv /system/bin/playlogo /system/bin/playlogo.stock
- %adb% push playlogo /system/bin/playlogo
- %adb% push su /system/bin/su
- %adb% push Superuser.apk /system/app/Superuser.apk
- call :ACSTool root
- goto END
- :BusyBoxIt
- if [%Break%]==[0] (goto END)
- echo Installing busybox tools
- %adb% push busybox /system/bin/busybox
- call :ACSTool bbox
- goto END
- :ClockWork
- if [%Break%]==[0] (goto END)
- echo Installing Clockwork Mod Recovery
- %adb% push redbend_ua /data/local/tmp/redbend_ua
- %adb% push zImage-%CWMVer% /data/local/tmp/zImage
- %adb% shell chmod 755 /data/local/tmp/redbend_ua
- %adb% shell /data/local/tmp/redbend_ua restore /data/local/tmp/zImage /dev/block/bml8
- call :Sleep 21
- call :Check PostClockWork
- goto END
- :NoDev
- :: cls
- echo Your device was not detected! Please make sure that debugging is enabled on your handset,
- echo and that the proper drivers are installed and working on your host pc.
- echo This message may appear during the processing of this script if your handset
- echo has not responded in an excessively long time. Please make a note of the function below.
- echo After resolving the issue, please attempt to run this script again.
- echo Processing stopped in function %Break%.
- goto END
- :Sleep
- ping -n %1 localhost > nul
- goto END
- :Clean
- :: Clean up
- %adb% shell rm /data/local/tmp/rageagainstthecage-arm5.bin
- %adb% shell rm /data/local/tmp/redbend_ua
- %adb% shell rm /data/local/tmp/rutt.sh
- %adb% shell rm /data/local/tmp/ACSTool.sh
- %adb% shell rm /data/local/tmp/zImage
- :CleanVars
- set adb=
- set Exploit=
- set Switches=
- set CWMVer=
- set Break=
- set Loop=
- :END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement