Created
March 9, 2021 19:52
-
-
Save FennyFatal/1f429732471448e276fe77bb758e1ed3 to your computer and use it in GitHub Desktop.
Crappy script to pull apk from remote device. Will pull any package name that matches argument. (use "." for all) Usage: pull-apk name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ECHO OFF | |
set ARG=%1 | |
set next=1 | |
FOR /F "USEBACKQ delims=" %%F in (`adb shell "for i in $(pm list packages | awk -F':' '{print $2}' | grep -F '%ARG%'); do pm path $i | awk -F':' '{print $2}'; done | xargs echo"`) do ( | |
set OUTPUT=%%F | |
) | |
echo "%OUTPUT%" | |
goto :main | |
:loop | |
for /F "tokens=%tokenNum%* delims=/ " %%u in ("%packageUrl%") do ( | |
set testVar=%%u | |
call set testString=%%testVar:%ARG%^=%% | |
IF NOT x%testString% == x%testVar% ( | |
for /F "delims=-" %%k in ("%testVar%") do set OUTFILE=%%k.apk | |
goto :return | |
) | |
set /A tokenNum=tokenNum+1 | |
goto :loop | |
) | |
:return | |
exit /b | |
:main | |
FOR /F "tokens=%next%* " %%F IN ("%OUTPUT%") DO ( | |
SET packageUrl=%%F | |
set tokenNum=1 | |
call :loop | |
adb pull "%packageUrl%" "%OUTFILE%" | |
set /A next=next+1 | |
goto :main | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment