d4rken / rxshell Goto Github PK
View Code? Open in Web Editor NEWEasy shell access for Android apps using RxJava.
License: Apache License 2.0
Easy shell access for Android apps using RxJava.
License: Apache License 2.0
Seeing a rare racecondition likely related to Observable.zip
in https://github.com/d4rken/RxShell/blob/master/core/src/main/java/eu/darken/rxshell/cmd/CmdProcessor.java#L111
1513428431737 V/RXS:RxCmdShell: open()
1513428431738 V/RXS:RxShell: open()
1513428431738 V/RXS:RxProcess: open()
1513428431740 V/RXS:RxProcess: processCreator:onNext(Process[pid=5851, hasExited=false])
1513428431740 D/RXS:RxProcess: open():doOnSuccess RxProcess.Session(process=Process[pid=5851, hasExited=false])
1513428431740 V/RXS:RxProcess:Session: input()
1513428431740 V/RXS:RxProcess:Session: output()
1513428431740 V/RXS:RxProcess:Session: error()
1513428431740 V/RXS:RxShell:Session: errorLines()
1513428431740 V/RXS:RxProcess:Session: destroy()
1513428431740 V/RXS:RxProcess:Session: waitFor()
1513428431740 V/RXS:RxShell:Session: waitFor()
1513428431740 V/RXS:RxShell: open():doOnSuccess RxShell.Session(processSession=RxProcess.Session(process=Process[pid=5851, hasExited=false]))
1513428431740 V/RXS:RxShell:Session: waitFor()
1513428431741 D/RXS:RxShell:Session: writeLine(line=V5B9D812A9C51=/data/user/0/eu.thedarken.sdm/files/toybox_sdm, flush=true)
1513428431741 V/RXS:CmdProcessor: attach(RxShell.Session(processSession=RxProcess.Session(process=Process[pid=5851, hasExited=false])))
1513428431741 V/RXS:RxShell:Session: waitFor()
1513428431741 V/RXS:RxShell:Session: waitFor()
1513428431741 V/RXS:RxShell:Session: cancel()
1513428431741 V/RXS:RxCmdShell: open():doOnSuccess eu.darken.rxshell.cmd.RxCmdShell$Session@9b97c1513428431741 V/RXS:RxCmdShell:Session: waitFor()
1513428431742 D/RXS:RxProcess:Session: Waiting for Process[pid=5851, hasExited=false] to exit.
1513428431742 D/RXS:CmdProcessor: Submitted: Cmd(timeout=0, commands=[$V5B9D812A9C51 test ! -e '/storage/emulated/0' || $V5B9D812A9C51 find -L '/storage/emulated/0' -mindepth 1 -print0 | $V5B9D812A9C51 xargs -0 -r -s 65536 $V5B9D812A9C51 stat -c "%a:%F:%d:%i:%u:%g:%s:%B:%b:%Y:%N", $V5B9D812A9C51 test ! -e '/data/user_de/0' || $V5B9D812A9C51 find -L '/data/user_de/0' -mindepth 1 -print0 | $V5B9D812A9C51 xargs -0 -r -s 65536 $V5B9D812A9C51 stat -c "%a:%F:%d:%i:%u:%g:%s:%B:%b:%Y:%N", $V5B9D812A9C51 test ! -e '/data/user/0' || $V5B9D812A9C51 find -L '/data/user/0' -mindepth 1 -print0 | $V5B9D812A9C51 xargs -0 -r -s 65536 $V5B9D812A9C51 stat -c "%a:%F:%d:%i:%u:%g:%s:%B:%b:%Y:%N"])
1513428431742 D/RXS:CmdProcessor: Processing: Cmd(timeout=0, commands=[$V5B9D812A9C51 test ! -e '/storage/emulated/0' || $V5B9D812A9C51 find -L '/storage/emulated/0' -mindepth 1 -print0 | $V5B9D812A9C51 xargs -0 -r -s 65536 $V5B9D812A9C51 stat -c "%a:%F:%d:%i:%u:%g:%s:%B:%b:%Y:%N", $V5B9D812A9C51 test ! -e '/data/user_de/0' || $V5B9D812A9C51 find -L '/data/user_de/0' -mindepth 1 -print0 | $V5B9D812A9C51 xargs -0 -r -s 65536 $V5B9D812A9C51 stat -c "%a:%F:%d:%i:%u:%g:%s:%B:%b:%Y:%N", $V5B9D812A9C51 test ! -e '/data/user/0' || $V5B9D812A9C51 find -L '/data/user/0' -mindepth 1 -print0 | $V5B9D812A9C51 xargs -0 -r -s 65536 $V5B9D812A9C51 stat -c "%a:%F:%d:%i:%u:%g:%s:%B:%b:%Y:%N"])
1513428431742 V/RXS:RxShell:Session: outputLines()
1513428431742 V/RXS:Harvester:Output: request(9223372036854775807)
1513428431742 V/RXS:RxShell:Session: errorLines()
1513428431742 V/RXS:Harvester:Error: request(9223372036854775807)
1513428431742 D/RXS:RxShell:Session: writeLine(line=$V5B9D812A9C51 test ! -e '/storage/emulated/0' || $V5B9D812A9C51 find -L '/storage/emulated/0' -mindepth 1 -print0 | $V5B9D812A9C51 xargs -0 -r -s 65536 $V5B9D812A9C51 stat -c "%a:%F:%d:%i:%u:%g:%s:%B:%b:%Y:%N", flush=false)
1513428431742 D/RXS:RxShell:Session: writeLine(line=$V5B9D812A9C51 test ! -e '/data/user_de/0' || $V5B9D812A9C51 find -L '/data/user_de/0' -mindepth 1 -print0 | $V5B9D812A9C51 xargs -0 -r -s 65536 $V5B9D812A9C51 stat -c "%a:%F:%d:%i:%u:%g:%s:%B:%b:%Y:%N", flush=false)
1513428431742 D/RXS:RxShell:Session: writeLine(line=$V5B9D812A9C51 test ! -e '/data/user/0' || $V5B9D812A9C51 find -L '/data/user/0' -mindepth 1 -print0 | $V5B9D812A9C51 xargs -0 -r -s 65536 $V5B9D812A9C51 stat -c "%a:%F:%d:%i:%u:%g:%s:%B:%b:%Y:%N", flush=false)
1513428431742 D/RXS:RxShell:Session: writeLine(line=echo fb6e4bdf-16ae-4f0d-b1b8-c3445f5d7ec1 $?, flush=false)
1513428431742 D/RXS:RxShell:Session: writeLine(line=echo fb6e4bdf-16ae-4f0d-b1b8-c3445f5d7ec1 >&2, flush=true)
1513428431775 V/RXS:Harvester:Error: Permission denied
1513428431775 D/RXS:Harvester:Error: Permission denied
1513428431776 V/RXS:RxShell: LineStream:error onComplete()
1513428431776 V/RXS:RxShell: LineStream:output onComplete()
1513428431776 V/RXS:Harvester:Error: onComplete()
1513428431776 V/RXS:Harvester:Output: onComplete()
1513428431776 V/RXS:Harvester:Error: onError(java.io.IOException: Upstream completed prematurely.)
1513428431776 V/RXS:Harvester:Output: onError(java.io.IOException: Upstream completed prematurely.)
1513428431776 V/RXS:CmdProcessor: errorLines():doOnEach: OnNextNotification[eu.darken.rxshell.cmd.Harvester$Crop@519a13a]
1513428431776 V/RXS:CmdProcessor: outputLine():doOnEach: OnNextNotification[eu.darken.rxshell.cmd.OutputHarvester$Crop@7e581eb]
1513428431776 V/RXS:RxProcess: processCreator:onComplete()
1513428431776 V/RXS:CmdProcessor: errorLines():doOnEach: OnCompleteNotification
1513428431776 V/RXS:Harvester:Error: cancel()
1513428431776 V/RXS:RxProcess: cancel()
1513428431777 D/RXS:RootKiller: kill(Process[pid=5851 ,hasExited=true, exitcode=1])
1513428431777 D/RXS:RootKiller: Process is no longer alive, skipping kill.
1513428431777 V/RXS:RxProcess: Process finished, clearing session
1513428431777 V/RXS:RxShell: LineStream:error onCancel()
1513428431777 D/RXS:RxProcess:Session: Exitcode: 1, Process: Process[pid=5851 ,hasExited=true, exitcode=1]
1513428431777 V/RXS:RxProcess:Session: waitFor():doOnSuccess 1513428431777 V/RXS:RxShell:Session: waitFor():doOnSuccess 1513428431777 V/RXS:CmdProcessor: Attached session ended!
1513428431777 V/RXS:CmdProcessor: Poison pill!
1513428431777 D/RXS:CmdProcessor: Post zip: OnNextNotification[QueueCmd(command=Cmd(timeout=0, commands=[$V5B9D812A9C51 test ! -e '/storage/emulated/0' || $V5B9D812A9C51 find -L '/storage/emulated/0' -mindepth 1 -print0 | $V5B9D812A9C51 xargs -0 -r -s 65536 $V5B9D812A9C51 stat -c "%a:%F:%d:%i:%u:%g:%s:%B:%b:%Y:%N", $V5B9D812A9C51 test ! -e '/data/user_de/0' || $V5B9D812A9C51 find -L '/data/user_de/0' -mindepth 1 -print0 | $V5B9D812A9C51 xargs -0 -r -s 65536 $V5B9D812A9C51 stat -c "%a:%F:%d:%i:%u:%g:%s:%B:%b:%Y:%N", $V5B9D812A9C51 test ! -e '/data/user/0' || $V5B9D812A9C51 find -L '/data/user/0' -mindepth 1 -print0 | $V5B9D812A9C51 xargs -0 -r -s 65536 $V5B9D812A9C51 stat -c "%a:%F:%d:%i:%u:%g:%s:%B:%b:%Y:%N"]), exitCode=-3, output.size()=null, errors.size()=null)]
1513428431777 V/RXS:CmdProcessor: onNext(QueueCmd(command=Cmd(timeout=0, commands=[$V5B9D812A9C51 test ! -e '/storage/emulated/0' || $V5B9D812A9C51 find -L '/storage/emulated/0' -mindepth 1 -print0 | $V5B9D812A9C51 xargs -0 -r -s 65536 $V5B9D812A9C51 stat -c "%a:%F:%d:%i:%u:%g:%s:%B:%b:%Y:%N", $V5B9D812A9C51 test ! -e '/data/user_de/0' || $V5B9D812A9C51 find -L '/data/user_de/0' -mindepth 1 -print0 | $V5B9D812A9C51 xargs -0 -r -s 65536 $V5B9D812A9C51 stat -c "%a:%F:%d:%i:%u:%g:%s:%B:%b:%Y:%N", $V5B9D812A9C51 test ! -e '/data/user/0' || $V5B9D812A9C51 find -L '/data/user/0' -mindepth 1 -print0 | $V5B9D812A9C51 xargs -0 -r -s 65536 $V5B9D812A9C51 stat -c "%a:%F:%d:%i:%u:%g:%s:%B:%b:%Y:%N"]), exitCode=-3, output.size()=null, errors.size()=null))
1513428431777 V/RXS:RxShell:Session: cancel()
1513428431777 I/RXS:CmdProcessor: Processed: Cmd.Result(cmd=Cmd(timeout=0, commands=[$V5B9D812A9C51 test ! -e '/storage/emulated/0' || $V5B9D812A9C51 find -L '/storage/emulated/0' -mindepth 1 -print0 | $V5B9D812A9C51 xargs -0 -r -s 65536 $V5B9D812A9C51 stat -c "%a:%F:%d:%i:%u:%g:%s:%B:%b:%Y:%N", $V5B9D812A9C51 test ! -e '/data/user_de/0' || $V5B9D812A9C51 find -L '/data/user_de/0' -mindepth 1 -print0 | $V5B9D812A9C51 xargs -0 -r -s 65536 $V5B9D812A9C51 stat -c "%a:%F:%d:%i:%u:%g:%s:%B:%b:%Y:%N", $V5B9D812A9C51 test ! -e '/data/user/0' || $V5B9D812A9C51 find -L '/data/user/0' -mindepth 1 -print0 | $V5B9D812A9C51 xargs -0 -r -s 65536 $V5B9D812A9C51 stat -c "%a:%F:%d:%i:%u:%g:%s:%B:%b:%Y:%N"]), exitcode=-3, output.size()=null, errors.size()=null)
1513428431777 V/RXS:RxProcess:Session: destroy():doOnComplete
1513428431777 D/RXS:CmdProcessor: Post zip: OnCompleteNotification
1513428431777 V/RXS:RxShell:Session: cancel():doOnComplete
1513428431777 V/RXS:CmdProcessor: onComplete()
1513428431777 V/RXS:CmdProcessor: outputLine():doOnEach: OnCompleteNotification
1513428431777 V/RXS:Harvester:Output: cancel()
io.reactivex.exceptions.OnErrorNotImplementedException: Upstream completed prematurely.
at io.reactivex.e.b.a$af.accept(Functions.java:1704)
at io.reactivex.e.h.k.onError(LambdaSubscriber.java:79)
at io.reactivex.i.b.onError(PublishProcessor.java:2325)
at eu.darken.rxshell.cmd.Harvester$BaseSub.onError(Harvester.java:96)
at eu.darken.rxshell.cmd.Harvester$BaseSub.onComplete(Harvester.java:102)
at io.reactivex.e.j.k.a(HalfSerializer.java:91)
at io.reactivex.e.h.s.onComplete(StrictSubscriber.java:109)
at io.reactivex.e.e.b.co$a.onComplete(FlowableRefCount.java:82)
at io.reactivex.e.e.b.cg$c.a(FlowablePublish.java:366)
at io.reactivex.e.e.b.cg$c.c(FlowablePublish.java:429)
at io.reactivex.e.e.b.cg$c.onComplete(FlowablePublish.java:252)
at io.reactivex.e.e.b.dm$a.onComplete(FlowableSubscribeOn.java:108)
at io.reactivex.e.e.b.aa$a.c(FlowableCreate.java:262)
at io.reactivex.e.e.b.aa$a.n_(FlowableCreate.java:254)
at eu.darken.rxshell.shell.RxShell.lambda$makeLineStream$6$RxShell(RxShell.java:190)
at eu.darken.rxshell.shell.RxShell$$Lambda$6.subscribe(Unknown Source:4)
at io.reactivex.e.e.b.aa.subscribeActual(FlowableCreate.java:72)
at io.reactivex.i.subscribe(Flowable.java:13041)
at io.reactivex.i.subscribe(Flowable.java:12987)
at io.reactivex.e.e.b.dm$a.run(FlowableSubscribeOn.java:82)
at io.reactivex.e.g.l.run(ScheduledRunnable.java:61)
at io.reactivex.e.g.l.call(ScheduledRunnable.java:52)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.io.IOException: Upstream completed prematurely.
... 23 more
It would be useful to count how many shells have been opened, are open, and have been closed.
Would be useful when optimizing apps, e.g.
I tested Root Validator in nexus6 with magisk. Normally it works. Thanks! 👍
But if magisk hide enabled (with magisk manager hiding enabled),
RxShell rooting detection doesn't works.
When a time-consuming binary is executed, the output is always available after execution. And I need to respond immediately to each line of output.
Sample pseudocode:
int main(int argc, char **argv) {
printf("sleep for 5 sec.\n");
sleep(5);
printf("exit.\n");
return EXIT_SUCCESS;
}
I need to get a callback such as "onLineOutput"(or "onNext" in Rx) while "sleep for 5 sec." output, not all things after 5 seconds.
Please help me, even if it is to provide a way to implement it.
Checking without root can default to ENFORCING
due to permission denied.
Error during build after adding the library to the build.gradle
file.
Error:com.android.builder.dexing.DexArchiveBuilderException: Error while dexing eu/darken/rxshell/process/RxProcess.class
Error:com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)
Hi, I'm trying your library, but testing with some commands like adb pair, after launching it, the terminal ask user to input a number:
C:\Android\sdk\platform-tools>adb pair localhost:12333
Enter pairing code:
How it is possible to wait this response and writing something to continue. Calling like the next, keeps the proccess running without exit.
private fun rxshellOpenClose(command: List<String>): Cmd.Result? {
val session = RxCmdShell.builder().build().open().blockingGet()
val resultBlocking = Cmd.builder(command).execute(session) // Blocking
session.close()
return resultBlocking
}
thank you @d4rken
Ggh
How to execute Commands one by one and get results in real time like libsu. I don't want su shell i want sh shell.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.