Giter VIP home page Giter VIP logo

rootshell's People

Contributors

friederbluemle avatar joeykrim avatar larsgrefer avatar rahulkumar66 avatar stericson avatar yurijmi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rootshell's Issues

What license agreement is this available under?

Please could you add some information to your README, or add a LICENSE.txt file to show what license this code is available under?

GitHub have some helpful advice here:
https://help.github.com/articles/licensing-a-repository/

The most permissive and simplest option is probably to add This project is licensed under the terms of the MIT license. to your README file.

There are lots of other options too, e.g. the Square folks typically use an Apache 2 license and add it in a LICENSE.txt file.
https://github.com/square/picasso/blob/master/LICENSE.txt

RootShell throw ArrayIndexOutOfBoundsException when trying to get command output on Android Emulator API 14 and 23

When running RootShell on older Emulator like API14 also on newer one like API23, RootShell keep throwing this exception and won't read the output from the command. This happen when calling RootTools.remount(target)

E/RootShell v1.6: 	
	length=1; index=1
	java.lang.ArrayIndexOutOfBoundsException: length=1; index=1
	   at com.stericson.RootTools.internal.RootToolsInternalMethods$7.commandOutput(RootToolsInternalMethods.java:744)
	   at com.stericson.RootShell.execution.Command.output(Command.java:288)
	   at com.stericson.RootShell.execution.Shell.processErrors(Shell.java:820)
	   at com.stericson.RootShell.execution.Shell$3.run(Shell.java:722)
	   at java.lang.Thread.run(Thread.java:856)

when calling findBinary() or exists() on a device where SuperSu is disabled - the thread is halted

Hi all,

I'm using RootShell 1.3 and 1.4 in my apps. I stumbled upon a Samsung Galaxy S5 with Android 5.0 with SuperSu installed. When going into the Settings->Application Manager->SuperSu - there is no way to Uninstall it, The only option is to click on "Turn Off" which disables it from running.

When running my app ,which uses RootShell.isRootAvailable() and RootShell.isBusyboxAvailable(), I can see the application gets stuck and after about two minutes - there is an "Application not responding" dump in the Android monitor window in Android studio. Turning SuperSu beck on in app settings resolves this situation.

Debugging the code , It looks like the RootShell.isRootAvailable() and RootShell.isBusyboxAvailable() function run on the UI thread and the app is halted due to the inability to use SuperSu to us the commands findBinary.

On devices with SuperSu turned off - it would make sense to handle this situation with an exception or a return code that the will indicate a problem.

Any ideas as to how to resolve this issue?

Thanks!

Not working with Android Studio 3.3.1

Everything seems to be working fine, except when I want to use a Java class as root, because it gives null pointer exceptions. The reason is that the folder structure has changed, and it can't find the required files.

I've tried to hardcode the required directories in the code, but the final file is not generated for some reason...

Conflicts in AndroidManifest.xml

This android library currently declares android:label and android:icon in its AndroidManifest.xml which causes conflicts with the AndroidManifest.xml of apps which are using this library:

Error:
        Attribute application@label value=(@string/main_app_name) from AndroidManifest.xml:70:13-50
        is also present at [com.github.Stericson:RootShell:39aec4590d] AndroidManifest.xml:12:9-41 value=(@string/app_name).
        Suggestion: add 'tools:replace="android:label"' to <application> element at AndroidManifest.xml:66:5-173:19 to override.

java.lang.NullPointerException

In my app Google console crashes reports there is the following log on wide variety of devices and OS versions:
java.lang.NullPointerException:
at com.stericson.RootShell.execution.Shell$1.run (Shell.java:594)
at java.lang.Thread.run (Thread.java:919)

I use version 1.6.
More stack trace:

java.lang.Object | Object.java in java.lang.Object.wait()
java.lang.Object | Object.java line 407 in java.lang.Object.wait()
com.ster...ootShell | RootShell.java line 582 in com.stericson.RootShell.RootShell.commandWait()
com.ster...ootShell | RootShell.java line 246 in com.stericson.RootShell.RootShell.findBinary()
com.ster...ootShell | RootShell.java line 196 in com.stericson.RootShell.RootShell.findBinary()
com.ster...ootShell | RootShell.java line 453 in com.stericson.RootShell.RootShell.isRootAvailable()

