GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - BLuFeNiX/SMTShell-API: Execute shell commands and load shared objects as the system user (UID 1000) on devices running SMTShell.

BranchesTags
Open more actions menu

Latest commit

 

History

5 Commits
5 Commits

Folders and files

NameName
Last commit message
Last commit date
.idea
.idea
 
 
api
api
 
 
gradle/wrapper
gradle/wrapper
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
build.gradle
build.gradle
 
 
gradle.properties
gradle.properties
 
 
gradlew
gradlew
 
 
gradlew.bat
gradlew.bat
 
 
settings.gradle
settings.gradle
 
 

Repository files navigation

SMTShell-API

SMTShell-API is an Android library that provides methods for executing shell commands and loading shared objects as the system user (UID 1000) on Samsung devices that are running SMTShell.

Including this in your project

project build.gradle

allprojects {
    repositories {
        // other repos here
        maven { url "https://jitpack.io" }  // <--- add this
    }
}

app/module build.gradle

dependencies {
    implementation 'com.github.BLuFeNiX:SMTShell-API:1.0'
}

Get permissions

Declare one or both of these, and arrange for your user to grant them as per usual:

<uses-permission android:name="smtshell.permission.SYSTEM_COMMAND" />
<uses-permission android:name="smtshell.permission.LOAD_LIBRARY" />

API Methods

executeCommand

executeCommand(Context context, String cmd) executeCommand(Context context, String cmd, CommandCallback cb)

SMTShellAPI.executeCommand(context, "ls -la /data/data/android/", new SMTShellAPI.CommandCallback() {
    @Override
    public void onComplete(String stdout, String stderr, int exitCode) {
        Log.d(TAG, "stdout: " + stdout);
        Log.d(TAG, "stderr: " + stderr);
        Log.d(TAG, "exit code: " + exitCode);
    }
});

loadLibrary

loadLibrary(Context context, String path) loadLibrary(Context context, String path, LoadLibraryCallback cb)

Load a shared object as the system (UID 1000).

SMTShellAPI.loadLibrary(this, getApplicationInfo().nativeLibraryDir + "/" + "libsmtshell.so", new SMTShellAPI.LoadLibraryCallback() {
    @Override
    public void onComplete(boolean success) {
        if (success) {
            // library loaded!
        } else {
            // something went wrong!
        }
    }
});

Note: Callback will not fire if your shared object blocks the incoming thread (i.e., with an onload constructor).

ping

ping(Context context)

Pings the API. You can capture the result with a dynamic broadcast receiver:

BroadcastReceiver mApiReadyReceiver = new BroadcastReceiver() {
    @Override
    public void onReceive(Context context, Intent intent) {
        // API is ready!
    }
};

@Override
protected void onResume() {
    super.onResume();
    registerReceiver(mApiReadyReceiver, new IntentFilter(SMTShellAPI.ACTION_API_READY));
    SMTShellAPI.ping(this);
}

@Override
protected void onPause() {
    super.onPause();
    unregisterReceiver(mApiReadyReceiver);
}

You can also monitor the API going down (because the user killed it) via a recevier:

registerReceiver(mApiDeathReceiver, new IntentFilter(SMTShellAPI.ACTION_API_DEATH_NOTICE));

About

Execute shell commands and load shared objects as the system user (UID 1000) on devices running SMTShell.

Resources

Readme
MIT license
Activity

Stars

46 stars

Watchers

2 watching

Forks

8 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.