RootShell.exists(filename) produces unexpected return value

Testing for the existence of a file at /data/ssh/sshd_config
file mode is 600 owned by root.root, directory mode /data/ssh is 700 owned by root.root, directory mode /data is 771 owned by system.system.

First run of RootShell.exists("/data/ssh/sshd_config") returns boolean "true". Subsequent runs are more or less random. Typically inverting each run, but occasionally producing the same result back to back.

RootShell.exists(file,isDir) running root way program termination

file="/data/data/com.tencent.tim" isDir=true
this dir does not exists
when this running in the exists function and current stage is using root way , current step is

RootShell.getShell(true).add(command);
>> commandWait(RootShell.getShell(true), command);

when i push f9 to countinue ,program termination, and i can't confirm it's dir Permissions problem, is it ? sorry my english is bad, i was testing this on 7.1.2 and 5.1 (physical device) If it is my fault, sorry to disturb

java.lang.IllegalStateException - State:FLUSHED

Any ideas why FLUSHED state is bad when it wants to write?

Stacktrace:
Fatal Exception: java.lang.IllegalStateException: State: FLUSHED
at java.nio.charset.CharsetEncoder.illegalStateException(CharsetEncoder.java:670)
at java.nio.charset.CharsetEncoder.encode(CharsetEncoder.java:360)
at java.io.OutputStreamWriter.convert(OutputStreamWriter.java:178)
at java.io.OutputStreamWriter.write(OutputStreamWriter.java:324)
at java.io.Writer.write(Writer.java:141)
at com.stericson.RootShell.execution.Shell$1.run(Shell.java:607)
at java.lang.Thread.run(Thread.java:818)

Proguard error - Need help with proguard configuration

When i try to build my app, which uses this library (Version 5.0), i get the following error during transformClassesAndResourcesWithProguardForRelease build step

Preverifying...
Unexpected error while performing partial evaluation:
 Class       = [com/stericson/RootTools/SanityCheckRootTools$SanityCheckThread]
 Method      = [run()V]
 Exception   = [java.lang.IllegalArgumentException] (Can't find common super class of [com/stericson/RootTools/SanityCheckRootTools$SanityCheckThread$2] (with 1 known super classes) and [java/lang/Exception] (with 3 known super classes))
Unexpected error while preverifying:
 Class       = [com/stericson/RootTools/SanityCheckRootTools$SanityCheckThread]
 Method      = [run()V]
 Exception   = [java.lang.IllegalArgumentException] (Can't find common super class of [com/stericson/RootTools/SanityCheckRootTools$SanityCheckThread$2] (with 1 known super classes) and [java/lang/Exception] (with 3 known super classes))
Warning: Exception while processing task java.io.IOException: java.lang.IllegalArgumentException: Can't find common super class of [com/stericson/RootTools/SanityCheckRootTools$SanityCheckThread$2] (with 1 known super classes) and [java/lang/Exception] (with 3 known super classes)
Thread(Tasks limiter_10): destruction

I have this in my proguard config already

-keep public class com.stericson.** { *; }
-keep class com.stericson.RootTools.** { *; }
-keep interface com.stericson.** { *; }
-dontwarn com.stericson.**

Can someone help?

Issue getting SanityCheckRootShell to work

Hi, I'm new to Android development so please forgive my naivety. I have a rooted Nexus 4 running Cyanogenmod. I was able to download RootShell-1.3 and import to Android Studio. I was then able to run on my phone, where I get the output:

Root found.
[ROOT DENIED EXCEPTION!]
ERROR: No root access to this device

I'm thinking this is because I haven't properly set up RootShell. I believe the issue is because I haven't run RootShell's RootClass. If I simply try to run RootClass I get a few NullPointerExceptions. "You will however need to ensure that jar and dx are in your global environment path." -- not sure how to do this (I'm in Windows), please advise! I also tried to use the command line but I wasn't successful, probably because I entered it wrong. I have RootShell.jar and I placed it in the correct root directory but I haven't been able to craft the command line statement correctly.

If you could help me troubleshoot this so I can use this library I would greatly appreciate it! I can provide additional information and/or screenshots if needed.
screenshot

Does not work on Android 6

java.lang.NullPointerException: Attempt to invoke interface method 'boolean android.hardware.input.IInputManager.injectInputEvent(android.view.InputEvent, int)' on a null object reference
at android.hardware.input.InputManager.injectInputEvent(InputManager.java:679)
at com.android.commands.input.Input.injectMotionEvent(Input.java:259)
at com.android.commands.input.Input.sendTap(Input.java:197)
at com.android.commands.input.Input.run(Input.java:104)
at com.android.commands.input.Input.main(Input.java:59)

Public commandWait?

I've noticed in RootShell.java, there's
// -------------------- // # Public Methods # // -------------------- private static void commandWait(Shell shell, Command cmd) throws Exception
It's in "Public Methods" section while the method itself is private. This method is quite useful, should it be public?

Holiday Wishes...

I just wanted to wish @Stericson Family and Friends the Best Wishes, Happy Holidays and a Happy New Year!!!

I hope this year ends even more Uplifting and Promising as the last (bumpy) year has ended with!!

Take care My Friend.

~Ibuprophen

Gradle build fails at time of debugging with the RootShell present as aar

The error throws up when Gradle is building for the deployment on a device for debugging

This is the stackstrace using
./gradlew clean build --full-stacktrace --info

Error:

processing com/stericson/RootShell/containers/RootClass.class...
Dex: Error converting bytecode to dex:
Cause: java.lang.RuntimeException: Exception parsing classes
    UNEXPECTED TOP-LEVEL EXCEPTION:
    java.lang.RuntimeException: Exception parsing classes
        at com.android.dx.command.dexer.Main.processClass(Main.java:781)
        at com.android.dx.command.dexer.Main.processFileBytes(Main.java:747)
        at com.android.dx.command.dexer.Main.access$1200(Main.java:88)
        at com.android.dx.command.dexer.Main$FileBytesConsumer.processFileBytes(Main.java:1689)
        at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
        at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
        at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
        at com.android.dx.command.dexer.Main.processOne(Main.java:695)
        at com.android.dx.command.dexer.Main.processAllFiles(Main.java:592)
        at com.android.dx.command.dexer.Main.runMonoDex(Main.java:321)
        at com.android.dx.command.dexer.Main.run(Main.java:292)
        at com.android.builder.internal.compiler.DexWrapper.run(DexWrapper.java:54)
        at com.android.builder.core.DexByteCodeConverter.lambda$dexInProcess$0(DexByteCodeConverter.java:174)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
    Caused by: com.android.dx.cf.iface.ParseException: class name (com/stericson/rootshell/containers/RootClass) does not match path (com/stericson/RootShell/containers/RootClass.class)
        at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:520)
        at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
        at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
        at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
        at com.android.dx.command.dexer.Main.parseClass(Main.java:793)
        at com.android.dx.command.dexer.Main.access$1600(Main.java:88)
        at com.android.dx.command.dexer.Main$ClassParserTask.call(Main.java:1728)
        at com.android.dx.command.dexer.Main.processClass(Main.java:779)
        ... 16 more
    
1 error; aborting
:app:transformClassesWithDexForDebug FAILED
:app:transformClassesWithDexForDebug (Thread[Daemon worker Thread 2,5,main]) completed. Took 0.091 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: Unable to pre-dex '/home/ashish/.android/build-cache/d7b9690e742fb74914c8f6e13a90e030a20cd61a/output/jars/classes.jar' to '/home/ashish/Work/experiments/Location-sample/app/build/intermediates/pre-dexed/debug/classes_a8b01eddcc4d24ab0b2b79d47a2fa5e5828a8a50.jar'

Any fix for this?

Java As Root , executing a class - Not found error

i finally managed to build the anbuild.dex with AndroidStudio

but when i run the JavaCommand

it outputs ( not found ) , as if its executing the class as string in the command line

Shell shell;
        try {
            shell = RootShell.getShell(true);
            JavaCommand cmd = new JavaCommand(
                    43,
                    false,
                    MainActivity.this,
                    runclass.class.getName()) {

                @Override
                public void commandOutput(int id, String line) {
                    Log.v("aaaaa",line);
                    //visualUpdate(TestHandler.ACTION_DISPLAY, line + "\n");
                    super.commandOutput(id, line);
                }

            };
            shell.add(cmd);
        } catch (Exception e) {
            e.printStackTrace();
        }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.